Screenspace Effects Introduction General idea: Render all data - - PDF document

screenspace effects introduction general idea
SMART_READER_LITE
LIVE PREVIEW

Screenspace Effects Introduction General idea: Render all data - - PDF document

Screenspace Effects Introduction General idea: Render all data necessary into textures Render all data necessary into textures Process textures to calculate final image A hi Achievable Effects: bl Eff t Glow/Bloom Depth of field


slide-1
SLIDE 1

Screenspace Effects

slide-2
SLIDE 2

Introduction General idea:

Render all data necessary into textures Render all data necessary into textures Process textures to calculate final image

A hi bl Eff t Achievable Effects:

Glow/Bloom Depth of field Distortions Distortions High dynamic range compression (HDR) Ed d t ti Edge detection Cartoon rendering

Vienna University of Technology 2

Lots more…

slide-3
SLIDE 3

Hardware considerations Older hardware:

Multipass and Blending operators Multipass and Blending operators Is costly and not very flexible

Newer hardware:

Shaders render into up to 8 textures Shaders render into up to 8 textures Second pass maps textures to a quad in screenspace

Fragment shaders process textures g p

Vienna University of Technology 3

slide-4
SLIDE 4

Standard Image Filters Image is filtered with 3x3 kernel:

Weighted texture lookups in adjacent texels Weighted texture lookups in adjacent texels Edge detection through laplacian:

1 1

  • 4

1 1

Emboss filter:

2 2

  • 1
  • 1

Vienna University of Technology 4

slide-5
SLIDE 5

Gaussian Filter Many effects based on gaussian filter 5 5 i filt i 25 t t 5x5 gaussian filter requires 25 texture lookups:

1 4 6 4 1 4 16 26 16 4 6 26 41 26 6

* 1/256

6 26 41 26 6 4 16 26 16 4 1 4 6 4 1

1/256

Too slow and too expensive

But: Gauss is separable!

Vienna University of Technology 5

slide-6
SLIDE 6

Gaussian Filter Separate 5x5 filter into 2 passes P f 5 1 filt i Perform 5x1 filter in u Followed by 1x5 filter in v y

1 4 1 4 6 4 1 4 6 4

* * = =

1

Lookups can be formulated to use linear filtering

Vienna University of Technology 6

g

5x1 filter with 3 lookups

slide-7
SLIDE 7

Bloom

Modify rendered texture intensities before gaussian filtering gaussian filtering

Clamp or glowing object only pass Exponential weight Exponential weight

Add filtered image to original image

+ =

< 0 9

Vienna University of Technology 7

Pictures: Philip Rideout

< 0.9

slide-8
SLIDE 8

Bloom Bloom usually applied to downsampled render textures textures

2x or 4x downsampled

Effectively increases kernel size Effectively increases kernel size

But: Sharp highlights are lost Combination of differently downsampled and filtered render textures possible

Allows high controllability of bloom

Filter in u and v and separate addition leads to star effect

Vienna University of Technology 8

to star effect

slide-9
SLIDE 9

Bloom

Vienna University of Technology 9

Picture: Oblivion

slide-10
SLIDE 10

Bloom remarks Disguises aliasing artifacts W k b t f hi t i l d / k Works best for shiny materials and sun/sky

Only render sun and sky to blur pass Only render specular term to blur pass

A little bit overused these days A little bit overused these days

Use sparsely for most effect

Can smudge out a scene too much

Contrast and sharp features are lost Contrast and sharp features are lost (fairytale look)

Vienna University of Technology 10

slide-11
SLIDE 11

Bloom remarks Extreme example

Vienna University of Technology 11

Picture: Zelda Twilight Princess

slide-12
SLIDE 12

Motion Blur Keep previous frames as textures

Blend weighted frames to final result Blend weighted frames to final result

Calculate camera space speed of each pixel

  • r object in texture
  • r object in texture

Blur along motion vector

Harder to implement, but looks very good y g Faster than blending

Vienna University of Technology 12

slide-13
SLIDE 13

Motion Blur Example

Vienna University of Technology 13

Picture: Crysis (Object Based Motion Blur)

slide-14
SLIDE 14

Other filters Use precomputed noise maps

Modulate Color with noise: Modulate Color with noise:

TV snow emulation

Modulate texture coordinates:

glass refractions glass refractions TV distortions W i Warping

Remap intensity:

Heat vision Eye adaptation

Vienna University of Technology 14

Eye adaptation

slide-15
SLIDE 15

Demo

OGRE D OGRE Demo

Vienna University of Technology 15

slide-16
SLIDE 16

HDR Rendering

Up to now, parameters are chosen so that the result is [0..1] result is [0..1] Real world: Dynamic Range is about 1:100 000 Dynamic Range is about 1:100 000

1: dark at night 100 000 di t li ht 100 000: direct sunlight

Eye adapts to light intensities

Current hardware allows to calculate everything in floating point precision and range

Use lights/environment maps with intensities of high dynamic range

Vienna University of Technology 16

slide-17
SLIDE 17

HDR rendering But: we cannot display a HDR image! S l ti R HDR i t iti t l Solution: Remap HDR intensities to low dynamic range: Tone mapping

Imitates human perception Imitates human perception Can mimic time delayed eye adaptation Can mimic color desaturation Can imitate photographic effects p g p Over exposure Glares

Vienna University of Technology 17

Glares

slide-18
SLIDE 18

HDR Rendering Tone mapping requires information about the intensities of the HDR image intensities of the HDR image

Extract average/maximum luminance through downsampling

Hardware MIPmap generation p g Or through a series of fragment shaders

Naturally combines with bloom filter

Vienna University of Technology 18

slide-19
SLIDE 19

HDR Processing Overview

Picture: Christian Luksch

19 Vienna University of Technology

Picture: Christian Luksch

slide-20
SLIDE 20

Tone mapping Operators (1) Reinhard’s operator

Key … Key … Average luminance … Pixel luminace

Original Modified Key a is set by user or some predefined curve a(la) dependent on average luminance la Calculations need to be done in linear color space! (fl ti i t b ff ti i ) (floating point buffers, see perception issues)

20 Vienna University of Technology

slide-21
SLIDE 21

Tone mapping Operators (2) Reinhard’s operator

Picture: Christian Luksch

21 Vienna University of Technology

Picture: Christian Luksch

slide-22
SLIDE 22

Tone mapping Operators (3) Logarithmic mapping

I t Ad ti l ith i i Improvement: Adaptive logarithmic mapping causes heavy changes of the output y g color when moving through the scene  Modifications necessary  Modifications necessary

22 Vienna University of Technology

slide-23
SLIDE 23

Tone mapping Operators (4) Adaptive logarithmic mapping: [Drago 03] [Drago 03]

Picture: Christian Luksch

23 Vienna University of Technology

Picture: Christian Luksch

slide-24
SLIDE 24

Comparison

24 Vienna University of Technology

slide-25
SLIDE 25

HDR Rendering

OGRE Beach Demo

(this time HDR part)

Author: Christian Luksch

Vienna University of Technology 25

http://www.ogre3d.org/wiki/index.php/HDRlib

slide-26
SLIDE 26

Deferred Shading

General Idea: Treat lighting as a 2D postprocess

Deferred Shading rendered textures: Deferred Shading rendered textures: Normals Position Position Diffuse color Material parameters Material parameters Execute lighting calculations using the textures as input

Vienna University of Technology 26

Picture: NVIDIA

slide-27
SLIDE 27

Deferred Shading

Vienna University of Technology 27

Picture: Leadwerks

slide-28
SLIDE 28

Deferred Shading

Vienna University of Technology 28

Picture: S.T.A.L.K.E.R.

slide-29
SLIDE 29

Deferred Shading Pros:

Perfect batching (no object dependence) Perfect batching (no object dependence) Many small lights are just as cheap a a few big (32 li ht d bl )

  • nes (32 lights and up are no problem)

Combines well with screenspace effects

Cons:

High bandwidth required High bandwidth required

Not applicable on older hardware

Alpha blending hard to achieve Hardware multisampling not available

Vienna University of Technology 29

Hardware multisampling not available

slide-30
SLIDE 30

Deferred Shading Cons are diminishing on current hardware

Hardware features assist deferred shading Hardware features assist deferred shading (sample buffers) High bandwidth and lots of RAM available

Many state-of-the-art engines feature Many state of the art engines feature deferred shading All t i t GI ith hi h b Allows to approximate GI with high number

  • f lights (including negative lights).

Vienna University of Technology 30

slide-31
SLIDE 31

Ambient Occlusion (AO)

Calculates the occlusion of each surface point to the surrounding. surrounding.

No information of the surrounding is used

Vienna University of Technology 31

slide-32
SLIDE 32

Screen Space Ambient Occlusion (SSAO)

Newest hype in real-time graphics Popularized by Crysis (Crytek) Popularized by Crysis (Crytek) Render textures needed:

D h ( li b ff ) ld i i Depth (as linear z-buffer) or world space position Normals

Approach: Fragment analyses its surrounding Fragment analyses its surrounding

Fragment samples z-buffer around screen position to find occluders in surrounding position to find occluders in surrounding Simplest approach: depth difference of fragment and sample

Vienna University of Technology 32

and sample

slide-33
SLIDE 33

Screen Space Ambient Occlusion (SSAO)

Pros:

Independent from scene complexity Independent from scene complexity No preprocessing Dynamic scenes Dynamic scenes

Cons:

Not correct Not correct Only evaluates what is seen O l l h d i Only close range shadowing Sampling artifacts (needs additional smoothing/blur)

B t b t t i lti hi But noone cares about correctness in realtime graphics

Very powerful method!

Vienna University of Technology 33

slide-34
SLIDE 34

OGRE SSAO Demo

Vienna University of Technology 34

slide-35
SLIDE 35

Screen Space Ambient Occlusion (SSAO)

Many variations are available, differing in correctness/speed/filtering. correctness/speed/filtering. Can be extended to include approximations of global illumination or image based lighting (Ritschel et al illumination or image based lighting (Ritschel et al. 2009)

Vienna University of Technology 35