libgdx / fbx-conv

Command line utility using the FBX SDK to convert FBX/Collada/Obj files to a custom text/binary format for static, keyframed and skinned meshes.
Apache License 2.0
448 stars 116 forks source link

Model generated with Blender exports normal texture as diffuse texture. #32

Closed Dancovich closed 10 years ago

Dancovich commented 10 years ago

I created a model in Blender and created an UV map. I created a new texture for the model's material, loaded the normal map into it, changed coordinates to UV and checked "Normal Map" under "Image Sampling" tab. I also went to the "Influence" tab and checked only the "Normal" influence with a value of 1.0.

I exported this model to FBX following the wiki's recomendation of leaving it in Z-UP mode. The conversion worked as normal but when I opened the resulting G3DJ file I noticed this material definition:

"materials": [ { "id": "Normal", "diffuse": [ 0.640000, 0.640000, 0.640000], "specular": [ 0.800000, 0.800000, 0.800000], "textures": [ { "id": "Normal", "filename": "square_normal.png", "type": "DIFFUSE" } ] } ]

The texture is not mapped as a normal map, instead is being mapped as a simple texture mapping.

Is there anything wrong with my setup or is it just a bug? I'm using the commit "550272c0de9168fe01be2f004c8421700c0c5765".

xoppa commented 10 years ago

Can you please provide the FBX file exposing the issue?

Dancovich commented 10 years ago

This shared folder on Google Drive contains the original Blender file (2.69), the FBX and OBJ I generated from it and the G3DJ file generated by fbx-conv.

https://drive.google.com/folderview?id=0BxpQn5Rp9gHJbllDdGg1TGlia0k&usp=sharing

xoppa commented 10 years ago

I imported your fbx file in Maya and it doesn't have a normal map (or bump map) attached to it. The normal texture is attached as diffuse texture. Looks like this isn't an issue with fbx-conv, but more with exporting to fbx within blender. I don't know blender, so can't help you with that. But perhaps this helps: https://github.com/libgdx/libgdx/wiki/Importing-Blender-models-in-LibGDX.

Dancovich commented 10 years ago

I opened the FBX file and it really seems the FBX exporter in Blender doesn't export the normal map correctly.

I already followed this tutorial (including the part about the Z-Up compatibility), which led me to believe the FBX exporter in Blender worked correctly.

I'll close this issue and do a little research. Some of those Blender exporters are extremely picky and need to be set up in a particular way so that everything gets exported correctly.

As I stated, I have set up the texture as a normal map in Blender (there is a tab called "Image Sample" where we check the option "Normal Map" to instruct Blender to use RGB values as normals) but maybe those exporters need another setting to be configured before it will work.

Anyway thanks for your help, love your tutorials.

Regards.