distance fields
play

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


  1. Distance fields imre paadik

  2. Overview ● Signed distance fields ● Distance fields in computer graphics ○ Textures ○ Geometry

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

  4. Overview

  5. Textures ● Different way of storing bitmap data ● Used with source image o for every distance field value value <=0  yes? draw pixel ● no ignore it ●

  6. Textures ● Distance fields creation o High resolution source image Downsampled to acceptable size  Lot of information preserved  4k textures used to generate 64x64 distance field 

  7. Textures ● Distance fields creation o Brute force o O(N^2) complexity o Mapped to 0f..1.0f range o 0.5f decision point (draw or not to draw)

  8. Textures Main application ● Font rendering ● Decals ● UI

  9. Textures Font rendering ● No need to pre-rasterize all font sizes ● Bonus features o Glow o Drop shadow o Outlining o 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) ); }

  10. Textures Decals

  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

  12. Geometry ● Unreal Engine 4 o Distance Field Ambient Occlusion (DFAO) (4.3) o Distance Field Specular Occlusion (4.5) o Distance Field Soft Shadows (4.5)

  13. DFAO ● Precomputed distance field for every static mesh ● Volume textures storing signed distance to nearest surface ● Pure GPU feature, requires DX11.

  14. DFAO - OFF

  15. DFAO - ON

  16. DFAO - OFF

  17. DFAO - ON

  18. DFAO

  19. DFAO Cons ● Meshes can only use uniform scaling ● Memory overhead ● GPU overhead (3.5ms - 6ms Radeon 7870) ● Rigid meshes only

  20. Specular Occlusion - OFF

  21. Specular Occlusion - ON

  22. Ray Traced Distance Field Soft Shadows (RTDFSS :-) ) ● Uses same DFAO data to compute efficient area shadows ● Point & Spot lights o ‘Source Radius’ determine how large shadow penumbras are o Sharp at shadow contacts softer over distance o Amazing quality (When using correct resolution)

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

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

  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

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

  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

  28. How does this work? ● Efficient ray tracing

  29. How does this work? ● Efficient cone tracing

Recommend


More recommend