Distance fields imre paadik Overview Signed distance fields - - PowerPoint PPT Presentation

distance fields
SMART_READER_LITE
LIVE PREVIEW

Distance fields imre paadik Overview Signed distance fields - - PowerPoint PPT Presentation

Distance fields imre paadik Overview Signed distance fields Distance fields in computer graphics Textures Geometry Overview http://chimera.labs.oreilly.com/books/1234000001814/ch07.html#ch07_id36000844 Overview Textures


slide-1
SLIDE 1

Distance fields

imre paadik

slide-2
SLIDE 2

Overview

  • Signed distance fields
  • Distance fields in computer graphics

○ Textures ○ Geometry

slide-3
SLIDE 3

Overview

http://chimera.labs.oreilly.com/books/1234000001814/ch07.html#ch07_id36000844

slide-4
SLIDE 4

Overview

slide-5
SLIDE 5

Textures

  • Different way of storing bitmap data
  • Used with source image
  • for every distance field value
  • value <=0
  • yes? draw pixel
  • no ignore it
slide-6
SLIDE 6

Textures

  • Distance fields creation
  • High resolution source image
  • Downsampled to acceptable size
  • Lot of information preserved
  • 4k textures used to generate 64x64 distance field
slide-7
SLIDE 7

Textures

  • Distance fields creation
  • Brute force
  • O(N^2) complexity
  • Mapped to 0f..1.0f range
  • 0.5f decision point (draw or not to draw)
slide-8
SLIDE 8

Textures

Main application

  • Font rendering
  • Decals
  • UI
slide-9
SLIDE 9

Textures

Font rendering

  • No need to pre-rasterize all font sizes
  • Bonus features
  • Glow
  • Drop shadow
  • Outlining
  • Antialias (smoothstep between distance field values)

////// Antialiased text rendering ////// float4 ps( VS_OUTPUT IN) : COLOR { // get the alpha value from the distance field texture float rawAlpha = tex2D( TextureSampler, IN.TilingCoords).a; clip (rawAlpha - (0.5f-delta)); return float4(fillColour, smoothstep(0.5f-delta,0.5f+delta,rawAlpha) ); }

slide-10
SLIDE 10

Textures

Decals

slide-11
SLIDE 11

Textures

Used internally in Source Engine Can be used with any engine!

  • http://bytewrangler.blogspot.nl/2011/10/signed-distance-fields.html
  • http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaT

estedMagnification.pdf

  • http://www.lems.brown.edu/vision/people/leymarie/Refs/CompVision/DT/D

Tpaper.pdf

slide-12
SLIDE 12

Geometry

  • Unreal Engine 4
  • Distance Field Ambient Occlusion (DFAO) (4.3)
  • Distance Field Specular Occlusion (4.5)
  • Distance Field Soft Shadows (4.5)
slide-13
SLIDE 13

DFAO

  • Precomputed distance field for every static

mesh

  • Volume textures storing signed distance to

nearest surface

  • Pure GPU feature, requires DX11.
slide-14
SLIDE 14

DFAO - OFF

slide-15
SLIDE 15

DFAO - ON

slide-16
SLIDE 16

DFAO - OFF

slide-17
SLIDE 17

DFAO - ON

slide-18
SLIDE 18

DFAO

slide-19
SLIDE 19

DFAO

Cons

  • Meshes can only use uniform scaling
  • Memory overhead
  • GPU overhead (3.5ms - 6ms Radeon 7870)
  • Rigid meshes only
slide-20
SLIDE 20

Specular Occlusion - OFF

slide-21
SLIDE 21

Specular Occlusion - ON

slide-22
SLIDE 22

Ray Traced Distance Field Soft Shadows (RTDFSS :-) )

  • Uses same DFAO data to compute efficient

area shadows

  • Point & Spot lights
  • ‘Source Radius’ determine how large shadow

penumbras are

  • Sharp at shadow contacts softer over distance
  • Amazing quality (When using correct resolution)
slide-23
SLIDE 23

Ray Traced Distance Field Soft Shadows (RTDFSS :-) )

slide-24
SLIDE 24

Ray Traced Distance Field Soft Shadows (RTDFSS :-) )

slide-25
SLIDE 25

Ray Traced Distance Field Soft Shadows (RTDFSS :-) )

Directional lights

  • ‘Light Source Angle’ determine how large is

shadow penumbra

  • No bias and self intersection problems as

shadowmaps

  • Efficient when used with larger distances
  • Even faster than shadowmapping
slide-26
SLIDE 26

Ray Traced Distance Field Soft Shadows (RTDFSS :-) )

slide-27
SLIDE 27

How does this work?

  • Signed distance fields representing mesh

surfaces

  • Stores distance to the

nearest surface at every point

  • http://http.developer.nv

idia.com/GPUGems3/g pugems3_ch34.html

slide-28
SLIDE 28

How does this work?

  • Efficient ray tracing
slide-29
SLIDE 29

How does this work?

  • Efficient cone tracing