Upload
abeni
View
162
Download
0
Tags:
Embed Size (px)
DESCRIPTION
GAM532 DPS932 – Week 7. Introduction to shadows. Shadow Effects. No Shadows. Shadows. Surface. Surface. Light. Light. Types of Shadow Techniques. Baked Lighting. Blob Shadows. Shadows Volumes. Depth Map Shadows. Performant. Immersive. Baked Lighting and Static Lights. - PowerPoint PPT Presentation
Citation preview
GAM532DPS932 – Week 7Introduction to shadows
Shadow Effects
Light Light
Surface
Surface
No Shadows Shadows
Types of Shadow Techniques
Baked Lighting Blob Shadows Shadows Volumes Depth Map Shadows
Performant
Immersive
Baked Lighting and Static Lights
Lights and actors cannot move
Static lights are not part of the scene
Computations happen during development
Almost costless
Cannot change at runtime
Can be very high detail
Blob Shadows
Scene without shadow
Scene with blob applied to underlying
geometry
Static Shadow Texture
Light Dir:[ 0, -1, 0 ]
Light Dir:[ 0.7, -0.7, 0 ]
Shadows can move with the sceneLow performance cost
Shadows cannot change at runtimeLow detail approximations
Only works well with single simple light
Shadows Volumes
Extrude Shadow Volume
Render Scene Depth Render Volume Stencil
Shadowed Scene
Extruding Shadow Volumes
Shadowed Scene
Light
Actor
Shadow Volumes
Rendering Depth and Stencil
Render Depth Render Volume Stencil
AFront Face: Fail (-
1)Back Face: Fail
(+1)Stencil = 0B
Front Face: Pass (0)
Back Face: Fail (+1)
Stencil = 1CFront Face: Pass
(0)Back Face: Pass (0)
Stencil = 0
Final Result
Additive
Blocks the light for each light pass
Modulative
Darkens the geometry after lighting pass
CPU Intensive
Modulative darkens scene with multiple lights
Self Shadowing
Dynamically changing Shadow
Detail limited by mesh detail
High Detail (model limited)
Very expensive with high polygon meshs
Depth Texture Shadows
Render scene depth from each light
Render Scene from main camera for
each light
Compare depth from light’s depth target to each
fragment
Render from Shadow Camera
Render scene depth from each light
Bind each shadow camera to a depth target (no color
needed)
struct Light { float3 position; float4 diffuse; float4 specular; float3 attenuation; float3 spot;};
Texture2D shadowTex : register(t0);SamplerState shadowSamp : register(s0);
Bind each depth target to a slot in the
shader
Render from Main Camera
Render scene from the main camera
Project the fragment position into the light’s space, using modified x,y
for uv texcoords
Compare depth stored in texture vs
projected distance from the light
Final Result
Translucency effects easily added
Expensive (re-render scene for each light)
Self Shadowing
Dynamically changing Shadow
Detail limited by texture size
High Detail (texture limited)
Point lights are very expensive to cast shadows from (6 renders per light)
Some Advanced Stuff
Texture resolution can cause aliasing
Sampling adjacent texels and blending can soften shadows
Sampling many adjacent texels and
applying noise algorith
When to Use Each Technique
Baked Lighting Blob Shadows Shadows Volumes Depth Map Shadows
Areas where lighting and geometry won’t
change[ceiling of a tall building]
Objects that are too far away to need detail, but close enough
to need shadows[distant trees,
buildings]
When you need to cast from point lights or when depth maps are too expensive
[Small light points, candles]
Areas that need high quality
shadows from directional or spot lights[light from a
window]
To Do• Begin work on your enhancement• Begin work on OpenGL labs• Update wiki with all team related information• Prepare for Mid-term (read study guide)