Terrain Rendering in Frostbite using Procedural Shader Splatting

Similar documents
Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005

GPU Architecture. Michael Doggett ATI

Water Flow in. Alex Vlachos, Valve July 28, 2010

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August

Optimizing AAA Games for Mobile Platforms

Dynamic Resolution Rendering

Modern Graphics Engine Design. Sim Dietrich NVIDIA Corporation

Deferred Shading & Screen Space Effects

Image Synthesis. Fur Rendering. computer graphics & visualization

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Radeon HD 2900 and Geometry Generation. Michael Doggett

OpenGL Performance Tuning

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

Software Virtual Textures

Overview Motivation and applications Challenges. Dynamic Volume Computation and Visualization on the GPU. GPU feature requests Conclusions

INTRODUCTION TO RENDERING TECHNIQUES

Performance Optimization and Debug Tools for mobile games with PlayCanvas

Image Synthesis. Transparency. computer graphics & visualization

Real-Time BC6H Compression on GPU. Krzysztof Narkowicz Lead Engine Programmer Flying Wild Hog

GPU-Driven Rendering Pipelines

Advanced Visual Effects with Direct3D

3D Computer Games History and Technology

Computer Graphics Hardware An Overview

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Hi everyone, my name is Michał Iwanicki. I m an engine programmer at Naughty Dog and this talk is entitled: Lighting technology of The Last of Us,

Optimization for DirectX9 Graphics. Ashu Rege

Making natural looking Volumetric Clouds In Blender 2.48a

Introduction to Computer Graphics

The Dennis Technique for SketchUp Models in Photoshop

Blender addons ESRI Shapefile import/export and georeferenced raster import

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

Cloud function tutorial

Workstation Applications for Windows. NVIDIA MAXtreme User s Guide

How To Make A Texture Map Work Better On A Computer Graphics Card (Or Mac)

GPU Shading and Rendering: Introduction & Graphics Hardware

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

How To Understand The Power Of Unity 3D (Pro) And The Power Behind It (Pro/Pro)

Procedural Shaders: A Feature Animation Perspective

Virtual Textures Dealing with Enormous Texture-Based Resources

A Short Introduction to Computer Graphics

GPU Point List Generation through Histogram Pyramids

CUBE-MAP DATA STRUCTURE FOR INTERACTIVE GLOBAL ILLUMINATION COMPUTATION IN DYNAMIC DIFFUSE ENVIRONMENTS

Hardware design for ray tracing

SkillsUSA 2014 Contest Projects 3-D Visualization and Animation

Lecture Notes, CEng 477

Data Centric Interactive Visualization of Very Large Data

Real-Time Realistic Rendering. Michael Doggett Docent Department of Computer Science Lund university

Far Cry and DirectX. Carsten Wenzel

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Volume Rendering on Mobile Devices. Mika Pesonen

NVIDIA GeForce GTX 580 GPU Datasheet

Outline. srgb DX9, DX10, XBox 360. Tone Mapping. Motion Blur

Interactive Information Visualization using Graphics Hardware Študentská vedecká konferencia 2006

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

Interactive Rendering In The Post-GPU Era. Matt Pharr Graphics Hardware 2006

Advanced Graphics and Animations for ios Apps

High Dynamic Range and other Fun Shader Tricks. Simon Green

The Future Of Animation Is Games

Consolidated Visualization of Enormous 3D Scan Point Clouds with Scanopy

Introduction Computer stuff Pixels Line Drawing. Video Game World 2D 3D Puzzle Characters Camera Time steps

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA

Touchstone -A Fresh Approach to Multimedia for the PC

ACE: Illustrator CC Exam Guide

High Performance Spatial Queries and Analytics for Spatial Big Data. Fusheng Wang. Department of Biomedical Informatics Emory University

Data Parallel Computing on Graphics Hardware. Ian Buck Stanford University

Making Dreams Come True: Global Illumination with Enlighten. Graham Hazel Senior Product Manager Sam Bugden Technical Artist

VRayPattern also allows to curve geometry on any surface

GPGPU Computing. Yong Cao

Low power GPUs a view from the industry. Edvard Sørgård

This Unit: Putting It All Together. CIS 501 Computer Architecture. Sources. What is Computer Architecture?

Shading a Bigger, Better Sequel Techniques in Left 4 Dead 2 BRONWEN GRIMES, VALVE

GPU Hardware Performance. Fall 2015

ACE: After Effects CC

Introduction to Game Programming. Steven Osman

1. Definition of the project. 2. Initial version (simplified texture) 3. Second version (full textures) 5. Modelling and inserting 3D objects

Facts about Visualization Pipelines, applicable to VisIt and ParaView

Development and Evaluation of Point Cloud Compression for the Point Cloud Library

Graphics Cards and Graphics Processing Units. Ben Johnstone Russ Martin November 15, 2011

Game Development in Android Disgruntled Rats LLC. Sean Godinez Brian Morgan Michael Boldischar

Interactive Level-Set Deformation On the GPU

Visualization and Feature Extraction, FLOW Spring School 2016 Prof. Dr. Tino Weinkauf. Flow Visualization. Image-Based Methods (integration-based)

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura

ECMA rd Edition / June Universal 3D File Format

Real-time Visual Tracker by Stream Processing

Using Photorealistic RenderMan for High-Quality Direct Volume Rendering

Introduction to Imagery and Raster Data in ArcGIS

Float a Beachball in Psuanmi

Advanced Rendering for Engineering & Styling

BCC Multi Stripe Wipe

MASKS & CHANNELS WORKING WITH MASKS AND CHANNELS

First, let me do a super fast introduction,

Visualizing Data: Scalable Interactivity

Writing Applications for the GPU Using the RapidMind Development Platform

Volume visualization I Elvins

NVIDIA IndeX Enabling Interactive and Scalable Visualization for Large Data Marc Nienhaus, NVIDIA IndeX Engineering Manager and Chief Architect

So, you want to make a photo-realistic rendering of the Earth from orbit, eh? And you want it to look just like what astronauts see from the shuttle

Parallel Simplification of Large Meshes on PC Clusters

Materials in NX Render

GPUs Under the Hood. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

Transcription:

2.5 Terrain Rendering in Frostbite using Procedural Shader Splatting Johan Andersson Rendering Architect, EA DICE

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-66 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 Rich high-level shader framework Used by all meshes & systems incl. terrain 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

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 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 Height Normal Slope 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 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 Slope With mountain material Mask (slope scaled & biased)

Painted masks Many materials can not be solely distributed on a procedural basis Fields, man-made 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 8 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-10 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( 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 Base mask from slope Detail mask Overlay blend result 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); }

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 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 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 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 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 pixel lighting & shadowing Can use cached terrain normalmap to fit in Overdraw main performance bottleneck Front-to to-back cell sorting Shadows on undergrowth Undergrowth surface shader

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