Using Normal Map

Hello,

is there a way to use normal map with some spritesheets in OpenFL (or Lime?) ?
I’m really interested in this topic but I don’t really know what is possible with OpenFL/Lime.

Cheers,

Loudo

http://www.derschmale.com/2008/05/17/2d-bumpspecular-mapping/

These are some examples of how to achieve bump mapping in AS3. Using the concepts, you can implement it (something I’m planning to do soon) into this framework (he used a library called tilelayer to efficiently use drawTiles API):
https://github.com/bmfs/glslTest_openfl
How it works is basically add the Before and After class etc in such a way that for every frame it will:
-set the render target from to texture1 (the Before class),
-draws the sprite onto the texture1 (openfl will do this as it renders the sprite but since the render target is altered it draws onto the texture instead of the screen),
-renders the texture1 onto texture2 with a shader (the RenderToTextureLayer class),
-renders texture2 onto texture1 with another shader (the RenderToTextureLayer class),
-finally renders texture1 to screen (the After class).

You can write shaders that produce the effects of displacement and/or convolution, and use the concepts above to achieve normal mapping, and I think this is as close as we can get to that topic with OpenFL.

1 Like

Thanks for your advice. Not sure if I can do it myself but sure I’ll try.