After picking up Codea again after a few months, I finally decided to take a dive into shaders. Getting a crude knowledge after experimenting with the glsl API in yoyogame’s GameMaker and playing with editing the shaders in Codea, I decided it was time I tried something cool: Normal mapping! I know it’s been done before, I just wanted to try it and it seemed like a good way to get into shaders.
https://www.dropbox.com/s/or3q9yk86810qnz/Photo%20Feb%2019%2C%207%2015%2046%20AM.jpg
https://www.dropbox.com/s/6thu8g26q4vn7k9/Video%20Feb%2019%2C%207%2016%2008%20AM.mp4
The idea of using a high resolution mesh’s normal map on a low resolution for better lighting is a trick that game developers have been using for years to give the impression of an extremely high poly count. The borders of the object (in camera space) still appear low res, but with lighting trickery, everything in between has bumps and curves.
Not wanting to dive completely into 3D yet (although it wouldn’t be too hard) I whipped up this quick example using:
https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6
Here is the so desired code
Links for images I used:
Color map :: https://www.dropbox.com/s/wsuddjobx3ozynj/bricks_indented_texture_9181161_COLOR.png
Normal map :: https://www.dropbox.com/s/gi7q3qh35qndsb4/bricks_indented_texture_9181161_NRM.png
Sorry about the lack of comments inside of the code. If you want to know more, use the tutorial linked above.