|
|
1.4.9.3 Can this problem be solved?
You can get rid of the lighting artifact by applying double_illuminate to the object in question. When
a surface is double illuminated, it does not matter which way its normal points - it will always be illuminated
regardless of which side the light source is. Of course it should not matter that the object is now illuminated from
both sides. If this is a problem, then the problem is not easily solvable.
Note that in the example given at the beginning of this section this solution does not work: It would illuminate
the whole triangle with both light sources! However, this solution works well with closed triangle meshes, where the
inner side of the mesh is shadowed by the mesh itself. However, if you are using no_shadow in the object
(for example to get rid of shadow line artifacts), new problems can arise
in the lighting (such as bright parts in places where there should not be any; these are all cause by this same
problem).
The slope pattern is more problematic and there is no generic solution which will work in all cases. Fortunately
the most common use of the slope pattern is in heightfields, and there a solution is possible:
If you are having this problem in a smooth heightfield, the solution is to mirror the color_map (or whatever map
you are using) around 0.5. This way it does not matter if the normal is reversed. That is, if you had something like
this in a heightfield:
slope y color_map
{ [0.50 rgb <.5,.5,.5>] // rock
[0.75 rgb <.8,.4,.1>] // ground
[1.00 rgb <.4,1,.4>] // grass
}
you simply have to mirror the map around 0.5, ie. add the values from 0 to 0.5 in reverse order:
slope y color_map
{ [0.00 rgb <.4,1,.4>] // grass
[0.25 rgb <.8,.4,.1>] // ground
[0.50 rgb <.5,.5,.5>] // rock
[0.75 rgb <.8,.4,.1>] // ground
[1.00 rgb <.4,1,.4>] // grass
}
Besides this you should, of course, apply double_illuminate to the heightfield in order to get the
proper lighting.
|
|