per object chadow maps.

Started by
4 comments, last by JSoftware 19 years, 7 months ago
Hello. Can some one explain me some details about per-object shadow map rendering? As I understand this technique is being used by Unreal2 engine as well as in the new HL2 engine (play CS:Source beta) where all actors cast shadows on the ground and other static geometry (no self shadowing). As far as I understand this simple technique - first I need to render each object to a buffer texture (models without textures - only black shapes), and then project these newly generated shadow textures on the geometry (terrain or whaterever shadow reciever I need..). Is this correct? If it is - then how is this projection rendering done on a large level geometry? For example if I have a big terrain?? I hope you understand my question?
Gatis
Advertisement
Yep, basically your logic is correct. You render your object to the shadow texture, then you project that texture from the lightsource back onto the level geometry (be it indoor, outdoor, terrain etc. - it doesn't matter). If you are using proper shadow maps, you do a depth comparison to fnd out what is/isn't in shadow. However, if you're just projecting a blakc texture back onto the scene you'll have to be more careful not to project it back onto the object that was the caster, or it will look silly.

Here is a link to an nVidia paper that should help you out.

Hope that helps, ask away if you have any more questions ;)

-Mezz
thanks for answer.
But how do I render these (per object) projections?
My idea was:
0. Render everything without shadows.
1. define a projection frustum for each shadow.
2. For each shadow - find level geometry (and other objects) that fits in that frustum and render that chunk of geometry with shadow texture projected on it.

is it correct??
Gatis
just a small modification to your technique:
1-Render Every thing without shadows with ambient lighting only.
2-(For each light source)
{ define a projection frustum for each shadow;
For each shadow - find level geometry (and other objects) that fits in that frustum.
Render the pixels of each object that are not in shadow using diffuse and specular lighting and add it to the Scene rendered wiht ambient lighting in step 1(additive blending).
}

This can give you better lighting with varying shadow intensty and give a better looking lighting, as the shadowed pixels of each object will have only ambient lighting component instead of rendering a solid black texture over the shadowed pixels.
Also it will save you some pixels that you will not calculate specular and diffuse components for them.This can increase your fill rate.
Yes, that's pretty much correct, as I said, remember that if you aren't using proper depth shadow maps, you will need to make sure you don't project the shadow back onto the caster when you draw them onto the scene!

-Mezz
IIRC unreal 2 used projected shadows. rendering the model in ortho projection to a black-white texture and then projected this texture in the direction of the sunlight

This topic is closed to new replies.

Advertisement