PDA

View Full Version : shadows and lighting



Andrew Davey
05-14-2004, 10:59 PM
I have a heightmap, and aqt the moment i am using the hieght as my colour scheme, so the higher the ground the lighhter green. How can i do this with lights and also how can i makle the hills have a shjadow depending on the light??
Cheers

dorbie
05-15-2004, 10:43 AM
You enable lighting and set material properties for the terrain. Next you send surface normals for the terrain vertices. Finally you can use teh call glColorMaterial(GL_AMBIENT_AND_DIFFUSE); to have the colors you supply per vertex affect the material properties of the terrain.

Terrain self shadowing is a bit more complex and there are many approaches. The surfaces away from the light will be dark if you keep the ambient illumination low.