Created
August 24, 2024 16:05
-
-
Save sovetski/c8092241c93b36686a08c4768e10aaa4 to your computer and use it in GitHub Desktop.
Add a background for scene in react fiber (r3f)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Canvas, useLoader } from "@react-three/fiber"; | |
export default function Scene() { | |
const backgroundImage = useLoader(THREE.TextureLoader, "/bg.png"); | |
return <Canvas scene={{ background: backgroundImage }}>...</Canvas>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment