Normalmap

Hi everyone.



I am currently trying to properly load texture as a normal map from blender.

I need an algorithm that converts gray-scale image to a normal map.

Could someone point me to such ? I was trying to find it for the whole day but with no scuccess :frowning:





Kaelthas

The texture editor in jMP can do that, heres the filter that does it:

http://code.google.com/p/jmonkeyengine/source/browse/trunk/sdk/jme3-texture-editor/src/com/jme3/gde/textureeditor/filters/BumpMapFilter.java

1 Like

Cool,



that is pretty awesome :smiley:

Thanks. You saved me a lot of time :slight_smile:

I can use it but I’ll need to copy the code since this is in entirely different project.

I’ll put the code in texture helper.



Could you only tell me what is the purpose of the ‘a’ parameter in the filter method?

I guess it is some kind of strength factor, is it not?

I guess so, “strength” is the only parameter in the UI.

OK



the implementation of normal map is in place. And it seems it works fine :slight_smile:

The only thing I am worried about is how to determine if the texture I get is a normalmap.



Blender can use predefined normalmap texture taht is provided by the user as an image.

But generated textures can be used also and they are not explicitly converted to normal-maps.



Do you have any suggestions how to distinguish generated textures from the loaded ones??

We could use some kind of flag, user data or interface.

But every one of these changes would require code changes.



Maybe a proper TextureKey set inside each generated texture would be a good idea?



How do you think ??