Download presentation
Presentation is loading. Please wait.
1
Efficient Image-Based Methods for Rendering Soft Shadows Maneesh Agrawala Ravi Ramamoorthi Alan Heirich Laurent Moll Pixar Animation Studios Stanford University Compaq Computer Corporation Bo Gao
2
Hard vs. Soft Shadows Hard ShadowsSoft Shadows
3
Area Lights Spot LightArea Lights
4
Cornell Box
5
Code Time //for each light: for (int i=0; i<lightNum; i++){ double ly=lights[i].getPosition().y; double lx=lights[i].getPosition().x; double lz=lights[i].getPosition().z; Vector3d lp=new Vector3d(lx, ly, lz); RT_color lColor=lights[i].getColor(); lColor=lColor.scale(1.0/lightNum); …… } // Light segments; 4 // x0 y0 z0 x1 y1 z1 r g b 400.0 0.0 465.0 450.0 0.0 515.0 1.0 1.0 1.0
6
3 X 3 Lights8 X 8 Lights Regular Light Samples
7
Revised Code // Light segments; 4 // x0 y0 z0 x1 y1 z1 r g b 400.0 0.0 465.0 450.0 0.0 515.0 1.0 1.0 1.0 //for each light: for (int i=0; i<lightNum; i++){ ly=lights[i].getPosition().y; lx=lights[i].getPosition().x+lightdx*Math.ran dom(); lz=lights[i].getPosition().z+lightdz*Math.ran dom(); Vector3d lp=new Vector3d(lx, ly, lz); RT_color lColor=lights[i].getColor(); lColor=lColor.scale(1.0/lightNum); …… } //for each light: for (int i=0; i<lightNum; i++){ ly=lights[i].getPosition().y; lx=lights[i].getPosition().x+lightdx*Math.ran dom(); lz=lights[i].getPosition().z+lightdz*Math.ran dom(); Vector3d lp=new Vector3d(lx, ly, lz); RT_color lColor=lights[i].getColor(); lColor=lColor.scale(1.0/lightNum); …… }
8
3 X 3 Lights8 X 8 Lights Randomly Light Samples
9
Shadow maps The above is the Object-based soft shadows Image-based hard shadows [Williams 78] Time, memory depend on image size, not geometric scene complexity Disadvantage: bias and aliasing artifacts The above is the Object-based soft shadows Image-based hard shadows [Williams 78] Time, memory depend on image size, not geometric scene complexity Disadvantage: bias and aliasing artifacts
10
The Shadow Mapping Algorithm procedure SHADOWMAPPING Render depth buffer (Z-buffer) from lights point of view, resulting in a shadow map or depth map Now, render scene from the eye’s point of view for all rasterized fragments do Determine fragment’s xyz position relative to the light That is transform each fragment’s xyz into the light’s coordinate system A = depth map(x,y) B = z-value of fragment’s xyz light position if A < B then fragment is shadowed else fragment is lit end if end for © 2003-2004 DevMaster.net procedure SHADOWMAPPING Render depth buffer (Z-buffer) from lights point of view, resulting in a shadow map or depth map Now, render scene from the eye’s point of view for all rasterized fragments do Determine fragment’s xyz position relative to the light That is transform each fragment’s xyz into the light’s coordinate system A = depth map(x,y) B = z-value of fragment’s xyz light position if A < B then fragment is shadowed else fragment is lit end if end for © 2003-2004 DevMaster.net
11
Williams’ Shadow Mapping 1 | 2 3 | 1 View from observer 2 View from light 3 Final view
12
ContributionsContributions Extend shadow maps to soft shadows Image-based rendering especially suitable Two novel image-based algorithms: Layered attenuation maps (LAM) Coherence-based raytracing (CBRT) Extend shadow maps to soft shadows Image-based rendering especially suitable Two novel image-based algorithms: Layered attenuation maps (LAM) Coherence-based raytracing (CBRT)
13
LAM Display: 5-10 fps Some aliasing artifacts Interactive applications Games Previewing CBRT Render: 19.83 min Production quality images
14
Refresher: LDIs Layered depth images Geometry Camera
15
Refresher: LDIs Layered depth images LDI
16
Refresher: LDIs Layered depth images LDI (Depth, Color)
17
PrecomputationPrecomputation Render views from points on light (hardware) Create layered attenuation map (software) Warp views into LDI Store (depth, attenuation) Objects in LAM visible in at least 1 view Render views from points on light (hardware) Create layered attenuation map (software) Warp views into LDI Store (depth, attenuation) Objects in LAM visible in at least 1 view
18
PrecomputationPrecomputation 1 st viewpoint
19
PrecomputationPrecomputation 2 nd viewpoint Attenuation = 1/2 Attenuation = 2/2
20
PrecomputationPrecomputation Warped 2 nd viewpoint Attenuation = 1/2 Attenuation = 2/2 Not present
21
DisplayDisplay Render scene without shadows (hardware) Project into LAM (software) Read off attenuation Attenuation modulates shadowless rendering Render scene without shadows (hardware) Project into LAM (software) Read off attenuation Attenuation modulates shadowless rendering
22
DisplayDisplay LAM (center of light) Eye
23
DisplayDisplay LAM (center of light) Eye Attenuation = 2/2 Color = Color * 2/2
24
DisplayDisplay LAM (center of light) Eye
25
DisplayDisplay LAM (center of light) Eye Not in LAM Attenuation = 0 Color = Color * 0
26
LAM size: 512 x 512 Precomp: 7.7 sec (64 views) 29.4 sec (256 views) Display: 5-10 fps
27
LAM size: 512 x 512 Precomp: 6.0 sec (64 views) 22.4 sec (256 views) Display: 5-10 fps
28
Layered attenuation maps – fast, aliases Coherence-based raytracing – slow, noise Layered attenuation maps – fast, aliases Coherence-based raytracing – slow, noise LAMCBRT
29
Coherence-based raytracing Hierarchical raytracing through depth images Time, memory decoupled from geometric scene complexity Coherence-based sampling Light source visibility changes slowly Reduce number shadow rays traced Also usable with geometric raytracer Hierarchical raytracing through depth images Time, memory decoupled from geometric scene complexity Coherence-based sampling Light source visibility changes slowly Reduce number shadow rays traced Also usable with geometric raytracer
30
Light Image-based raytracing 1 st shadow map
31
Light Image-based raytracing 2 nd shadow map 1 st shadow map
32
Trace shadow ray through shadow maps Light Image-based raytracing 2 nd shadow map 1 st shadow map
33
Light source visibility image Light Visibility image s1s1
34
Light source visibility image s1s1 s2s2 Vis image for s 1 Light Visibility image
35
Coherence-based sampling Compute visibility image at first point s 1 Loop over following surface points s i Predict visibility image at s i from s i-1 Trace rays where prediction confidence low Compute visibility image at first point s 1 Loop over following surface points s i Predict visibility image at s i from s i-1 Trace rays where prediction confidence low
36
Predicting visibility Blocker pts s1s1 s1s1 s2s2 Prediction
37
Predicting visibility Blocker pts s1s1 s1s1 s2s2 Prediction
38
Low confidence Light source edges Blocked/unblocked edges Prediction confidence Predicted visibility Trace rays in all X’ed cells High confidence:5 Low confidence:31 Total cells:36 Ratio:5/36 = 0.14
39
Low confidence Light source edges Blocked/unblocked edges Prediction confidence Predicted visibility Trace rays in all X’ed cells High confidence:56 Low confidence:88 Total cells:144 Ratio:56/144 = 0.40
40
Propagating low confidence If traced ray = prediction trace neighbor cells Prediction correct
41
Propagating low confidence If traced ray = prediction trace neighbor cells Prediction incorrect
42
Light cells: 16 x 16 (256) Four 1024 x 1024 maps Precomp: 2.33 min Render:19.83 min Rays:79.86 Speedup:12.96x 2.27x due to image-based raytracing accelerations 5.71x due to coherence-based sampling
43
Light cells: 16 x 16 (256) Four 1024 x 1024 maps Precomp: 3.93 min Render:65.13 min Rays:88.74 Speedup:8.52x 2.16x due to image-based raytracing accelerations 3.94x due to coherence-based sampling
44
LAMCBRT
45
Render from light Ray tracing from lightShadow depth
46
Simulating Z-buffer Vector3d lp=lights[l].getPosition(); P.setLocation(i, j); Vector3d rdir=new Vector3d(P.getX()-lp.x,P.getY()-lp.y, 0.0-lp.z); RT_ray sRay=new RT_ray(lights[l].getPosition(), rdir); intersects=computeIntersection(sRay, objects); double ft=Define.maxt; Vector3d intersectionP=new Vector3d(); Enumeration anenum=intersects.elements(); //computer smallest t; while(anenum.hasMoreElements()){ Intersection sis=(Intersection)anenum.nextElement(); if (ft>sis.getT()){ ft=sis.getT();// smallest t; closestObject=sis.getObject();// closest intersected sphere; intersectionP=sis.getPoint();// intersection point; }} if(intersects.size()>0) zBuffer[l][i][j]=intersectionP.z; else zBuffer[l][i][j]=0.0; Vector3d lp=lights[l].getPosition(); P.setLocation(i, j); Vector3d rdir=new Vector3d(P.getX()-lp.x,P.getY()-lp.y, 0.0-lp.z); RT_ray sRay=new RT_ray(lights[l].getPosition(), rdir); intersects=computeIntersection(sRay, objects); double ft=Define.maxt; Vector3d intersectionP=new Vector3d(); Enumeration anenum=intersects.elements(); //computer smallest t; while(anenum.hasMoreElements()){ Intersection sis=(Intersection)anenum.nextElement(); if (ft>sis.getT()){ ft=sis.getT();// smallest t; closestObject=sis.getObject();// closest intersected sphere; intersectionP=sis.getPoint();// intersection point; }} if(intersects.size()>0) zBuffer[l][i][j]=intersectionP.z; else zBuffer[l][i][j]=0.0;
47
Shadow Mapping Ray tracing shadowShadow mapping
48
1560 triangles, 16 lights, 800X800 resolution, about 23 mins TeapotTeapot
49
ReferencesReferences [1] L. Williams. Casting curved shadows on curved surfaces. In SIGGRAPH 78 proceedings, pages 270–274, 1978. [2] Shadow mapping From Wikipedia, the free encyclopedia [3] Shadow Mapping: Casting curved shadows on curved surfaces http://www.paulsprojects.net/tutorials/smt/smt.html [4] L. McMillan. An Image–Based Approach to Three–Dimensional Computer Graphics. Phd thesis, Department of Computer Science, University of North Carolina, 1997. [5] Shadow Mapping and Shadow Volumes http://www.devmaster.net/articles/shadow_techniques/ [6] Raytracing: Theory & Implementation Part 5, Soft Shadows http://www.devmaster.net/articles/raytracing_series/part5.php [7] F. C. Crow. Shadow algorithms for computer graphics. In SIGGRAPH 77 proceedings, pages 242–248, 1977. [8] Efficient Image-Based Methods for Rendering Soft Shadowshttp://graphics.stanford.edu/papers/shadows/ [1] L. Williams. Casting curved shadows on curved surfaces. In SIGGRAPH 78 proceedings, pages 270–274, 1978. [2] Shadow mapping From Wikipedia, the free encyclopedia [3] Shadow Mapping: Casting curved shadows on curved surfaces http://www.paulsprojects.net/tutorials/smt/smt.html [4] L. McMillan. An Image–Based Approach to Three–Dimensional Computer Graphics. Phd thesis, Department of Computer Science, University of North Carolina, 1997. [5] Shadow Mapping and Shadow Volumes http://www.devmaster.net/articles/shadow_techniques/ [6] Raytracing: Theory & Implementation Part 5, Soft Shadows http://www.devmaster.net/articles/raytracing_series/part5.php [7] F. C. Crow. Shadow algorithms for computer graphics. In SIGGRAPH 77 proceedings, pages 242–248, 1977. [8] Efficient Image-Based Methods for Rendering Soft Shadowshttp://graphics.stanford.edu/papers/shadows/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.