SlideShare a Scribd company logo
Terrain Rendering in Frostbite using Procedural Shader Splatting Johan Andersson Rendering Architect, EA DICE 2.5
Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions  Future
Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions  Future
Battlefield 2 terrain ” Traditional terrain rendering” Static geometry Heightfields    optimized meshes Unique low-res color map Tiled detail maps 3-6 detail maps Controlled by unique mask textures Macro detail map Fixed shading & compositing Expensive & difficult to add features Special case for mountains/slopes No destruction   Color map Detail mask map
Our requirements Battlefield: Bad Company  Frostbite engine pilot project Xbox 360 & PS3 Low memory usage Scaling up BF2 methods (~45mb) not possible High detail up close and far away  Long view distance (16 km) Normal maps, multiple texturing techniques Destruction Affecting geometry, texturing, shading
Terrain overview Multiple high-res heightfield GPU textures Easy destruction Used in both VS and PS 16-bit unsigned integer format (L16) Normals calculated in the shader from heightfield Very high detail lighting in a distance Saves memory
Terrain lighting screenshot
Terrain texturing - general idea Compute instead of store Shading, texturing, material compositing Using procedural techniques in shaders Allows changing & adding materials dynamically  Destruction! Splat arbitrary shaders over the terrain  Artist created Determines both look and visibility of materials Specialized to requirements of material ” Procedural Shader Splatting”
Terrain material requirements Different shading & texturing requirements depending on Natural complexity  Distance from camera  Importance in game  How well used it is (effort to create) And more Example cases Seafloor material (partially obscured) Parallax mapping only on rocky surfaces
Specialized terrain material shaders Vary features & complexity Texture compositing, side-projection, normalmapping, parallax-mapping, specular Flexible tradeoff of memory, performance and quality for each material Can be complex for artists How we’ve always done shaders for other types of geometry
Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions  Future
Graph-based surface shaders Artist-friendly Easy to create, tweak and manage Flexible Programmers & artists can extend & expose features Data-centric Encapsulates resources Can create or transform shaders in automated processes Example surface shader graph Rich high-level shader framework Used by all meshes & systems incl. terrain
 
Instance shaders Shader graph network that can be instanced as a node in another shader Think C/C++ functions Reduces complexity and allows reuse Hide and encapsulate functionality on multiple levels Choose inputs & outputs to expose
Shader pipeline Big complex offline pre-processing system Used surface shaders & states is gathered per level Generates shading solutions HLSL vertex and pixel shaders States, constants, passes Can trade shader efficiency for amount of shader permutations Example: include fog in all shaders or create seperate shaders with and without fog Lots of optimization opportunities
Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions  Future
Procedural techniques There are many interesting procedural texturing techniques For example: Wang tiles But most are Heavy or difficult to run on a GPU Difficult to mipmap correctly Require rendering to offscreen targets Want direct evaluation techniques that can be executed directly inside shaders At least as a base Only computes visible pixels
Procedural parameters Build procedural patterns of basic terrain parameters evaluated in all shaders Uses the GPU heightfield textures Commonly used in offline terrain rendering and texture generation Such as Terragen Normal Height Slope
Normal filtering Simple & fast cross filter Not correct at diagonals, but good enough for us Result is world space normal float3 filterNormal(float2 uv, float texelSize, float texelAspect) { float4 h; h[0] = hmap.Sample(bilSampler, uv + texelSize*float2( 0,-1)).r; h[1] = hmap.Sample(bilSampler, uv + texelSize*float2(-1, 0)).r; h[2] = hmap.Sample(bilSampler, uv + texelSize*float2( 1, 0)).r; h[3] = hmap.Sample(bilSampler, uv + texelSize*float2( 0, 1)).r; float3 n; n.z = (h[0] - h[3]) * texelAspect; n.x = (h[1] - h[2]) * texelAspect; n.y = 2;  return normalize(n); }
Material masking Terrain shaders determine material mask  I.e. visibility Can use  Procedural parameters Typically slope Painted masks Arbitrary texturing or shader computation Or combine them all Multiple material masks of all types  Red  = slope-based cliff material Pink  = painted dirt material
Mountain material example Only grass material With mountain material Slope Mask (slope scaled & biased)
Painted masks Many materials can not be solely distributed on a procedural basis Fields, man-made areas, artist control Support painted per-material masks Memory heavy but flexible 0.5 – 8 pixels/meter Coverage typically low 5-15% coverage of levels Not much overlap Fields with painted masks
Static sparse mask textures (1/2) Store painted masks in sparse quadtree textures Major memory reduction Split painted masks into 32x32 tiles and store in atlas texture Only unique tiles DXT5A compression Can use texture arrays But want more than 64/512 slices Source mask Atlas texture
Static sparse mask textures (2/2) Tile index & level textures cover the terrain Tile index: 16-bit integer index into tile atlas Tile level: 8-bit integer. Size of tile world area Low-res, 16 meters/pixel Lookup with world-space position Calculate atlas texture coordinates Details in course notes 4 masks packed together in RGBA For efficiency and to reduce # of samplers
Destruction mask (1/2) Change material and/or look around craters Render decals into destruction mask texture Covers playable area (2x2 or 4x4 km) Usually 2 pixels/meter Material shaders get access to simple 0-1 value Blends in or replaces textures and colors Crater screenshot Crater mask (point-filtering)
Destruction mask (2/2) Observation: 100% destruction not possible in practice Due to gameplay Can store mask as sparse texture to save memory Indirection texture covers whole area RG88, 128x128 resolution = 16m cells .rg indexes into atlas texture 64x64 L8 tiles Gives virtual 8192x8192 texture with tweakable max coverage 16.7 mb ->  ~1.7 mb (10% coverage) Atlas texture Indirection texture
Increasing mask detail All the masking techniques can suffer from bluriness due to low resolution Add detail in the shaders! Many methods for generating detail fBm, noise Detail textures Reusing textures with scale, bias and contrast Colormaps, normalmap.b (”occlusion”) And for compositing/blending in the detail Multiply, add, min, max, overlay, custom Fully programmable since in shaders
Photoshop Overlay blend Perfect for blending in high-frequency details Doesn’t affect areas where base mask is 0.0 or 1.0 Good for dynamic flow control float overlayBlend(float base, float value, float opacity) { float a = base < 0.5 ? 2*base*value : 1 - 2*(1-base)*(1-value); return lerp(base, a, opacity); } Base mask from slope Detail mask Overlay blend result
Shader compositing Multiple overlapping materials on terrain  Pre-process gathers all material combinations Of materials used in 16x16 m areas Builds big single pass shaders Links together shader graphs (simple!) Redundant resources & calculations automatically removed Dynamic flow control to avoid texture & ALU instructions for materials with mask = 0 2 materials (r & g) creating 3 combos due to overlap
Base grass material
Dirt on slopes added
Sea/river floor material added
Fields added (painted masks)
2 more field types added
Slope-based cliffs added
End result. Road decals + minor materials
Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions  Future
Terrain rendering Quadtree for culling & LOD Subdivided dependent on distance  Leaves are 33x33 fixed vertex grids Simple Vertex texture fetch when supported/efficient CPU/SPU-filled semi-static height vertex buffer pool otherwise Fixed grid resolution important for ground destruction
Geometry LOD T-junctions between patches of different LOD Need to be removed, causes rendering artifacts Due to vertex shader heightfield sampling Before Removed
T-junction solution Limit neighboring patches to max 1 level difference Select index buffer depending on which side borders to lower-resolution LOD Only 9 permutations needed
Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions  Future
Undergrowth Heightfields with good texturing & shading isn’t enough up close Need detail geometry Undergrowth, small foliage, litter, debris Must be able to change with destruction Manual placement not feasible nor preferred
Undergrowth example No undergrowth With undergrowth
Undergrowth overview (1/2) Instance low-poly meshes around views Alpha-tested / alpha-to-coverage  Fillrate and sort-independence Procedural on-demand distribution Using terrain materials & shaders Gigabyte of memory if stored Regenerate areas on destruction GPU-assisted
Undergrowth overview (2/2) Managed through a virtual grid structure 16x16m cells Cells allocated from a fixed pool As view position changes Cells contain Semi-static vertex buffer with 4x3 fp16 instancing transforms List of which instance uses which mesh
Undergrowth generation GPU renders out 4-8 terrain material masks & terrain normal From the area the cell covers  3x 64x64 ARGB8888 MRT CPU/SPU scans through texture and distributes instances Fills instancing transform buffer Good fit for D3D10 Stream Output Generated mask Normalmap
Undergrowth distribution Based on randomly jittered grid pattern Grid size determined by material density Random offsets to grid points of max half cell size Gives uniform but varied distribution No / controlled overlap of instances  Looks and performs better than fully random solution Deterministic results  Grid cell position as seed Important both locally (revisit) and over network
Undergrowth rendering Simple instanced mesh rendering Uses arbitrary surface shaders Unified per-pixel lighting & shadowing Can use cached terrain normalmap to fit in Overdraw main performance bottleneck Front-to-back cell sorting Undergrowth surface shader Shadows on undergrowth
Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions  Future
Conclusions Very scalable & extendable Flexible framework for performance tradeoffs Low memory usage Higher quality but higher cost in general For performance For artists Complex shaders requires technical artists Simple workflow for undergrowth Huge data amplification High bang for the buck
Future / Ideas Very  complex surface shaders ALU-based noise Wang-tiles More care for shader antialiasing Vector texture maps as masks Cached procedural texture generation Texture synthesis Displacement mapping Adv. natural undergrowth distribution patterns Fully on GPU or SPU
Questions? Contact: johan.andersson@dice.se
Ad

More Related Content

What's hot (20)

Calibrating Lighting and Materials in Far Cry 3
Calibrating Lighting and Materials in Far Cry 3Calibrating Lighting and Materials in Far Cry 3
Calibrating Lighting and Materials in Far Cry 3
stevemcauley
 
Light prepass
Light prepassLight prepass
Light prepass
changehee lee
 
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
Philip Hammer
 
DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3
Electronic Arts / DICE
 
Screen Space Reflections in The Surge
Screen Space Reflections in The SurgeScreen Space Reflections in The Surge
Screen Space Reflections in The Surge
Michele Giacalone
 
Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)
Tiago Sousa
 
Terrain in Battlefield 3: A Modern, Complete and Scalable System
Terrain in Battlefield 3: A Modern, Complete and Scalable SystemTerrain in Battlefield 3: A Modern, Complete and Scalable System
Terrain in Battlefield 3: A Modern, Complete and Scalable System
Electronic Arts / DICE
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars Battlefront
Electronic Arts / DICE
 
Siggraph2016 - The Devil is in the Details: idTech 666
Siggraph2016 - The Devil is in the Details: idTech 666Siggraph2016 - The Devil is in the Details: idTech 666
Siggraph2016 - The Devil is in the Details: idTech 666
Tiago Sousa
 
Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1
Ki Hyunwoo
 
NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017
Mark Kilgard
 
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Tiago Sousa
 
OpenGL 4.4 - Scene Rendering Techniques
OpenGL 4.4 - Scene Rendering TechniquesOpenGL 4.4 - Scene Rendering Techniques
OpenGL 4.4 - Scene Rendering Techniques
Narann29
 
Secrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics TechnologySecrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics Technology
Tiago Sousa
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
Electronic Arts / DICE
 
Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lighting
ozlael ozlael
 
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
repii
 
Frostbite on Mobile
Frostbite on MobileFrostbite on Mobile
Frostbite on Mobile
Electronic Arts / DICE
 
Stochastic Screen-Space Reflections
Stochastic Screen-Space ReflectionsStochastic Screen-Space Reflections
Stochastic Screen-Space Reflections
Electronic Arts / DICE
 
Killzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo PostmortemKillzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo Postmortem
Guerrilla
 
Calibrating Lighting and Materials in Far Cry 3
Calibrating Lighting and Materials in Far Cry 3Calibrating Lighting and Materials in Far Cry 3
Calibrating Lighting and Materials in Far Cry 3
stevemcauley
 
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
Philip Hammer
 
Screen Space Reflections in The Surge
Screen Space Reflections in The SurgeScreen Space Reflections in The Surge
Screen Space Reflections in The Surge
Michele Giacalone
 
Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)
Tiago Sousa
 
Terrain in Battlefield 3: A Modern, Complete and Scalable System
Terrain in Battlefield 3: A Modern, Complete and Scalable SystemTerrain in Battlefield 3: A Modern, Complete and Scalable System
Terrain in Battlefield 3: A Modern, Complete and Scalable System
Electronic Arts / DICE
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars Battlefront
Electronic Arts / DICE
 
Siggraph2016 - The Devil is in the Details: idTech 666
Siggraph2016 - The Devil is in the Details: idTech 666Siggraph2016 - The Devil is in the Details: idTech 666
Siggraph2016 - The Devil is in the Details: idTech 666
Tiago Sousa
 
Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1
Ki Hyunwoo
 
NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017
Mark Kilgard
 
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Tiago Sousa
 
OpenGL 4.4 - Scene Rendering Techniques
OpenGL 4.4 - Scene Rendering TechniquesOpenGL 4.4 - Scene Rendering Techniques
OpenGL 4.4 - Scene Rendering Techniques
Narann29
 
Secrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics TechnologySecrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics Technology
Tiago Sousa
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
Electronic Arts / DICE
 
Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lighting
ozlael ozlael
 
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
repii
 
Killzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo PostmortemKillzone Shadow Fall Demo Postmortem
Killzone Shadow Fall Demo Postmortem
Guerrilla
 

Similar to Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007) (20)

Destruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance FieldsDestruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance Fields
Electronic Arts / DICE
 
CS 354 Texture Mapping
CS 354 Texture MappingCS 354 Texture Mapping
CS 354 Texture Mapping
Mark Kilgard
 
Checkerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCCheckerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOC
QLOC
 
Advanced Lighting for Interactive Applications
Advanced Lighting for Interactive ApplicationsAdvanced Lighting for Interactive Applications
Advanced Lighting for Interactive Applications
stefan_b
 
GDC 2014 - Deformable Snow Rendering in Batman: Arkham Origins
GDC 2014 - Deformable Snow Rendering in Batman: Arkham OriginsGDC 2014 - Deformable Snow Rendering in Batman: Arkham Origins
GDC 2014 - Deformable Snow Rendering in Batman: Arkham Origins
Colin Barré-Brisebois
 
Dynamic Mapping of Raster Data (IV 2009)
Dynamic Mapping of Raster Data (IV 2009)Dynamic Mapping of Raster Data (IV 2009)
Dynamic Mapping of Raster Data (IV 2009)
Matthias Trapp
 
The Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next StepsThe Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next Steps
repii
 
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
Owen Wu
 
Shadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive ApplicationsShadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive Applications
stefan_b
 
Smedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphicsSmedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphics
changehee lee
 
Icaros Photogrammetric Suite (IPS) Workflow
Icaros Photogrammetric Suite (IPS) WorkflowIcaros Photogrammetric Suite (IPS) Workflow
Icaros Photogrammetric Suite (IPS) Workflow
IcarosMapping
 
D3 D10 Unleashed New Features And Effects
D3 D10 Unleashed   New Features And EffectsD3 D10 Unleashed   New Features And Effects
D3 D10 Unleashed New Features And Effects
Thomas Goddard
 
Color and 3D Semantic Reconstruction of Indoor Scenes from RGB-D stream
Color and 3D Semantic Reconstruction of Indoor Scenes from RGB-D streamColor and 3D Semantic Reconstruction of Indoor Scenes from RGB-D stream
Color and 3D Semantic Reconstruction of Indoor Scenes from RGB-D stream
NAVER Engineering
 
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus MobileLook Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Unity Technologies
 
Hardware Shaders
Hardware ShadersHardware Shaders
Hardware Shaders
gueste52f1b
 
Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360
VIKAS SINGH BHADOURIA
 
Angel cunado_The Terrain Of KUF2
Angel cunado_The Terrain Of KUF2Angel cunado_The Terrain Of KUF2
Angel cunado_The Terrain Of KUF2
drandom
 
Efficient LDI Representation (TPCG 2008)
Efficient LDI Representation (TPCG 2008)Efficient LDI Representation (TPCG 2008)
Efficient LDI Representation (TPCG 2008)
Matthias Trapp
 
Gpu presentation
Gpu presentationGpu presentation
Gpu presentation
spartasoft
 
Unite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platformsUnite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platforms
ナム-Nam Nguyễn
 
Destruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance FieldsDestruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance Fields
Electronic Arts / DICE
 
CS 354 Texture Mapping
CS 354 Texture MappingCS 354 Texture Mapping
CS 354 Texture Mapping
Mark Kilgard
 
Checkerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCCheckerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOC
QLOC
 
Advanced Lighting for Interactive Applications
Advanced Lighting for Interactive ApplicationsAdvanced Lighting for Interactive Applications
Advanced Lighting for Interactive Applications
stefan_b
 
GDC 2014 - Deformable Snow Rendering in Batman: Arkham Origins
GDC 2014 - Deformable Snow Rendering in Batman: Arkham OriginsGDC 2014 - Deformable Snow Rendering in Batman: Arkham Origins
GDC 2014 - Deformable Snow Rendering in Batman: Arkham Origins
Colin Barré-Brisebois
 
Dynamic Mapping of Raster Data (IV 2009)
Dynamic Mapping of Raster Data (IV 2009)Dynamic Mapping of Raster Data (IV 2009)
Dynamic Mapping of Raster Data (IV 2009)
Matthias Trapp
 
The Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next StepsThe Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next Steps
repii
 
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
Owen Wu
 
Shadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive ApplicationsShadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive Applications
stefan_b
 
Smedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphicsSmedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphics
changehee lee
 
Icaros Photogrammetric Suite (IPS) Workflow
Icaros Photogrammetric Suite (IPS) WorkflowIcaros Photogrammetric Suite (IPS) Workflow
Icaros Photogrammetric Suite (IPS) Workflow
IcarosMapping
 
D3 D10 Unleashed New Features And Effects
D3 D10 Unleashed   New Features And EffectsD3 D10 Unleashed   New Features And Effects
D3 D10 Unleashed New Features And Effects
Thomas Goddard
 
Color and 3D Semantic Reconstruction of Indoor Scenes from RGB-D stream
Color and 3D Semantic Reconstruction of Indoor Scenes from RGB-D streamColor and 3D Semantic Reconstruction of Indoor Scenes from RGB-D stream
Color and 3D Semantic Reconstruction of Indoor Scenes from RGB-D stream
NAVER Engineering
 
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus MobileLook Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Unity Technologies
 
Hardware Shaders
Hardware ShadersHardware Shaders
Hardware Shaders
gueste52f1b
 
Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360
VIKAS SINGH BHADOURIA
 
Angel cunado_The Terrain Of KUF2
Angel cunado_The Terrain Of KUF2Angel cunado_The Terrain Of KUF2
Angel cunado_The Terrain Of KUF2
drandom
 
Efficient LDI Representation (TPCG 2008)
Efficient LDI Representation (TPCG 2008)Efficient LDI Representation (TPCG 2008)
Efficient LDI Representation (TPCG 2008)
Matthias Trapp
 
Gpu presentation
Gpu presentationGpu presentation
Gpu presentation
spartasoft
 
Unite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platformsUnite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platforms
ナム-Nam Nguyễn
 
Ad

More from repii (7)

Low-level Graphics APIs
Low-level Graphics APIsLow-level Graphics APIs
Low-level Graphics APIs
repii
 
Parallel Futures of a Game Engine (v2.0)
Parallel Futures of a Game Engine (v2.0)Parallel Futures of a Game Engine (v2.0)
Parallel Futures of a Game Engine (v2.0)
repii
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game Engine
repii
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
repii
 
Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!
repii
 
Shadows & Decals: D3D10 Techniques in Frostbite (GDC'09)
 	 Shadows & Decals: D3D10 Techniques in Frostbite (GDC'09) 	 Shadows & Decals: D3D10 Techniques in Frostbite (GDC'09)
Shadows & Decals: D3D10 Techniques in Frostbite (GDC'09)
repii
 
Advanced Real-time Post-Processing using GPGPU techniques
Advanced Real-time Post-Processing using GPGPU techniquesAdvanced Real-time Post-Processing using GPGPU techniques
Advanced Real-time Post-Processing using GPGPU techniques
repii
 
Low-level Graphics APIs
Low-level Graphics APIsLow-level Graphics APIs
Low-level Graphics APIs
repii
 
Parallel Futures of a Game Engine (v2.0)
Parallel Futures of a Game Engine (v2.0)Parallel Futures of a Game Engine (v2.0)
Parallel Futures of a Game Engine (v2.0)
repii
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game Engine
repii
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
repii
 
Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!Your Game Needs Direct3D 11, So Get Started Now!
Your Game Needs Direct3D 11, So Get Started Now!
repii
 
Shadows & Decals: D3D10 Techniques in Frostbite (GDC'09)
 	 Shadows & Decals: D3D10 Techniques in Frostbite (GDC'09) 	 Shadows & Decals: D3D10 Techniques in Frostbite (GDC'09)
Shadows & Decals: D3D10 Techniques in Frostbite (GDC'09)
repii
 
Advanced Real-time Post-Processing using GPGPU techniques
Advanced Real-time Post-Processing using GPGPU techniquesAdvanced Real-time Post-Processing using GPGPU techniques
Advanced Real-time Post-Processing using GPGPU techniques
repii
 
Ad

Recently uploaded (20)

Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Top-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptxTop-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptx
BR Softech
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Optima Cyber - Maritime Cyber Security - MSSP Services - Manolis Sfakianakis ...
Mike Mingos
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Top-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptxTop-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptx
BR Softech
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 

Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)

  • 1. Terrain Rendering in Frostbite using Procedural Shader Splatting Johan Andersson Rendering Architect, EA DICE 2.5
  • 2. Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions Future
  • 3. Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions Future
  • 4. Battlefield 2 terrain ” Traditional terrain rendering” Static geometry Heightfields  optimized meshes Unique low-res color map Tiled detail maps 3-6 detail maps Controlled by unique mask textures Macro detail map Fixed shading & compositing Expensive & difficult to add features Special case for mountains/slopes No destruction  Color map Detail mask map
  • 5. Our requirements Battlefield: Bad Company Frostbite engine pilot project Xbox 360 & PS3 Low memory usage Scaling up BF2 methods (~45mb) not possible High detail up close and far away Long view distance (16 km) Normal maps, multiple texturing techniques Destruction Affecting geometry, texturing, shading
  • 6. Terrain overview Multiple high-res heightfield GPU textures Easy destruction Used in both VS and PS 16-bit unsigned integer format (L16) Normals calculated in the shader from heightfield Very high detail lighting in a distance Saves memory
  • 8. Terrain texturing - general idea Compute instead of store Shading, texturing, material compositing Using procedural techniques in shaders Allows changing & adding materials dynamically Destruction! Splat arbitrary shaders over the terrain Artist created Determines both look and visibility of materials Specialized to requirements of material ” Procedural Shader Splatting”
  • 9. Terrain material requirements Different shading & texturing requirements depending on Natural complexity Distance from camera Importance in game How well used it is (effort to create) And more Example cases Seafloor material (partially obscured) Parallax mapping only on rocky surfaces
  • 10. Specialized terrain material shaders Vary features & complexity Texture compositing, side-projection, normalmapping, parallax-mapping, specular Flexible tradeoff of memory, performance and quality for each material Can be complex for artists How we’ve always done shaders for other types of geometry
  • 11. Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions Future
  • 12. Graph-based surface shaders Artist-friendly Easy to create, tweak and manage Flexible Programmers & artists can extend & expose features Data-centric Encapsulates resources Can create or transform shaders in automated processes Example surface shader graph Rich high-level shader framework Used by all meshes & systems incl. terrain
  • 13.  
  • 14. Instance shaders Shader graph network that can be instanced as a node in another shader Think C/C++ functions Reduces complexity and allows reuse Hide and encapsulate functionality on multiple levels Choose inputs & outputs to expose
  • 15. Shader pipeline Big complex offline pre-processing system Used surface shaders & states is gathered per level Generates shading solutions HLSL vertex and pixel shaders States, constants, passes Can trade shader efficiency for amount of shader permutations Example: include fog in all shaders or create seperate shaders with and without fog Lots of optimization opportunities
  • 16. Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions Future
  • 17. Procedural techniques There are many interesting procedural texturing techniques For example: Wang tiles But most are Heavy or difficult to run on a GPU Difficult to mipmap correctly Require rendering to offscreen targets Want direct evaluation techniques that can be executed directly inside shaders At least as a base Only computes visible pixels
  • 18. Procedural parameters Build procedural patterns of basic terrain parameters evaluated in all shaders Uses the GPU heightfield textures Commonly used in offline terrain rendering and texture generation Such as Terragen Normal Height Slope
  • 19. Normal filtering Simple & fast cross filter Not correct at diagonals, but good enough for us Result is world space normal float3 filterNormal(float2 uv, float texelSize, float texelAspect) { float4 h; h[0] = hmap.Sample(bilSampler, uv + texelSize*float2( 0,-1)).r; h[1] = hmap.Sample(bilSampler, uv + texelSize*float2(-1, 0)).r; h[2] = hmap.Sample(bilSampler, uv + texelSize*float2( 1, 0)).r; h[3] = hmap.Sample(bilSampler, uv + texelSize*float2( 0, 1)).r; float3 n; n.z = (h[0] - h[3]) * texelAspect; n.x = (h[1] - h[2]) * texelAspect; n.y = 2; return normalize(n); }
  • 20. Material masking Terrain shaders determine material mask I.e. visibility Can use Procedural parameters Typically slope Painted masks Arbitrary texturing or shader computation Or combine them all Multiple material masks of all types Red = slope-based cliff material Pink = painted dirt material
  • 21. Mountain material example Only grass material With mountain material Slope Mask (slope scaled & biased)
  • 22. Painted masks Many materials can not be solely distributed on a procedural basis Fields, man-made areas, artist control Support painted per-material masks Memory heavy but flexible 0.5 – 8 pixels/meter Coverage typically low 5-15% coverage of levels Not much overlap Fields with painted masks
  • 23. Static sparse mask textures (1/2) Store painted masks in sparse quadtree textures Major memory reduction Split painted masks into 32x32 tiles and store in atlas texture Only unique tiles DXT5A compression Can use texture arrays But want more than 64/512 slices Source mask Atlas texture
  • 24. Static sparse mask textures (2/2) Tile index & level textures cover the terrain Tile index: 16-bit integer index into tile atlas Tile level: 8-bit integer. Size of tile world area Low-res, 16 meters/pixel Lookup with world-space position Calculate atlas texture coordinates Details in course notes 4 masks packed together in RGBA For efficiency and to reduce # of samplers
  • 25. Destruction mask (1/2) Change material and/or look around craters Render decals into destruction mask texture Covers playable area (2x2 or 4x4 km) Usually 2 pixels/meter Material shaders get access to simple 0-1 value Blends in or replaces textures and colors Crater screenshot Crater mask (point-filtering)
  • 26. Destruction mask (2/2) Observation: 100% destruction not possible in practice Due to gameplay Can store mask as sparse texture to save memory Indirection texture covers whole area RG88, 128x128 resolution = 16m cells .rg indexes into atlas texture 64x64 L8 tiles Gives virtual 8192x8192 texture with tweakable max coverage 16.7 mb -> ~1.7 mb (10% coverage) Atlas texture Indirection texture
  • 27. Increasing mask detail All the masking techniques can suffer from bluriness due to low resolution Add detail in the shaders! Many methods for generating detail fBm, noise Detail textures Reusing textures with scale, bias and contrast Colormaps, normalmap.b (”occlusion”) And for compositing/blending in the detail Multiply, add, min, max, overlay, custom Fully programmable since in shaders
  • 28. Photoshop Overlay blend Perfect for blending in high-frequency details Doesn’t affect areas where base mask is 0.0 or 1.0 Good for dynamic flow control float overlayBlend(float base, float value, float opacity) { float a = base < 0.5 ? 2*base*value : 1 - 2*(1-base)*(1-value); return lerp(base, a, opacity); } Base mask from slope Detail mask Overlay blend result
  • 29. Shader compositing Multiple overlapping materials on terrain Pre-process gathers all material combinations Of materials used in 16x16 m areas Builds big single pass shaders Links together shader graphs (simple!) Redundant resources & calculations automatically removed Dynamic flow control to avoid texture & ALU instructions for materials with mask = 0 2 materials (r & g) creating 3 combos due to overlap
  • 31. Dirt on slopes added
  • 34. 2 more field types added
  • 36. End result. Road decals + minor materials
  • 37. Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions Future
  • 38. Terrain rendering Quadtree for culling & LOD Subdivided dependent on distance Leaves are 33x33 fixed vertex grids Simple Vertex texture fetch when supported/efficient CPU/SPU-filled semi-static height vertex buffer pool otherwise Fixed grid resolution important for ground destruction
  • 39. Geometry LOD T-junctions between patches of different LOD Need to be removed, causes rendering artifacts Due to vertex shader heightfield sampling Before Removed
  • 40. T-junction solution Limit neighboring patches to max 1 level difference Select index buffer depending on which side borders to lower-resolution LOD Only 9 permutations needed
  • 41. Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions Future
  • 42. Undergrowth Heightfields with good texturing & shading isn’t enough up close Need detail geometry Undergrowth, small foliage, litter, debris Must be able to change with destruction Manual placement not feasible nor preferred
  • 43. Undergrowth example No undergrowth With undergrowth
  • 44. Undergrowth overview (1/2) Instance low-poly meshes around views Alpha-tested / alpha-to-coverage Fillrate and sort-independence Procedural on-demand distribution Using terrain materials & shaders Gigabyte of memory if stored Regenerate areas on destruction GPU-assisted
  • 45. Undergrowth overview (2/2) Managed through a virtual grid structure 16x16m cells Cells allocated from a fixed pool As view position changes Cells contain Semi-static vertex buffer with 4x3 fp16 instancing transforms List of which instance uses which mesh
  • 46. Undergrowth generation GPU renders out 4-8 terrain material masks & terrain normal From the area the cell covers 3x 64x64 ARGB8888 MRT CPU/SPU scans through texture and distributes instances Fills instancing transform buffer Good fit for D3D10 Stream Output Generated mask Normalmap
  • 47. Undergrowth distribution Based on randomly jittered grid pattern Grid size determined by material density Random offsets to grid points of max half cell size Gives uniform but varied distribution No / controlled overlap of instances Looks and performs better than fully random solution Deterministic results Grid cell position as seed Important both locally (revisit) and over network
  • 48. Undergrowth rendering Simple instanced mesh rendering Uses arbitrary surface shaders Unified per-pixel lighting & shadowing Can use cached terrain normalmap to fit in Overdraw main performance bottleneck Front-to-back cell sorting Undergrowth surface shader Shadows on undergrowth
  • 49. Outline Previous games Terrain overview Graph-based shaders Terrain shading & texturing Terrain rendering Undergrowth Conclusions Future
  • 50. Conclusions Very scalable & extendable Flexible framework for performance tradeoffs Low memory usage Higher quality but higher cost in general For performance For artists Complex shaders requires technical artists Simple workflow for undergrowth Huge data amplification High bang for the buck
  • 51. Future / Ideas Very complex surface shaders ALU-based noise Wang-tiles More care for shader antialiasing Vector texture maps as masks Cached procedural texture generation Texture synthesis Displacement mapping Adv. natural undergrowth distribution patterns Fully on GPU or SPU
  翻译: