mczak said:
Ante P said:
BTW god damn the game looks ugly when using projected shadows :/
Does someone know exactly why though? AFAIK You should be able to have more than one light source and more than one object which casts shadows with projected shadows. Isn't this shadowing technique also used by nwn for instance (without the drawbacks the splinter cell projected shadows have)? Or would the performance hit be too big?
Actually you have scenes with more than one shadow casting light even when running with shadow projection -- sometimes you can have several of those projectors visible at the same time. The following is the shadow projection algorithm used in Splinter Cell :
3 levels projection technique:
-For each shadow projector (shadow casting light) in the scene: (render from the light point of view)
-Render the "Actor" shadow texture, contains every static mesh/object with the tag "cast on static mesh" set to 1 (eg: gates, butterflies)
-Render the "StaticMesh shadow texture, contains every static mesh/object with the tag "cast on static mesh" set to 1 + all dynamic actors (distance check for Sam, not for the other actors)
-Render the "BSP" shadow texture, contains every static mesh/object with the tag "cast on static mesh" and/or "cast on BSP" set to 1 + all dynamic actors (no distance check)
With high resolution shadow textures (512x512), this means 3 of those textures for every shadow casting light. Sometime, there can be several of those projectors visible at the same time. To optimize performance, those shadow textures are stored in a static texture cache if they don't change from frame to frame. This has one serious consequence, it is using a LOT of video memory and this explains why 32 MB adaptors are only able to run the game at 640x480 (800x600 with Patch #2). In fact, it's so much memory that a "Very High" resolution setting with 1024x1024 would require a 256 MB frame buffer. When the light is moving, or something is moving in the scene, it does invalidate the texture cache and everything has to re-rendered again. Generally, that means only the spot Sam is in but if there are soft bodies moving around and are casting shadows, the cost can become pretty high. Several additionnal passes are done on each of those texture:
1) Intensity matching to change the contrast and the brightness of the shadow
2) Shadow blur, based on a large filtering kernel (very expensive (fillrate)), the shadow is blurred in real time. The more blur the artist
wanted, the more expensive it gets (up to a point of course).
Most importantly, in terms of dynamic lighting system, shadow buffer uses EShadowSpotAttenuated light while shadow projection uses, well, projected textures. Shadow buffer uses depth texture creation, rendering from the light POV with Z/stencil only -- for a DX8.1 game like Splinter Cell, depth texture creation is only supported on NV2x/NV3x.