Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.

Post on 18-Dec-2015

216 views 0 download

Tags:

Transcript of Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.

Real-Time Rendering

SPEACIAL EFFECTS

Lecture 03Marina Gavrilova

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

The Rendering Spectrum Effects can be produced by manipulation of

images or geometry or both

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

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

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

Particle system Point based sprites Additive or other

blending Physically based

modeling Realistic volumetric

effect

Lenz Effects

Effects that makes a scene natural

By mimicking physical properties of eye/camera

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

the source Secondary lens effects (internal

reflection and refraction)

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

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

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)

Depth of Field Hold camera target

stationery Vary camera source Render several pass Accumulate scene

Shadow mapping

Without darkness, light cannot exist

Shadow mapping makes a scene significantly more

realistic

Sh

ad

ow

in

a

scen

e

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

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=

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:

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

Soft Projective Shadow Method 2: Use spherical

light source Less expensive

computationally Looks better Problem: Visual artifact

when object touching the plane

Hard

Soft

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

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

Shadow Volume

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

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

Shadow mapping steps…

Shadow mapping for a complex scene

the pointthe pointlight sourcelight source

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

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

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

Shadow mapping steps… Test Shadows: non green areas

are shadows

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

shadow

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

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

Height fields and volumes

End of Lecture 03

Questions?