Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shadow Volumes Revisited Stefan Roettger Alexander Irion Thomas Ertl University of Stuttgart, VIS Group.

Similar presentations


Presentation on theme: "Shadow Volumes Revisited Stefan Roettger Alexander Irion Thomas Ertl University of Stuttgart, VIS Group."— Presentation transcript:

1 Shadow Volumes Revisited Stefan Roettger Alexander Irion Thomas Ertl University of Stuttgart, VIS Group

2 Outline of the Talk 1. Motivation: Shadow volumes on PS2 2. Shadow volumes by Crow (1977) 3. Methods w/o stencil buffer 4. Demonstration movie 5. Conclusion

3 Motivation Shadow volumes: + Dynamic shadows in real-time + Dynamic shadows in real-time + Utilization of graphics hardware (stencil buffer) + Utilization of graphics hardware (stencil buffer)Problem: - Restricted to graphics accelerators of latest generation (no stencil buffer on Voodoo3 and PS2 for example) - Restricted to graphics accelerators of latest generation (no stencil buffer on Voodoo3 and PS2 for example) Solution: Utilization of the screen buffer Result: Shadow volumes supported by Voodoo1!

4 Shadow Volumes [Crow 77] Step 1: Render scene  Z-values

5 Shadow Volumes [Crow 77] Front face: +1 Step 2: Render shadow volume faces Back face: -1

6 Shadow Volumes [Crow 77] Front face: ±0 (Depth test) Back face:±0 (Depth test)  =±0

7 Shadow Volumes [Crow 77] Front face: +1 Back face:±0 (Depth test)  =+1 ±0

8 Shadow Volumes [Crow 77] Front face: +1 Back face:-1  =±0 ±0 +1

9 Shadow Volumes [Crow 77] ±0 +1 ±0 Step 3: Apply shadow mask to scene

10 Methods w/o Stencil Buffer Idea: Compute shadow mask in screen buffer Problem:dstColor := dstColor - 1 not available Solution:Instead +1 :*2 (double values) Instead -1 :/2 (halve values) Blend functions for *2, /2: c dst := f*c src + g*c dst c dst := f*c src + g*c dst *2: f=c dst, c src =1, g=1  c dst := c dst *1 + 1*c dst *2: f=c dst, c src =1, g=1  c dst := c dst *1 + 1*c dst /2: f=0, g=0.5  c dst := 0 + c dst *0.5 /2: f=0, g=0.5  c dst := 0 + c dst *0.5

11 Pixel States  Initialize all pixels with color value 1/4  Initialize all pixels with color value 1/4 1/41/21 *2 /2 *2 /2 *2 (Clamping!) State changes: Point in shadow volume:*2 Point in shadow volume:*2 Point in front of shadow volume:no change Point in front of shadow volume:no change Point behind shadow solume:*2, /2 Point behind shadow solume:*2, /2  Clamping does not invalidate states!  Clamping does not invalidate states! States: 1/4 = lit, 1/2 & 1 = shadowed

12 Shadow Mask Normalization Apply the following operations to the shadow mask: 1/41/21 *2 1/2 1/2 1 1 0 0 *2 LightShadow Invert(c:=1-c)

13 Shadow Mask Application Black shadows: Multiply b/w shadow mask with scene: render the scene with c dst := c dst * c srcBlack shadows: Multiply b/w shadow mask with scene: render the scene with c dst := c dst * c src Ambient shadows: Render scene again to add ambient lighting term with c dst := c dst + c srcAmbient shadows: Render scene again to add ambient lighting term with c dst := c dst + c src QuickNDirty shadows: Halve intensity of shadowed pixels by means of normalization to 0.5/1 and with c dst := c dst * c srcQuickNDirty shadows: Halve intensity of shadowed pixels by means of normalization to 0.5/1 and with c dst := c dst * c src

14 Example: Shadow Mask

15 Example: Normalization

16 Example: Shadowed Scene

17 Extensions to the Algorithm The shadow mask can also be computed in the alpha-channel which performs even faster than the original algorithm. The shadow mask can also be computed in the alpha-channel which performs even faster than the original algorithm. Then the shadow mask can be copied efficiently into an alpha texture map and applied afterwards. Then the shadow mask can be copied efficiently into an alpha texture map and applied afterwards. Advantages: Advantages: –Scene is rendered only once for quickndirty shadows. –Computation of shadow mask with lower resolution than screen buffer  shadow mask is rasterized much faster.

18 Demonstration Movie

19 Conclusion Efficient computation of dynamic shadows possible without stencil buffer.Efficient computation of dynamic shadows possible without stencil buffer. Shadow mask is computed either in screen buffer (Voodoo1/2/3) or in alpha-channel (PS2).Shadow mask is computed either in screen buffer (Voodoo1/2/3) or in alpha-channel (PS2). Idea: Utilize *2, /2 operations instead of +1, -1.Idea: Utilize *2, /2 operations instead of +1, -1. Different modes of application: Black, ambient, or quickndirty shadows (scene rendered only once in the latter case).Different modes of application: Black, ambient, or quickndirty shadows (scene rendered only once in the latter case). By copying the shadow mask into a alpha- texture the shadow mask can be computed at lower resoutions than the screen buffer  overcome rasterization bottleneck.By copying the shadow mask into a alpha- texture the shadow mask can be computed at lower resoutions than the screen buffer  overcome rasterization bottleneck.

20 Thank you! Questions? Questions?


Download ppt "Shadow Volumes Revisited Stefan Roettger Alexander Irion Thomas Ertl University of Stuttgart, VIS Group."

Similar presentations


Ads by Google