Ampere K. Hardraade wrote:
Forgive my annoyance, but here are a few more questions. =)
First of all, I am seeing a potential problem when the sun is below the
horizon (during dawn and dusk) and doesn't cast any shadow onto the ground.
Does your code handle this special case at the moment? If so, how?
Shadows must be disabled when the sun is below the horizon because of
course there should not be shadows
(or if we want shadows we could use the moon to replace the sun but this
is not usefull atm since the night lighting
is too dark, we could calculate the light casted by the moon depending
on its phase but I am not sure it's worth it
in a non military simulation) and also because drawing horizontal
shadows for all scenery objects could kill the
frame rate for fill rate limited cards. The sun-angle property is used
to switch shadows on/off, it is also used to
compute how much we need to 'darken' the background.
Secondly, do objects with illumination (such as the flame from the f-16's
exhaust) disrupt shadows?
We have two problems here. First the flame will cast shadow because the
geometry is like any other light occluder.
Second the flame will be shadowed. The first case can perhaps be solved
with some tag in the object to tell it
not to cast shadow (a kind of 'noshadow' branch in the object tree). I
don't see a simple solution for the second case,
but perhaps it's not a real problem if the emissive light is hight
enought, the shadow could be hardly visible.
Finally, is there a potential for this technique of generating shadow to be
used on generating the effects of spot lights (eg. landing light, taxi light,
logo light, etc.)?
I don't think it's possible. In modern games that do shadows the scene
is rendered at least two times. In the first
pass the scene is rendered with only ambient term. Then shadows are
computed in the stencil. Then the second pass
is done with all lightings (ambient term, lights contribution, specular
term) with stencil test enabled to touch only
non shadowed parts of the scene. This is the way to do correct illumination.
In FG there is only one light and nearly no specular effect visible so
the rendering is a bit different (in order not to
render the scene two times). First the scene is rendered as usual with
full lighting (ambient, light, specular), then
shadows are computed in the stencil, then the stencil mask is blended on
the screen to darken the shadowed
parts.
So to be clear for shadows I darken the pixels on screen, if we use the
same technique for spotlight that mean
we will lighten pixels, this will produce really bad result in totaly
dark scene. And the same effect could be done
with a cone, just using another blending equation. To have real lights
in the dark the stencil should contain the
spot volume, the scene should be rendered with normal night illumination
outside the spot, then the scene should
be rendered again with day light illumination inside the spot volume.
I don't know if I am very clear...
Harald.
_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d