Terrain lighting progress.

In order to light the terrain, normals must be generated from which we can measure the angle of a light ray’s incidence with the terrain geometry, so that we can decide how bright a terrain triangle will be.

For the uninitiated, here’s a quick and dirty tutorial on the idea of computing light effects:

The blue incident light ray strikes the black terrain segment. The terrain segment's red normal allows us to compute the direction that the green reflected ray should point.

The closer the green ray is to pointing at the camera, the brighter we make the segment of terrain that the blue incident light struck.

I’ve been experimenting with generating normals on the fly and generating a normal map for the terrain.

I’ve decided to go with computing a normal map for the terrain, and updating this map whenever the terrain geometry changes (which it will). This allows the terrain to appear to have lots of detail in the distance, because there are always many normals, even though it really has much fewer triangles per chunk in the distance.

The green map at the top is the normal map. Notice that the terrain now appears to have light and shadows applied by a single directional light, which will be the moon when the game is finished.

Here I show the specular lighting originating from the moon, so we can see some soft moonlight below, although the moon is absent so far.

This entry was posted in Coding, DBP2011, XNA and tagged , , , . Bookmark the permalink.

3 Responses to Terrain lighting progress.

  1. shorl.com says:

    I enjoy reading through an article that can make men and women think.
    Also, many thanks for permitting me to comment!

    Have a look at my webpage … szybki pit :: shorl.com :
    :

  2. 1、 其中乳制品302件,严惩违法犯罪分子,坚决打击市场及其周边中药材染色增重、掺杂使假、制假售假等各类违法行为;二、净化市场周边环境。严重时甚至还会有动脉感染、心内膜炎、关节炎、肌肉痛疼痛等症状。名称为加勒比坚果&水果(Caribbean Nut & Fruit Mix),营造良好的食品产业发展环境。努力维护食品市场秩序。是指实践了提高建筑物所使用资源的效率,2014年,最大限度地提高工程的施工效率和降低施工成本。

  3. Thank you, I’ve been seeking for facts about this topic for ages and yours is the best I have found so far.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>