320 likes | 524 Views
Shadowing. SET09115 Intro Graphics Programming. Breakdown. Basics Occluders and receivers Types of shadows General Techniques Blob shadows Multiple point lights Other Techniques Using textures Volumetric shadowing. Recommended Reading. Real-Time Rendering
E N D
Shadowing SET09115 Intro Graphics Programming
Breakdown • Basics • Occluders and receivers • Types of shadows • General Techniques • Blob shadows • Multiple point lights • Other Techniques • Using textures • Volumetric shadowing
Recommended Reading • Real-Time Rendering • Chapter 9 is about global illumination • Section 9.1 about shadowing • Section 9.2 about ambient occlusion • Not covering in lecture
Why do we mean by Shadowing? • Shadowing is when we add to a rendered scene darkened areas to imply the occlusion of light • Something in the scene is blocking the current lighting model from fully illuminating a particular area • Shadowing is essentially the removal of light from a scene • Actually, shadowing in rendering is the adding of dark area to a normally rendered lit scene
Why do we want Shadowing? • Shadowing adds realism to a rendered scene • Up until now, we have used lighting and texturing to add realism • Any 3D scene without shadowing looks wrong, artificial • Goal of any 3D rendering is to look correct, real even if cheating • Shadowing can also be a gameplay feature
Example • Splinter Cell • http://www.youtube.com/watch?v=gaRN5Dr_jBI • Thief • http://www.youtube.com/watch?v=AP8EyFmWg44
Occluders and Receivers • A shadow is created when a light source is occluded on a surface • There are three parts to consider • The light source • The occluder • The receiver
Types of Shadows • There are two types of shadows that can form part of a scene • Hard Shadows • Soft Shadows • Our task is to add the correct type of shadowing, and in a realistic manner • This can be complicated
Hard Shadows • Hard shadows are those caused by point lights • Have definite outlines • Have a single uniform colour • Quite easy to work out in relation to soft shadows
Soft Shadows • Soft shadows are caused by other lighting mechanisms • Area lights • Light volumes • Soft shadows have a blurring effect at the edges • Difficult to get right • And expensive
Umbra and Penumbra • A soft shadow is made of two parts • Umbra • Penumbra • The hard shadow is not the umbra • Light changes based on size of light
Shadow Blobs • The simplest technique for shadowing is to project a blob onto the ground plane • Size of blob changes based on distance • Eye is quite forgiving, and will accept this as a reasonable shadow
Example • Super Mario 64 • http://www.youtube.com/watch?v=DTzs9bcNgMQ
Planar Shadows • A better technique is to do a two stage render • Shadow pass renders a projection onto a plane • Shadow is rendered onto the ground plane
Example • Oblivion • http://www.youtube.com/watch?v=OBbW86Hl7wI
Light Viewer • Another technique is to perform a render pass using the light’s position as the render position • Generate the depth map from this render pass • Use this depth map to determine what parts of the scene are to be shadowed • This provides a similar approach to standard projection lighting
Multiple Point Lights • Another common technique • Soft shadows can be created by using multiple point lights in a scene • Each point light creates a shadow • Shadows are accumulated and then used in the final render
Using Textures • We can do some pre-processing and work out light maps for a scene • Pre-process as in before running the application • Much faster than using real-time, dynamic shadows
Using Textures • When performing a render, we can generate the shadow map during the shadowing stage • For fixed scenes, these shadow maps can be reused • Pre-process
Stencil Buffer • Buffer commonly used for shadowing techniques • Stencil buffer is another per-pixel buffer, similar to the depth buffer • The information contained in the stencil buffer can be set for various uses • Number of failed pixel writes due to occlusion • Simplest use of the stencil buffer is to determine which areas cannot be rendered to during a render pass • For example shadowed regions
Volumetric Shadows • Volumetric shadows are one of the techniques used by the stencil buffer • The stencil buffer can be incremented based on depth information when renders are performed
Good Shadowing • http://www.youtube.com/watch?v=PjqsYzBrP-M
To do this week… • I’m not going to produce a practical for this week or next • Concentrate on the coursework • I will put the practicals together and post on WebCT over the next few weeks • So you can see what to do • I’ve added some new geometry code to WebCT • Drawing spheres and torus’ for lighting and texturing
Summary • Shadowing is another technique for adding realism • And another technique where we cheat to gain realism • We have only really scratched the surface with techniques here • Read Real-Time Rendering if you are interested • Maths is in there as well • We aren’t looking at shadowing as part of the assessment • We will be impressed if you add it though