Using Normal Map


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.



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):
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.