Normal Map Lighting in Java4K

While toying with various ideas for the Java4K game programming competition, I looked into the possibility of per-pixel lighting — using the same techniques that advanced 3D games use to give higher definition to their low-poly meshes.

The effect can be seen below. If you look closely, you will see the bricks and player being lit based on their general shape, the position, and the color of the lights in the scene.

You can see some of the code for this effect below. Be warned; as the entire program needs to fit within the confines of 4 KB, it may be a bit hard to read.

NormalMap.java

I write more about normal mapping in GLSL using LWJGL (Java + OpenGL) in the following tutorial:
GLSL Tutorial: Normal Map Lighting in 2D

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s