Skip to content

Instantly share code, notes, and snippets.

@sovetski
Created August 24, 2024 16:05
Show Gist options
  • Save sovetski/c8092241c93b36686a08c4768e10aaa4 to your computer and use it in GitHub Desktop.
Save sovetski/c8092241c93b36686a08c4768e10aaa4 to your computer and use it in GitHub Desktop.
Add a background for scene in react fiber (r3f)
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