pmndrs / gltfjsx

🎮 Turns GLTFs into JSX components
https://gltf.pmnd.rs
MIT License
4.5k stars 293 forks source link

Joint objects are not included in output #88

Closed AlexanderProd closed 3 years ago

AlexanderProd commented 3 years ago

I've got a rigged model which includes a lot of joint objects, unfortunately I've noticed that all the objects which are behind a joint are not visible in the scene. They become visible when I delete the joint.

This is what my model looks like

Bildschirmfoto 2021-05-19 um 14 34 58

This is what the object tree looks like in Cinema 4D.

Bildschirmfoto 2021-05-19 um 14 34 34

The Child objects are regular Polygon objects.

Bildschirmfoto 2021-05-19 um 14 46 57

This is what my model looks like in the browser when I load the generated JSX file. As you can see only the part which is not a child of a joint is visible.

Bildschirmfoto 2021-05-19 um 14 44 42

I'm not sure if theyre not even included in the generated JSX file or simply not shown in the browser.

I'm wondering how I can fix this since I need the joints for an animation.

I can upload the model as Cinema 4D, FBX, OBJ or GLTF file.

drcmda commented 3 years ago

try using

const { scene } = useGLTF(url)
return <primitive object={scene} />

and see if the model shows correctly. if not the error must be with the c4d import. if it does show i would be glad if i could get that model so i can run tests.

AlexanderProd commented 3 years ago

try using

const { scene } = useGLTF(url)
return <primitive object={scene} />

and see if the model shows correctly. if not the error must be with the c4d import. if it does show i would be glad if i could get that model so i can run tests.

Thank you, when I import the model like this it does show indeed.

Bildschirmfoto 2021-05-19 um 15 23 43

I've attached the model as FBX and the GLTF export from Cinema. Archiv.zip

EDIT: Reuploaded the archive with the native C4D file.

drcmda commented 3 years ago

just a precision issue, the model is tiny, so it cuts off digits.

npx gltf-pipeline -i UR3e.gltf -o scene.glb --draco.compressionLevel=10
npx gltfjsx scene.glb -p=6   

(added draco here to shrink it, 4mb was quite big)

https://codesandbox.io/s/basic-demo-forked-dp92s?file=/src/App.js

AlexanderProd commented 3 years ago

@drcmda Thanks a lot! I spend two days trying to figure out whats wrong with my model. It works perfectly now, out of curiousity, what was the problem with the joints?

drcmda commented 3 years ago

As I said, precision. If you look over your code you'll see scale={0} so it practically hid them. It uses two digits after the point by default, so 0.00123 end up being 0. By increasing digits this goes away. I'd still rather increase the model in the modeling software though.