Jump to content



Adding lighting effects for fires and torches


  • Uploaded: Sep 18 2013 04:25 PM
  • Views: 417
  • Album: Caveman

Copyright

Caveman (C) 2000-2013 Rockland Software Productions

Adding lighting effects for fires and torches

Adding lighting effects for fires and torches

 

The d3d fixed function pipeline provides a large number of ways to influence lighting. global, material, and light data can all contribute.

 

A good way to control lighting was required. it was decided that materials would be where lighting was adjusted. globals are set to "pass through" values, so they have no effect, lights are static except for attenuation of diffuse for the sun/moon light based on time of day.

 

instead of one material per mesh subset, the game uses a global database of 7 types of materials (so far) for all objects. that way lights can simply be turned on, globals have no effect, and all lighting can be controlled via a shared global material.

 

a unexpected upside off this is brightness control. instead of playing with gamma correction, which tends to wash out colors, global materials means its easy to simply multiply all the power values of all materials in the game (all 7 of them) to increase brightness. This also avoids the overhead of adding an extra light for brightness.

 

The sun/moon uses one directional light. fires and torches each add one point light to the scene. cutoff ranges for point lights are kept short, on the order of 20-30 d3d units from the light source.