1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf...
-
Upload
amberly-newman -
Category
Documents
-
view
214 -
download
0
description
Transcript of 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf...
![Page 1: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/1.jpg)
11
Shadow Rendering Shadow Rendering Techniques: Hard and Techniques: Hard and
SoftSoftAuthor: Jamiur RahmanAuthor: Jamiur Rahman
Supervisor: Mushfiqur RoufSupervisor: Mushfiqur RoufDepartment of CSEDepartment of CSE
BRAC UniversityBRAC University
![Page 2: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/2.jpg)
22
ChaptersChapters Shadows: Hard and SoftShadows: Hard and Soft Hard Shadow Rendering TechniquesHard Shadow Rendering Techniques Soft Shadow Rendering TechniquesSoft Shadow Rendering Techniques Recent Works Recent Works
![Page 3: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/3.jpg)
33
ShadowsShadows A point is in shadow if the light got blocked A point is in shadow if the light got blocked
between the light source and point between the light source and point Light Source
Viewer
Point is in shadow
Occluder
Point is lit
![Page 4: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/4.jpg)
44
ShadowsShadows Terminology: Umbra and PenumbraTerminology: Umbra and Penumbra
(area) light source
receiver shadow
occluder
umbra
penumbra• umbra – fully shadowed region• penumbra – partially shadowed region
![Page 5: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/5.jpg)
55
““Hard” and “Soft” Hard” and “Soft” ShadowsShadows
Depends on the type of light sourcesPoint or Directional (“Hard Shadows”, umbra)
Area (“Soft Shadows”, umbra, penumbra), more difficult problem
point directional area
![Page 6: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/6.jpg)
66
““Hard” and “Soft” Hard” and “Soft” ShadowsShadows
Hard shadow Soft shadow – point light source – area light source
![Page 7: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/7.jpg)
77
Hard Shadow Hard Shadow RenderingRendering
Techniques Techniques
![Page 8: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/8.jpg)
88
Planar ShadowsPlanar Shadows The simplest algorithm – shadowing The simplest algorithm – shadowing
occurs when objects cast shadows on occurs when objects cast shadows on planar surfaces (projection shadows)planar surfaces (projection shadows)
shadow
lighty
y=0
shadow
lighty
n.x + d =0
![Page 9: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/9.jpg)
99
Planar ShadowsPlanar Shadows Special case: the shadow receiver is Special case: the shadow receiver is
an axis plane an axis plane Just project all the polygon vertices to Just project all the polygon vertices to
thatthat plane and form shadow polygonsplane and form shadow polygons
shadow
lighty
y=0
v
p
Given: - Light position l- Plane position y = 0- Vertex position v
Calculate: p
![Page 10: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/10.jpg)
1010
Planar ShadowsPlanar Shadows We can use similar triangles to solve We can use similar triangles to solve
pp
shadow
lighty
y=0
v
px
px-lx ly
vx-lx ly-vy=
px = ly vx – lx vy
ly - vy
l
• Same principle applied to different axis planes
![Page 11: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/11.jpg)
1111
Planar ShadowsPlanar Shadows Basic algorithmBasic algorithm
Render scene (full lighting)Render scene (full lighting) For each receiver polygonFor each receiver polygon
Compute projection matrix Compute projection matrix MM Mult with actual transformation Mult with actual transformation
(modelview)(modelview) Render selected (occluder) geometryRender selected (occluder) geometry
Darken/BlackDarken/Black
![Page 12: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/12.jpg)
1212
Shadow VolumesShadow Volumes [Crow77][Crow77] Shadow algorithms for computer Shadow algorithms for computer
graphics graphics Compute regions of shadow in 3DCompute regions of shadow in 3D
Object-space algorithmObject-space algorithm Cast shadows onto arbitrary receiver Cast shadows onto arbitrary receiver
geometrygeometry(polygons)(polygons)
From the School of Leonardo Da Vinci
![Page 13: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/13.jpg)
1313
Shadow VolumesShadow Volumes Extend occluder polygons to form Extend occluder polygons to form
semi-infinite volumessemi-infinite volumes Light source is Light source is center-of-projectioncenter-of-projection Everything behind occluder is in Everything behind occluder is in
shadowshadow Test if point is in at leastTest if point is in at least
one volume !one volume ! Extend to reach outsideExtend to reach outside
of view frustum of view frustum
Light Source
Shadow Region
Occluder
![Page 14: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/14.jpg)
1414
Shadow VolumesShadow Volumes Shadow Volumes illustrated (2D)Shadow Volumes illustrated (2D)
shadowingobject
shadowvolume(infinite extent)
partiallyshadowed object
lightsource
eyeposition surface inside
shadow volume(shadowed)
surface outsideshadow volume(illuminated)
![Page 15: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/15.jpg)
1515
Shadow VolumesShadow Volumes Shadow volume generationShadow volume generation
Trivial wayTrivial way One volume for each polygonOne volume for each polygon
BetterBetter Silhouette-based approachSilhouette-based approach
Goal: one shadow volumeGoal: one shadow volume Selected occluders onlySelected occluders only
![Page 16: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/16.jpg)
1616
Shadow VolumesShadow Volumes Use stencil buffer as counter Use stencil buffer as counter
1. Render scene (ambient color)1. Render scene (ambient color)
2. Render front-facing parts of shadow volumes2. Render front-facing parts of shadow volumes with stencil operation with stencil operation incrementincrement (enter) (enter)
3. Render back-facing parts of shadow volumes3. Render back-facing parts of shadow volumes with stencil operation with stencil operation decrementdecrement (exit) (exit)
4. Render scene (fully lit) 4. Render scene (fully lit) with stencil test with stencil test equal zeroequal zero
![Page 17: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/17.jpg)
1717
Shadow MapsShadow Maps• [Williams78][Williams78]
Casting curved shadows on curved Casting curved shadows on curved surfacessurfaces Image-space algorithmImage-space algorithm Well suited for hardware Well suited for hardware
implementationimplementation
Real-Time Luxo Jr. …uses three dynamic shadow maps (OpenGL, GeForce3)
![Page 18: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/18.jpg)
1818
Shadow MapShadow Map Basic idea: objects that are not Basic idea: objects that are not
visible to the light are in shadow visible to the light are in shadow How to determine whether an object How to determine whether an object
are visible to the eye? are visible to the eye? Use z-buffer algorithm, but now the Use z-buffer algorithm, but now the
“eye” is light, i.e., the scene is rendered “eye” is light, i.e., the scene is rendered from light’s point of viewfrom light’s point of view
This particular z-buffer for the eye is This particular z-buffer for the eye is called called shadow mapshadow map
![Page 19: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/19.jpg)
1919
Shadow MapsShadow Maps Basic AlgorithmBasic Algorithm
Render scene as seen from light Render scene as seen from light sourcesource
Save back depth buffer (2D shadow Save back depth buffer (2D shadow map)map)
Render scene from viewer’s positionRender scene from viewer’s position Transform pixel coordinates to light Transform pixel coordinates to light
source spacesource space Compare z with z value stored in shadow Compare z with z value stored in shadow
mapmap Pixel is in shadow if z(light) < z(viewer) Pixel is in shadow if z(light) < z(viewer)
![Page 20: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/20.jpg)
2020
Shadow MapsShadow Maps
Shadow map
Final scene
![Page 21: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/21.jpg)
2121
1st Pass
View from light Depth Buffer (shadow map)
![Page 22: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/22.jpg)
2222
2nd Pass
Visible surface depth
![Page 23: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/23.jpg)
2323
2nd Pass
Non-green in shadow Final Image
![Page 24: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/24.jpg)
2424
Soft Shadow TechniquesSoft Shadow Techniques
Sampling the Light SourceSampling the Light Source Soft Shadow Maps Soft Shadow Maps [Heidrich00][Heidrich00]
![Page 25: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/25.jpg)
2525
Sampling the Light SourceSampling the Light Source Use arbitrary hard shadow Use arbitrary hard shadow
algorithmalgorithm Select point sample on area light Select point sample on area light
sourcesource Render hard shadowsRender hard shadows Sum up weighted result Sum up weighted result
(e.g. accumulation buffer)(e.g. accumulation buffer)
![Page 26: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/26.jpg)
2626
Sampling the Light SourceSampling the Light Source Ground plane shadow textureGround plane shadow texture
1. Initialize FB (white)1. Initialize FB (white)
2. For each sample point do2. For each sample point do
2a. Render scene2a. Render scene
2b. Subtract 1/N from FB2b. Subtract 1/N from FB only once for each only once for each pixel (stencil) ! pixel (stencil) !
Image from ATI Developer’s Site
![Page 27: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/27.jpg)
2727
Sampling the Light SourceSampling the Light Source
Image from ATI Developer’s Site
ResultResult
![Page 28: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/28.jpg)
2828
Soft Shadow MapsSoft Shadow Maps [Heidrich00] [Heidrich00] Soft shadow maps for linear Soft shadow maps for linear
lights lights
![Page 29: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/29.jpg)
2929
Soft Shadow MapsSoft Shadow Maps[Heidrich00] [Heidrich00] Soft penumbra regions for linear light Soft penumbra regions for linear light
sourcessources Based on “traditional” shadow map Based on “traditional” shadow map
algorithmalgorithm Suitable for hardware and software Suitable for hardware and software
renderingrendering Very small number of light source Very small number of light source
samplessamples Soft shadows at real-time / interactive Soft shadows at real-time / interactive
frame ratesframe rates
![Page 30: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/30.jpg)
3030
Soft Shadow MapsSoft Shadow Maps Visibility of light sourceVisibility of light source
100% to 0% for [p1,p2]100% to 0% for [p1,p2] 0% for [p2,q2]0% for [p2,q2] 0% to 100% for [q2,q1]0% to 100% for [q2,q1]
IdeaIdea NormalNormal shadow maps for shadow maps for
umbra and completely litumbra and completely litregionsregions
Linear interpolation of Linear interpolation of visibility for penumbra visibility for penumbra regionsregions
![Page 31: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/31.jpg)
3131
Soft Shadow MapsSoft Shadow Maps Linear interpolation of visibilityLinear interpolation of visibility
Rational function:Rational function:
Approximation:Approximation:
valid because large valid because large penumbra regions whenpenumbra regions when
ReceiverReceiver
Light SourceLight Source
OccluderOccluder
tmxy 11
snxy 22
smxnxtxx
22
21
21 xstx
mn
![Page 32: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/32.jpg)
3232
Soft Shadow MapsSoft Shadow Maps Visibility map:Visibility map:
Additional shadow map channel Additional shadow map channel (percentage visibility)(percentage visibility)
Two-channel shadow map for each sample Two-channel shadow map for each sample point point
![Page 33: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/33.jpg)
3333
Soft Shadow MapsSoft Shadow Maps Generating the visibility mapGenerating the visibility map
Triangulate depth discontinuities (shadow Triangulate depth discontinuities (shadow map)map)
Warp resulting skin polygons to other viewWarp resulting skin polygons to other view
![Page 34: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/34.jpg)
3434
Soft Shadow MapsSoft Shadow Maps Generating the visibility mapGenerating the visibility map
Render skin polygons to visibility mapRender skin polygons to visibility map Gouraud-shading (linear interpolation)Gouraud-shading (linear interpolation)
““White” for vertices on receiverWhite” for vertices on receiver ““Black” for vertices on occluderBlack” for vertices on occluder
Completely lit regionsCompletely lit regions Default visibility 0.5Default visibility 0.5
Completely shadowed regionsCompletely shadowed regions First shadow map channel First shadow map channel
![Page 35: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/35.jpg)
3535
Soft Shadow MapsSoft Shadow Maps
![Page 36: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/36.jpg)
3636
Soft Shadow MapsSoft Shadow Maps
![Page 37: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/37.jpg)
3737
Recent WorksRecent Works
![Page 38: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/38.jpg)
3838
Real-Time Hair Simulation and Real-Time Hair Simulation and Visualisation for GamesVisualisation for Games
Lund University Graphics Group (LUGG) in cooperation with Digital Illusions CE AB, Stockholm (An EA Company)
With self shadow Without self shadow
“Deep Shadow Maps” by Tom
Lokovic Eric Veach, Pixar Animation Studios
![Page 39: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/39.jpg)
3939
AcknowledgmentsAcknowledgments “Shadow Techniques for Interactive and Real-
Time Applications” By Stefan Brabec ,MPI, Germany (PhD thesis)
“Alias-Free Shadow Maps” By Timo Aila and Samuli Laine, Helsinki University of Technology/TML and Hybrid Graphics Ltd., Finland
“Shadow Mapping and Shadow Volumes: Recent Developments in Real-Time Shadow Rendering”
By University of British Columbia, Canada “Deep Shadow Maps” Tom Lokovic and Eric
Veach, Pixar Animation Studios Lund University Graphics Group (LUGG), Sweden
![Page 40: 1 Shadow Rendering Techniques: Hard and Soft Author: Jamiur Rahman Supervisor: Mushfiqur Rouf Department of CSE BRAC University.](https://reader035.fdocuments.us/reader035/viewer/2022062600/5a4d1b7f7f8b9ab0599ba5e4/html5/thumbnails/40.jpg)
4040
Thank you !Thank you !