35
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Real-Time Rendering

SPEACIAL EFFECTS

Lecture 03Marina Gavrilova

Page 2: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Brief Outline Image based Rendering Lens Effects Billboarding Particle Effects Reflection Shadow mapping Edge Effects Volumetric rendering

Page 3: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

The Rendering Spectrum Effects can be produced by manipulation of

images or geometry or both

Page 4: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Image Based Rendering Early games used sprites (image object) Move/scale and draw sprite on screen Animated texture animated sprite

Layered Rendering with transparency Assign depth to sprite Render sprites in particular order Use transparency

Talisman architecture renders objects into layers and composite them for several frames

Lumigraph rendering Render using image interpolation

Page 5: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Billboarding Create complex objects using

texture and simple geometry

Used extensively in particle rendering systems

Use faceted quads normal of the quad equals camera direction

Used frequently in games

High performance

Page 6: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Types of billboarding

Screen-aligned billboard Facted quads/sprites Flare/glow/smoke

World aligned billboard Aligned facing camera Has it’s own up vector Scenery/complex objects

Axial Billboard One rotation axis Tree/objects on terrain

Page 7: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Particle system Point based sprites Additive or other

blending Physically based

modeling Realistic volumetric

effect

Page 8: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Lenz Effects

Effects that makes a scene natural

By mimicking physical properties of eye/camera

Page 9: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Lens Flare Glow of light source Halo around the source Streaks and bloom formed around

the source Secondary lens effects (internal

reflection and refraction)

Page 10: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Motion Blur Use accumulation buffer to render

object with interpolated coordinate Requires several rendering passes Realistic effect Slow

Texture based motion blur Other pseudo motion blur techniques

are used in games

Page 11: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Reflection Method 1: Use

Environment mapping

Method 2: Flat mirror Render scene from

mirrors point of view Darken the scene Use that as a texture

Page 12: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Exposure control Method 1: render multiple scene and blend with exposure

parameter

Method 2: Define per texture luminance Render using High Dynamic Range luminance (HDR)

Page 13: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Depth of Field Hold camera target

stationery Vary camera source Render several pass Accumulate scene

Page 14: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow mapping

Without darkness, light cannot exist

Shadow mapping makes a scene significantly more

realistic

Page 15: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Sh

ad

ow

in

a

scen

e

Page 16: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Planar Shadow When occluders cast

shadow on planar objects (i.e. floor)

Fully shadowed region: umbra

Partially shadowed region: Penumbra

Hard shadow Projection algorithm

Soft shadow Shadow mapping

Page 17: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Projection Shadow Project the vertices of an

object on a plane Render the transformed

object with dark color (without lighting)

Assume light source=l, vertex projected=v, projected vertex=p

In matrix form for plane y=0 (p=Mv):

For any arbitrary plane:

Matrix M=

Page 18: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Problems with projective shadow Hard edge Less realistic Rendering on a plane tricky:

Offset from the plane to avoid z buffer overlap Different offset for different view angle

Anti-shadow problem:

Page 19: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Soft Projective Shadow Generate a texture (render

into texture) Render the texture as a

plain Only recompute texture if

light source changes Method 1: Render into

accumulation buffer with varying light source

Use perspective projection on a plane

Light source = a Receiver parallelogram:

one vertex b and edge ex,ey

Advantage: Free from Anti-shadows and false shadows

Page 20: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Soft Projective Shadow Method 2: Use spherical

light source Less expensive

computationally Looks better Problem: Visual artifact

when object touching the plane

Hard

Soft

Page 21: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow on arbitrary object: Shadow Volume Uses the stencil buffer Extend a pyramid from a light source through vertices of a

triangle Shadow Volume: volume under the pyramid Consider a ray from a pixel to an object: if number of

times intersecting front face of shadow volume>0 then vertex is under shadow

Page 22: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow Volume Technique Render the scene with ambient and emission Compute the faces of shadow volume Clear the stencil buffer and set to increment Render the front faces of shadow volumes

into stencil Set Stencil to decrement Render the back faces of shadow volumes

into stencil Render the scene with light only where

stencil=0 Shadow volume is slow for complex

geometry

Page 23: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow Volume

Page 24: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow Mapping Render the z-buffer from the lights point

of view Shadow map = content of this z-buffer Render scene using viewer

If distance between a rendered point and light is greater than projected z value then it is under shadow

Use texture mapping hardware

Page 25: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow Mapping Using Texture

First generate the shadow map Render from viewer using ambient

lighting only Convert shadow map z value to

viewers coordinate system Shadow test: Test z values of point

with z values in the shadow map

Page 26: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow mapping steps…

Shadow mapping for a complex scene

the pointthe pointlight sourcelight source

Page 27: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow mapping steps… Scene from light’s point of view

Page 28: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow mapping steps… Scene from light’s point of view

Page 29: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow mapping steps… Scene from viewer with shadow map (z values)

Page 30: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow mapping steps… Test Shadows: non green areas

are shadows

Page 31: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Shadow mapping steps… Finally the scene can be rendered with the

shadow

Page 32: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Other Rendering Concerns

Edge highlighting: Draw edge in different color (engineering app)

Polygon Edge rendering: Render the filled polygon (all buffer

active) with z buffer replacement=off Render the polygon edges (all active) Render the polygon only to the z

buffer

Page 33: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Other Rendering Concerns

Hidden line rendering: Draw filled polygon to z-buffer and lines only on the color buffer (no hidden lines drawn)

Haloing: front-face lines halo the back faced lines

Height field and volumetric rendering: Use of voxels and 3D textures

Page 34: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

Height fields and volumes

Page 35: Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova

End of Lecture 03

Questions?