• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

Weird terrain shadows bug

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,266
What is it?
Render pipeline limitation of legacy graphics APIs such as fixed function OpenGL and Direct3D. The line is caused by one 4x4 tile terrain chunk having different significant lights from the other when drawn.

Each draw operation was limited to at most 8 light sources affecting it. In order to support more lights, the draw operation would need to be repeated multiple times and the results blended, which is extremely CPU and GPU time intensive and couples performance to the number of lights in a scene, more specifically affecting a piece of the scene. These performance implications are likely why Blizzard choose to not support more than 8 light sources affecting a piece of the scene (single draw pass) and instead they use a light selection algorithm that tries to select the 8 most visible light sources for a piece of the scene. This allows more than 8 light sources to be visible and impact the scene, within limitations. The limitations are that the algorithm for selecting lights is not perfect and might not choose the most visible lights for a piece of the scene and that if more than 8 light sources are close by there may be visible discontinuities due to which light sources are selected for each piece of the scene.

What is happening above is the terrain chunks to the left are being drawn with the light source from the torch model, while the terrain chunks to the right are not as the light selection algorithm deems other light sources in the scene more visible. This commonly happens if you have a lot of light sources nearby (each chunk with multiple torches) or if you are using too many models with long reaching light sources, such as global illumination models. The flaws in the light selection algorithm can be so bad at times that it will dump the global illumination light source (day/night lighting) for some distant point light sources causing terrain to render effectively black.

Modern graphics APIs with programmable shaders allow lights to be handled in different, more efficient and scalable ways. For example StarCraft II does not have this limit and light sources can even dynamically cast shadows while still performing very well.
 
Status
Not open for further replies.
Top