View Full Version : Hope this is the Last prob with Shadow volumes...

12-05-2004, 04:23 AM
Hello people!
I have a problem with some math when rendering shadow volumes.
First I calculate the silhuette edges and the I render the shadow volume like


The problem is that the shadow direction is always the same for every object (the

objects is not at the same position). Take a look at this screen:

any idea what is going on?
Thanks in advance!

12-05-2004, 07:02 AM
You have to transform the light position into object space before calculating the silhuette and extruding the volume.

Something like this (depends on how you represent object orientation):
LocalLightPos = InverseObjectRotation * (LightPos - ObjectPos)

12-05-2004, 09:39 AM
Originally posted by Sunray:
LocalLightPos = InverseObjectRotation * (LightPos - ObjectPos)That should be

LocalLightPos = (InverseObjectTransform * LightPos) - ObjectPos

Unreal, why does your for loop look that way? It will run slow.
Either render all front faces first, then back faces and use unclamped stencil features or use two sided stencil feature with unclamped stencil.

At least with the later, you only render once.