Hi,
I have this component which works
import {
useLoader,
} from "@react-three/fiber";
import { TextureLoader, SRGBColorSpace } from "three";
export default function EnsembleImage(...)
const couche1 = useRef();
const image = useLoader(TextureLoader, "/slide/nature_morte.avif");
return(
<mesh ref={couche1} position={[0, 0, 4]}>
<planeGeometry ... />
<waveShaderMaterial
uTexture={image}
...)
..
I would like to accelerate the first print of this. The image is actually enormous and take a while to load. There’s also a custom shader as you can see. Actually, only a third of the image is visible on my website and the camera moves after to show it all. Is it possible to load a first picture on load which would represent only a third of the whole version, and then load the full picture when this second one is loaded ? I made this but it is not working:
useEffect(() => {
couche1.current.material.uTexture = useLoader(
TextureLoader,
"/slide/concat9.avif"
);
},[])
Is it actually a good idea ? If yes, how to wait for the answer of useLoader ? It must come from this. How would you accelerate all this globally ? Quite an open question. I am here if you need more information. Thanks.