Hubs-Foundation / Spoke

Easily create custom 3D environments
Other
652 stars 255 forks source link

glTF files with Specular Glossiness materials are broken #388

Open Mordax opened 5 years ago

Mordax commented 5 years ago

Seems to be a problem both in Spoke and in spawning items inside Hub scenes.

I made a 3d model with textures using Paint 3D and exported it into a .glb file. It renders perfectly in SketchFab but if I choose the file from Spoke, it appears as a greyed out, non textured model.

If I use the SketchFab url in spoke, it gives me a JSON error, or a network error - it hasn't worked yet for me via that way. If I use the SketchFab url in a Hubs scene, same issue - greyed out untextured model spawns.

Any idea what might be causing this issue?

I'm on Windows 10, by the way.

Mordax commented 5 years ago

Managed to get the SketchFab URL working in Spoke, but still, it imports without a texture.

robertlong commented 5 years ago

Hey @Mordax do you have some example models for me to test? I don't have access to a PC with Paint 3D right now. The sketchfab url would work too. Thanks for the bug report!

joshmarinacci commented 5 years ago

this model does the same https://sketchfab.com/models/69f2fedbd949459cbf8993305b439df8

Mordax commented 5 years ago

@robertlong Thanks for responding! Here's an example URL (my own model) -> https://sketchfab.com/models/3147e40c1f2c4fbc90a4e18561670e7e

And here's a gif demonstrating the issue on my end: bug

I'm on the 0.6.2 beta.

robertlong commented 5 years ago

Thanks @Mordax unfortunately Spoke and Hubs do not currently support the KHR_materials_pbrSpecularGlossiness glTF extension. This is due to a bug in our glTF cache and a limitation in the Three.js GLTFLoader and GLTFExporter.

The Specular Glossiness material cannot be cloned which makes it so that our glTF cache gives you a broken material. This bug is tracked here and most recently here.

There is also no support in the GLTFExporter for exporting this specular glossiness material, so once we fix the bug we will also have to add support to the GLTFExporter.

The bug in the glTF cache could be fixed in Hubs by simply loading a new copy of the model each time the model is spawned. This would result in reduced performance, but the model would load correctly.

For now the best thing you can do is use the Metallic Roughness PBR model when exporting a glTF model. Unfortunately, I don't think that is currently possible in Paint3D.

Mordax commented 5 years ago

@robertlong Thanks for that explanation! Strangely enough... I managed to make it work? Glossy texture and all. Link to the working hubs scene: https://hubs.mozilla.com/scenes/CbjfU0O/cyberpunk-clubhouse .

Here's how I did it -

If you do anything else, like adding another gltf, it fails to do anything.

@joshmarinacci Try the above out? Download the cake glb, manually convert to gltf so all the files are in one folder, not textures in separate folder and add it in Spoke. Maybe this can be recreated?

Mordax commented 5 years ago

But yeah, the glossiness is lacking compared to how Sketchfab shows it.

robertlong commented 4 years ago

ThreeJS now has support for cloning objects with the specular glossiness material, so we're getting close! I'll upgrade Spoke after we make the jump in Hubs.