[DAE->GLTF Converter] Inverted normals when using color based material, gltf model is black.

Probably same problem as this discussion: http://cesiumjs.org/forum.html#!topic/cesium-dev/nlWiGXaaDz4/discussion

I have a simple dae model exported with blender. No textures, no animation. One material with a diffuse color.

When I try to convert this dae with the GLTF converter no errors are shown but the color is black both in the converter window and in Cesium.

The same model exported with a texture works fine: it is colored and lighting works.

After some research i found that if we change the fragmend shader of the gltf where it calculates the “amount” of light

from:

diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);

to:

diffuse.xyz *= max(dot(-normal,vec3(0.,0.,1.)), 0.);

everything seems to work fine.

I do not known if this is a problem in the blender collada exporter, in the converter or something else but the normals seems to be inverted.

Maybe this can help someone else with the same problem.

I attached:

the original dae file (pointer.dae)

the exported gltf (export_original.gltf)

the one with the normals inverted in the shader (export_normals_inverted.gltf).

regards.

export_original.gltf (9.05 KB)

pointer.dae (5 KB)

export_normals_inverted.gltf (9.03 KB)

Hi,

Thanks for the report. To help narrow this down, have you tried to load the COLLADA model in Visual Studio or Mac Preview? See here.

Thanks!

Patrick

Hi, I'm sorry that I need to resurface this discussion, but I'm facing the same issue. However, I am very new to Cesium and Blender.

In what file can I find the line of code referenced? Thank you.

Andres