glTF Model (.glb) loaded has no colour #617
Replies: 4 comments 1 reply
-
function Model(props) {
const { scene } = useLoader(GLTFLoader, model, ...)
return <primitive object={scene} dispose={null} />
} that's all you need @sumanthyedoti , you never should have to add/remove stuff imperatively, this is against react. useloader uses suspense, by the time you fetch the result it's guaranteed to be there. how your gltf looks has to do with materials, this is not related to r3f or the gltfloader (useloader is a simple wrap for new GLTFLoader().load(url, ...). looks like your lights are either too bright, or missing, or you dont have colors in the gltf. |
Beta Was this translation helpful? Give feedback.
-
btw check out https://github.com/react-spring/gltfjsx it lets you lay out gltfs declaratively |
Beta Was this translation helpful? Give feedback.
-
Thanks for suggesting an easier, better way @drcmda. As you said, the lights we too bright. |
Beta Was this translation helpful? Give feedback.
-
can it make for mobile application using react native? @sumanthyedoti @drcmda |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The way I loaded the
.glb
file is:Is this the problem with the way it is loaded or with the model itself? Am I missing textures? But I had loaded Littlest Tokyo model perfectly, this way.
Also, I had seen models loaded as JSX (children/objects in a scene). But how is it possible to construct a huge dynamic scene again with JSX.
Thanks.
Extended:
Beta Was this translation helpful? Give feedback.
All reactions