Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Example of Normal Mapping

edited February 2014 in Shaders Posts: 49

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 Feb 19, 7 15 46 AM.jpg

https://www.dropbox.com/s/6thu8g26q4vn7k9/Video Feb 19, 7 16 08 AM.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

http://pastebin.com/T9ejA7jH

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.

Comments

Sign In or Register to comment.