aframevr / aframe-inspector

:mag: Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
https://aframe.io/aframe-inspector/examples/
MIT License
655 stars 203 forks source link

Display problem with gltf mesh #454

Closed dVurpillot closed 7 years ago

dVurpillot commented 7 years ago

Hello,

I was wondering if I was the only one having trouble displaying glTF mesh inside the inspector viewport. I tried with a few models and it happened each time: the bounding box appears to be "ok" but the mesh itself is "stuck" in the background.

example

Best,

fernandojsg commented 7 years ago

Hi @nazga could you post a codepen or similar with the scene in the example and the assets that you use?

dVurpillot commented 7 years ago

It really is a basic scene as you can see: https://codepen.io/nazg/pen/KaQYrv

I was only testing gltf implementation. I tried to use 0.3.0, 0.4.0 and 0.5.0, but error persisted. As for the model, you can grab it here

feiss commented 7 years ago

@nazga could you upload the model anywhere else? that link expired.

But very probably is a problem with shaders. When you export the gltf with shaders in the materials, they are not rendered correctly. Is a known issue in Threejs

I recommend you to use standard materials, exporting the asset to collada and then using collada2gltf -f file.dae -k. The -k parameter forces to use standard materials instead of shaders (and I can see in your screenshot that you are not using very complex materials nor need any shaders)

dVurpillot commented 7 years ago

Sorry for the delay: gltf mesh and the regular mesh.

I'm using the obj2gltf converter right now, I will give a try to your suggestion if it can fix the problem.

donmccurdy commented 7 years ago

@nazga I can confirm the problem is shaders in the model. Currently obj2gltf does not have an option to use standard materials instead of custom shaders. If you can convert to DAE, then DAE->glTF should work with the -k option. Otherwise, the issue has been fixed in the next version of three.js (whenever that is released and then lands in A-Frame).

dVurpillot commented 7 years ago

Thank you, I was again struggling with this issue yesterday.

For some reason, going from .obj -> .dae -> .gltf through the collada2gltf never works correctly for me.

I always get a faulty gltf file (binary or not) that does not work/load with the three.js gltf viewer I am using to check my meshes.

I will just use another format and wait for it to work with obj2gltf. By the way, does Aframe handle quantized and oct-encoded glTF ?

fernandojsg commented 7 years ago

@feiss @donmccurdy @nazga so can we close this right?

feiss commented 7 years ago

@fernandojsg I think so, although nazga has more questions (and I don't know the answer, maybe @donmccurdy does)

@nazga did you tried opening the obj in blender, exporting to collada and then collada2gltf? btw, the model looks too big for a vr experience, it is 200 meters long..

dVurpillot commented 7 years ago

Yes, I suggest we close this issue:

@fernandojsg @feiss I will open another thread elsewhere about quantized and oct-encoded glTF, since it's another topic.

fernandojsg commented 7 years ago

@nazga thanks! ;)

donmccurdy commented 7 years ago

Filed a request for obj2gltf to support KHR_materials_common extension here: https://github.com/AnalyticalGraphicsInc/obj2gltf/issues/52

Re: earlier questions —

Also, the glTF 2.0 spec is going to be finalized soon. The tooling isn't really merged yet, but there's an experimental gltf2-model-next component in A-Frame extras. That will automatically pull the latest version of THREE.GLTF2Loader from the three.js/dev branch.