Normal map doesn't work with gltf2bam

The model will be murky grey in pview when I want to check if the normal map was enabled.
Any help please?

Remember Gltf/Glb files needs “gltf-viewer” (not pview) to be properly previewed.

1 Like

Thanks for your reply.
But… I mean,the model will be murky grey in pview when I want to check if the normal map was enabled EVEN IF I transformed glb to bam by gltf2bam.
Any advice please?

This is explained in the manual, it is due to the way tangent vectors are stored in gltf files.

Use panda3d-simplepbr to display the model, or use gltf-viewer instead of pview.

…I don’t want to use simplepbr.
I have transformed glb to bam.
This problem still exist.
Is there any way to deal with it?

Can we transform glb to egg directly?

And…I checked the manual.
The manual shows:

glTF files do not contain binormal vectors, even if normal mapping is used. This may be an issue when using custom shaders that expect a binormal vector to be present for normal mapping. Instead, binormal vectors are intended to be derived from the cross product of the normal and tangent vectors.

So can that explain the following question?
the model will be murky grey in pview when I want to check if the normal map was enabled EVEN IF I transformed glb to bam by gltf2bam.

And…I noticed that the manual offered a method to deal with it.
With this information, the binormal vector can be reconstructed as follows in the vertex shader:
binormal = cross(p3d_Normal, p3d_Tangent.xyz) * p3d_Tangent.w

So could you please tell me how to do it?

There’s perhaps an argument to be made here that it might be worth adding the option to “gltf2bam” of having it generate binormals as part of its conversion process.

This might be useful for rendering setups that include assets that already have binormals, and that therefore assume their presence, or that don’t intend to use PBR but that draw from an asset pipeline that passes through the glTF format.

To be clear, this isn’t something that would change the model-file, and thus wouldn’t change what you see in PView, I believe.

Rather, it’s saying that, when rendering the model in your program, you can include in your own shaders the calculation of the binormal, via the line that they quote.

Yes,also,I think we need gltf2egg.The .egg could be more convient afterall.
I have tried bam2egg.I thought we could recompute tangent and binormal for all normal maps by egg-trans.
But the model will be all white.

There are no plans to offer a gltf2egg utility. We would rather spend our development efforts improving
glTF support.

Is there a particular reason you can’t use panda3d-simplepbr, or otherwise use a custom shader to do normal mapping? We could certainly look into supporting this better or offering a conversion function, but it just hasn’t come up so far.

The biggest problem is simplepbr lacks tutorial.
I switched to maya2egg.
It is the BEST egg exporter.
I don’t know who made it but I really appreciate his/her work.