3D Model with Diffuse AND Normalmap texture

隐身守侯 提交于 2019-12-10 20:51:22

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!