donmccurdy / three-gltf-viewer

Drag-and-drop preview for glTF 2.0 models in WebGL using three.js.
https://gltf-viewer.donmccurdy.com/
MIT License
2.1k stars 534 forks source link

Shaders not loading in web based viewers #251

Closed parassrivastav closed 3 years ago

parassrivastav commented 3 years ago

I had a fbx which I converted into glb using fbx2gltf npm package then compressed it using

gltf-pipeline -i model.glb -o modelDraco.glb -d

The file appears in blender with shaders etc like following image but not in https://gltf-viewer.donmccurdy.com/ or https://sandbox.babylonjs.com/ where it appears as following, without shaders n all. image

Here's the glb file https://drive.google.com/file/d/1E9Y7DbZCxoWiFJlhjlx8WDm2nbNhJRHT/view?usp=sharing

donmccurdy commented 3 years ago

Are you using the --khr-materials-unlit flag with FBX2GLTF? The result you're seeing in the second image is correct, given this GLB, because the entire model is specified as "unlit". This means shading is disallowed. So I think there is something incorrect, or a wrong setting maybe, in the conversion from FBX to glTF.

donmccurdy commented 3 years ago

Continuing in chat: https://chat.stackoverflow.com/rooms/230422/discussion-between-paras-and-mugen87.

parassrivastav commented 3 years ago

Removing --khr-materials-unlit flag has made it better but the glasses are still not transparent. image

donmccurdy commented 3 years ago

The glTF viewers are displaying the GLB correctly, based on what's in the GLB.

Since this is a problem with what the FBX2glTF exporter has written into the GLB file, you will need to share the original FBX file to get help with this, file a bug on FBX2GLTF, or work with a 3D artist to edit the file in modeling software.

parassrivastav commented 3 years ago

I shared the original fbx, can you help ?

On Sat, Mar 27, 2021, 11:41 PM Don McCurdy @.***> wrote:

The glTF viewers are displaying the GLB correctly, based on what's in the GLB.

Since this is a problem with what the FBX2glTF exporter as written into the GLB file, you will need to share the original FBX file to get help with this, or work with a 3D artist to edit the file in modeling software.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/donmccurdy/three-gltf-viewer/issues/251#issuecomment-808775355, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKMEIPBQ7Z62Q4TB56TQSDTTFYNU5ANCNFSM4Z25LCHQ .

donmccurdy commented 3 years ago

Loading this FBX file in Autodesk FBX Review, I see:

Screen Shot 2021-03-29 at 10 12 12 AM

Importing the FBX file directly to Blender, I see:

Screen Shot 2021-03-29 at 10 13 39 AM

In neither case are the windows transparent, so I think it's safe to say this FBX file has some problems. You'll need to fix those manually in Blender (or other software) and set Blend Mode -> Alpha Blend on the windows' material:

Screen Shot 2021-03-29 at 10 15 19 AM

With that done, and then exporting to GLB, you can view it in three.js correctly. You may want to adjust the Alpha slider a bit.

Screen Shot 2021-03-29 at 10 16 28 AM