37
Real - Time Rendering Lighting / Shading Michal Červeňanský Juraj Starinský

Real - Time Rendering Lighting / Shading

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Real - Time Rendering Lighting / Shading

Real ­ Time Rendering

Lighting / Shading

Michal ČerveňanskýJuraj Starinský

Page 2: Real - Time Rendering Lighting / Shading

10.03.2010 2

Overview Light Sources Lighting Shading Texturing Alpha Mapping Gloss Mapping Light Mapping Rough Surface

Page 3: Real - Time Rendering Lighting / Shading

10.03.2010 3

Light Sources

Directional light Point light Spot light Colour, intensity

Page 4: Real - Time Rendering Lighting / Shading

10.03.2010 4

Lighting model

Phong model Colour, Intensity  Ambient, Diffuse, Specular

++

=

Page 5: Real - Time Rendering Lighting / Shading

10.03.2010 5

Lighting model ­ ambient

Constant colour Light form other surfaces

+

Page 6: Real - Time Rendering Lighting / Shading

10.03.2010 6

Lighting model ­ diffuse

Lambert's law Photons are scattered equally

+

φcos=⋅= lndiffi

diffdiffdiff smlni ⊗⋅= )(

Page 7: Real - Time Rendering Lighting / Shading

10.03.2010 7

Lighting model ­ specular

The highlight simulation

l)n2(nlr ⋅+−=shishi mm

speci )(cos)( ρ=⋅= vr

specspecm

specshi smvri ⊗⋅= ))(,0max(

Page 8: Real - Time Rendering Lighting / Shading

10.03.2010 8

Lighting model (2)

Half vector Speed­up  i = iamb + idiff + ispec

Page 9: Real - Time Rendering Lighting / Shading

10.03.2010 9

Shading

Flat, Gouraud, Phong Per ­ primitive, vertex, fragment

Page 10: Real - Time Rendering Lighting / Shading

10.03.2010 10

Shading (2)

Tessellation is important

Page 11: Real - Time Rendering Lighting / Shading

10.03.2010 11

Texturing Light Sources

Lighting

Shading

Texturing− Texture mapping− Texture settings− Texture filtering

Alpha Mapping

Environment Mapping

Gloss Mapping

...

Page 12: Real - Time Rendering Lighting / Shading

10.03.2010 12

Texture mapping 1D, 2D, 3D, Cube Texture transformations Texture projections (spherical, 

cylindrical, planar, natural)

Page 13: Real - Time Rendering Lighting / Shading

10.03.2010 13

Texture settings

Wrap modes (repeat, mirror, clamp, border) Compression (DXT, S3C, …) Multi­texturing

Page 14: Real - Time Rendering Lighting / Shading

10.03.2010 14

Texture filtering

Nearest Linear – (tri/bi)linear interpolation Bi­cubic – ATI or shaders

Nearest                   Linear                     Catmul­Rom               CubicBSpline

Page 15: Real - Time Rendering Lighting / Shading

10.03.2010 15

Texture filtering (2)

Mipmapping – minification− Down sampled textures to half− Memory requirements 133%− d = log2(sqrt(A))− Trilinear filtering (interpolation)

Page 16: Real - Time Rendering Lighting / Shading

10.03.2010 16

Texture filtering (3)

Anisotropic− < 16 samples− Vertical, horizontal

Page 17: Real - Time Rendering Lighting / Shading

10.03.2010 17

Alpha mapping

Billboards Transp. Textures

− trees,... Animated textures

− fire, ... 

Page 18: Real - Time Rendering Lighting / Shading

10.03.2010 18

Gloss mapping

Material properties in texture Used for specular

Page 19: Real - Time Rendering Lighting / Shading

10.03.2010 19

Light mapping

Diffuse light view independent Precomputed light text.

− Low resolution− Various approaches

Combine with surface Shadows (static) Animated maps

Page 20: Real - Time Rendering Lighting / Shading

10.03.2010 20

Light mapping (2)

Page 21: Real - Time Rendering Lighting / Shading

10.03.2010 21

Rough surfaces ...

Gloss Mapping

Light Mapping

Rough Surface− Bump mapping− Normal mapping− Displacement mapping− Parallax mapping− Relief mapping− Combinations

Ambient Occlusion

Page 22: Real - Time Rendering Lighting / Shading

10.03.2010 22

Bump mapping Rendering of structured surfaces Visual improvement without additional 

geometry Silhuette without change No shadows

Page 23: Real - Time Rendering Lighting / Shading

10.03.2010 23

Bump mapping (2)

Height map − Calculated normal− Central differences− uv space

Perturbing surface normal by height map normal More computation Less memory

Page 24: Real - Time Rendering Lighting / Shading

10.03.2010 24

Normal mapping Replaces surface normals from texture Normals in texture

− Generated from high res. model− High resolution− Compressed [­1,1]   [0,1]→− uv space

Page 25: Real - Time Rendering Lighting / Shading

10.03.2010 25

Displacement mapping

Displacement along surface normal Applied to vertexes

− Adaptive tessellation Costly technique New GPU (DX11)

Tesselator shader Automatic LOD

Page 26: Real - Time Rendering Lighting / Shading

10.03.2010 26

Parallax mapping Approximation of original geometry More apparent depth Trace rays against height fields

           Normal                                Paralax                                   Relief

Page 27: Real - Time Rendering Lighting / Shading

10.03.2010 27

Parallax mapping Calculate offset

s,b (scale, bias) based on material

s=00.1, b=s*(­0.5) hn=h*s­b Tn = T0+(hn*Vxy/Vz)• Vz   0→

Limited offset Tn = T0+(hn*Vxy)

Page 28: Real - Time Rendering Lighting / Shading

10.03.2010 28

Relief mapping More accurate than parallax m. Self­shadowing, self­occlusion, 

silhouettes Based on ray­tracing

− Various speed­up techniques

Page 29: Real - Time Rendering Lighting / Shading

10.03.2010 29

Comparison

Page 30: Real - Time Rendering Lighting / Shading

10.03.2010 30

Comparison

Page 31: Real - Time Rendering Lighting / Shading

10.03.2010 31

Comparison

Page 32: Real - Time Rendering Lighting / Shading

10.03.2010 32

Comparison

Page 33: Real - Time Rendering Lighting / Shading

10.03.2010 33

Comparison

Page 34: Real - Time Rendering Lighting / Shading

10.03.2010 34

Comparison (2)

Page 35: Real - Time Rendering Lighting / Shading

10.03.2010 35

Combinations Steep Parallax Mapping Interval Mapping …

Page 36: Real - Time Rendering Lighting / Shading

10.03.2010 36

References Real­time rendering slides

GeForce 8 and 9 Series GPU Programming

http://en.wikipedia.org/wiki/

http://flickr.com/photos/buou/2126755136/

http://vr.kaist.ac.kr/_r011.htm

http://www.vis.uni­stuttgart.de/eng/teaching/lecture/ws04/seminar_spiele/bsp/

http://www.cg.tuwien.ac.at/courses/Realtime/

http://graphics.cs.ucf.edu/IntervalMapping/

http://graphics.cs.brown.edu/games/SteepParallax/index.html

http://www.inf.ufrgs.br/~oliveira/RTM.html

http://ati.amd.com/developer/SIGGRAPH05/Tatarchuk­ParallaxOcclusionMapping­Sketch­print.pdf

Page 37: Real - Time Rendering Lighting / Shading

10.03.2010 37

Questions ?