问题
I want to load a 3D model with a diffuse texture and a normal map using the asset loader of libgdx. As far as I figured out the fbx (and the converted g3dj/g3db) format can contain a diffuse texture, as I could see in the fbx-conv example. (knight.g3db)
How do I add a normal map texture to it? Do I have to write my own shader for that or is there a simplified method for that? (like for the diffuse texture)
回答1:
Normal map is supported from FBX all the way up to the DefaultShader class. So if your model (FBX file) contains a normal map, it should be available in your shader. However the default shader (GLSL files) don't support normal map. So you'll have to write your own shader. The tests contain some examples on normal mapping (ShaderCollectionTest) although it might be a bit hard to read.
The uniform name is u_normalTexture, and set here: https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g3d/shaders/DefaultShader.java#L228
来源:https://stackoverflow.com/questions/20073933/3d-model-with-diffuse-and-normalmap-texture