Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

3D Model with Diffuse AND Normalmap texture

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)

like image 274
andre Avatar asked Jul 12 '26 23:07

andre


1 Answers

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

like image 186
Xoppa Avatar answered Jul 18 '26 17:07

Xoppa