140 likes | 330 Views
Shadow. No, not the Hank Marvin kind!. Go to:. http://developer.nvidia.com/object/doc_shadows.html Particularly, read the paper “shadow considerations” from 2004. Shadow solutions: 5 Categories. Pre computed (texture based) Volume based Depth based Hybrid Raytrace. Pre computed shadows.
E N D
Shadow No, not the Hank Marvin kind!
Go to: • http://developer.nvidia.com/object/doc_shadows.html • Particularly, read the paper “shadow considerations” from 2004
Shadow solutions: 5 Categories • Pre computed (texture based) • Volume based • Depth based • Hybrid • Raytrace
Pre computed shadows • Lightmaps • Use textures to store lighting information • “Bake” textures using an offline process • Modulate the base texture with the lighting texture to get the final result • Used in many games since Quake made the technique popular
Pre computed shadows • The “baking” process can be computationally heavy (using global illumination, radiosity) • Have a look at “Turtle” http://www.illuminatelabs.com/ • They used an SGI machine for Quake • Textures take up memory (console issue) • Quality of lighting can be very nice because all computation is done “offline” • Interesting factoid: Halo3 uses banks of XBOX360’s to compute the lighting
Volume based shadows • Uses a buffer called a “stencil buffer” • Often called stencil shadows • What we need to know, is whether a surface is being shadowed by another surface • This involves a test to determine whether the surface in question is occluded by the volume of the blocker surface • We can do this by determining the volume of the space behind the blocker (with respect to the light source)
Volume based shadows • First implementation seems to be “Severance blade of darkness” • Actually, there was one called “into the shadows” by scavenger, but the company folded • Carmack popularised them • Read Mark Kilgards slides on the zpass/zfail issues • There are new techniques working with them (see nvidia site)
Depth based shadows • Use some kind of buffer to store a depth per light • This depth is the closest surface the light can “see” • Its basically a depth buffer (like the z buffer we use for surface sorting) • If the distance from the light to the surface > than the closest depth in the depth buffer, then the object is in shadow (i.e. Something is in front of it when looking towards the light) • This all happens when rendering the object, basically it is a texture lookup • BUT, its not without limitations (primarily sampling) • http://developer.nvidia.com/object/hwshadowmap_paper.html • http://developer.nvidia.com/object/cedec_shadowmap.html
Depth based shadows • Good for complex geometry (because we are rendering with hardware, which is fast) • Can be complex to handle the sampling issues properly in a scene
Hybrid shadows • Take the better parts of precomputed, volume and image based shadows • Use the appropriate method for the type of scene and shadowing requirements • Can be complicated to get into an engine/shader • Ideally, we’d prefer to have a single solution that just works!
Raytracing • Physically correct • Handles complex light interactions with a scene, for instance sub-surface scattering, reflection and refraction • Computationally expensive • But seems we are getting more horsepower all the time! • http://developer.nvidia.com/docs/IO/8230/GDC2003_Gaffer2GameEngine.pdf • Consider that new hardware is going to offer more in this area
Side issue: Deferred rendering • See Hargreaves GDC presentation (2004) • http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter09.html • I’ve seen interviews with videocard vendors that state that deferred shading is going to be used a lot more in the future. • Crytek uses it for Cryengine • http://ati.amd.com/developer/siggraph06/Wenzel-Real-time_Atmospheric_Effects_in_Games.pdf
Different types of shadow map • PSSM (Parallel split) • CSM (Cascaded) • Have a look at a few others too!