gam532 dps932 – week 7
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 PresentationTRANSCRIPT
![Page 1: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/1.jpg)
GAM532DPS932 – Week 7Introduction to shadows
![Page 2: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/2.jpg)
Shadow Effects
Light Light
Surface
Surface
No Shadows Shadows
![Page 3: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/3.jpg)
Types of Shadow Techniques
Baked Lighting Blob Shadows Shadows Volumes Depth Map Shadows
Performant
Immersive
![Page 4: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/4.jpg)
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
![Page 5: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/5.jpg)
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
![Page 6: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/6.jpg)
Shadows Volumes
Extrude Shadow Volume
Render Scene Depth Render Volume Stencil
Shadowed Scene
![Page 7: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/7.jpg)
Extruding Shadow Volumes
Shadowed Scene
Light
Actor
Shadow Volumes
![Page 8: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/8.jpg)
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
![Page 9: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/9.jpg)
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
![Page 10: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/10.jpg)
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
![Page 11: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/11.jpg)
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
![Page 12: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/12.jpg)
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
![Page 13: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/13.jpg)
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)
![Page 14: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/14.jpg)
Some Advanced Stuff
Texture resolution can cause aliasing
Sampling adjacent texels and blending can soften shadows
Sampling many adjacent texels and
applying noise algorith
![Page 15: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/15.jpg)
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]
![Page 16: GAM532 DPS932 – Week 7](https://reader035.vdocuments.site/reader035/viewer/2022062501/568164da550346895dd72850/html5/thumbnails/16.jpg)
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)