Terrain Lighting

It’s time to take a break from optimizations and to aim to a more user-friendly feature: Terrain Lighting. Although there are several approaches to accomplish this goal, I’ve chosen a simple, yet effective, technique known as Slope Lighting by which the color of a vertex is calculated by considering the height of its neighbors.

My implementation is based on an article written by Philip Dutré for GameDev.net. Below is a sample of a lightmap generated using this technique along with the resulting landscape with and without textures.

 

The lightmap applied to the terrain

 

 

And the texture

 

 

The final result

 

As you can see from the images, the results are far from perfect. The current implementation does not calculate soft shadows and there are artifacts in the shadow edges, but that’s acceptable for the moment.

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