terrain lighting

Started by
2 comments, last by Lutz 17 years, 9 months ago
I have my terrain loaded into an ID3DXMesh, and I use D3DXComputeNormals, but you can really see the triangles due to interpolation errors. It is not noticable with a texture, but is this normal? http://img359.imageshack.us/img359/4204/lighting0es7.jpg It gets worse the noisier the terrain is: http://img53.imageshack.us/img53/7311/lighting6qf.jpg By the way I am using fixed function D3D vertex lighting.
-----Quat
Advertisement
Anyone can see that you are using vertex lighting and that is the problem. It is absolutely normal. Your vertex normals are interpolated along the edges of the triangles, the results are good but not the best. If you want best results, you must implement per pixel lighting using shaders. You cannot get better results than this using the fixed graphics pipeline.
If you set your triangles up like this, it will reduce the problem.
    +-+-+-+-+    |/|\|/|\|    +-+-+-+-+    |\|/|\|/|    +-+-+-+-+    |/|\|/|\|    +-+-+-+-+ 
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Quote:Original post by meeshoo
If you want best results, you must implement per pixel lighting using shaders. You cannot get better results than this using the fixed graphics pipeline.


This is not quite true. You CAN use per pixel lighting (aka normal mapping or dot3 bumpmapping) in the fixed function pipeline. This is an example for object-space normal mapping. You can also use it for terrain. It's quite easy to implement and runs even on a GF2.

Lutz

This topic is closed to new replies.

Advertisement