Shadows (07) RNDr. Martin Madaras, PhD. martin.madaras@stuba.sk - - PowerPoint PPT Presentation

shadows 07
SMART_READER_LITE
LIVE PREVIEW

Shadows (07) RNDr. Martin Madaras, PhD. martin.madaras@stuba.sk - - PowerPoint PPT Presentation

Principles of Computer Graphics and Image Processing Shadows (07) RNDr. Martin Madaras, PhD. martin.madaras@stuba.sk Why shadows? 2 Shadows in global methods ray-tracing radiosity 3 Lights and shadows Two basic approaches Hard


slide-1
SLIDE 1

Principles of Computer Graphics and Image Processing

Shadows (07)

  • RNDr. Martin Madaras, PhD.

martin.madaras@stuba.sk

slide-2
SLIDE 2

2

Why shadows?

slide-3
SLIDE 3

3

ray-tracing radiosity

Shadows in global methods

slide-4
SLIDE 4

4

 Two basic approaches

 Hard shadows – only point light sources  Soft shadows – area light sources

Lights and shadows

slide-5
SLIDE 5

5

  • Ask questions, please!!!
  • Be communicative
  • www.slido.com #PPGSO07
  • More active you are, the better for you!

How the lectures should look like #1

slide-6
SLIDE 6

6

 Point light source

 A point is in a shadow if it is not visible from the light source

Hard shadow

slide-7
SLIDE 7

7

 Three types of surface:

 Shadow: light source completely hidden  Penumbra: light source partially hidden  Lit: light source completely visible

Soft shadow

slide-8
SLIDE 8

8

Shadows / visibility

A point is lit if it is visible from the light source Computing shadows = visible surface determination

slide-9
SLIDE 9

 Draw the graphics primitives again, projected on the

ground

 Fast, easy to code  No self shadows, no shadows on curved surfaces and no

shadows on other objects

9

Flat shadows

slide-10
SLIDE 10

10

Shadow volumes geometry space Shadow maps screen space

Shadows in rasterization

slide-11
SLIDE 11

11

Shadow mapping

slide-12
SLIDE 12

12

 z-buffer analogy  look from the light  “render” the scene

and store depth information in a shadow map

 2D raster data  smallest distance between light and objects

Shadow maps

slide-13
SLIDE 13

13

 For a polygon pixel

to be rendered

 Find its position in

the light’s projection plane → (x,y,z)

 If z > shadow map [x,y] then shadow

Shadow maps

slide-14
SLIDE 14

14

 memory consumption

 1 light = 1 shadow map  high resolution necessary

 aliasing

 use high resolution  filtering necessary

 smooth (soft) shadows

 when filtered

 imprecise due to z-buffer quantization (non-linear)  light-specific transformation

Shadow maps pros & cons

slide-15
SLIDE 15

15

Shadow mapping example

http://www.nealen.net/projects/ibr/shadows.pdf

from light depth buffer from light’s point of view from camera final image

slide-16
SLIDE 16

16

 How many points

are stored in the 2D shadow map

 Low counts =

shadow artifacts

Shadow map resolution

Stamminger, Drettakis: Perspective Shadow Maps

slide-17
SLIDE 17

17

 Removes artifacts (jagged edges)  Simulates soft shadows

Filtering and soft shadows

Soft-Edged Shadows, http://www.gamedev.net

slide-18
SLIDE 18

18

Shadow volumes

slide-19
SLIDE 19

19

 create dummy geometry object extending each object in

the direction of the light

 shadow volume

 when displaying an object to a pixel (x,y,z), test if (x,y,z) is

inside/outside the shadow volume

Shadow volumes

slide-20
SLIDE 20

20

Shadow volumes

slide-21
SLIDE 21

21

1.

Compute ambient light for whole scene and update z- buffer along with that

2.

Which screen areas are in shadow?

3.

For all areas outside the shadow:

4.

Compute diffuse and specular light components

5.

Iterate for all lights

Pseudo-code

slide-22
SLIDE 22

22

Shadow volumes implementation

slide-23
SLIDE 23

23

Shadow volumes implementation

slide-24
SLIDE 24

24

Shadow volumes implementation

slide-25
SLIDE 25

25

Shadow volumes implementation

slide-26
SLIDE 26

26

 hard shadows

 modifications for soft shadows necessary

 GPU implementation using stencil buffer  high complexity for high-polygon models  what if camera is inside the shadow volume?  shadow volumes expensive on CPU

 now vertex shaders

Shadow volume pros & cons

slide-27
SLIDE 27

27

 Directional (parallel) light

 easy shadow maps and shadow volumes

 Spot light

 shadow map by perspective transformation  easy shadow volume

 Omni-directional light

 shadow map hard  easy shadow volume (same as spotlight)

 Area light

 approximate by multiple lights

Shadows vs. light types

slide-28
SLIDE 28

28

  • Ask questions, please!!!
  • Be communicative
  • www.slido.com #PPGSO07
  • More active you are, the better for you!

How the lectures should look like #2

slide-29
SLIDE 29

29

Summary

Rendering pipeline summary

slide-30
SLIDE 30

30

 Local, world (global), camera coordinates  Transformations (in 2D & 3D)  Matrix operations

 translate, rotate, scale  Projections

(orthogonal, perspective)

 Object representation

 boundary, volume, polygonal

parametric, implicit, F-rep

Rendering pipeline summary

slide-31
SLIDE 31

31

 Line and polygon rasterization  Linear interpolation  Antialiasing  Visible volume  Back-face culling  Painter’s algorithm  Z-Buffer

Rendering pipeline summary

slide-32
SLIDE 32

32

 Texture coordinates, texture mapping  Texture filtering

 Bilinear interpolation  Nearest neighbor

Rendering pipeline summary

slide-33
SLIDE 33

33

 Light types  Lighting models

and illumination techniques

 local, global  empiric, physical

 Shading models

 flat, Gouraud, Phong

 Raytracing, radiosity

Rendering pipeline summary

slide-34
SLIDE 34

34

 Shadow generation

in global illumination

 Shadow generation

in local models

 Stencil shadows

(shadow volume)

 Shadow maps  Soft shadows

Rendering pipeline summary

slide-35
SLIDE 35

35

Animations

Next Week

slide-36
SLIDE 36

36

Acknowledgements

 Thanks to all the people, whose work is shown here and whose

slides were used as a material for creation of these slides:

Matej Novotný, GSVM lectures at FMFI UK Peter Drahoš, PPGSO lectures at FIIT STU

slide-37
SLIDE 37

37

www.slido.com #PPGSO07 martin.madaras@stuba.sk

Questions ?!