GUERRILLA DEVELOP CONFERENCE JULY 07 BRIGHTON

Similar documents
Applications of Explicit Early-Z Z Culling. Jason Mitchell ATI Research

DEFERRED RENDERING STEFAN MÜLLER ARISONA, ETH ZURICH SMA/

Render-To-Texture Caching. D. Sim Dietrich Jr.

Deferred Rendering Due: Wednesday November 15 at 10pm

Enhancing Traditional Rasterization Graphics with Ray Tracing. March 2015

Optimizing and Profiling Unity Games for Mobile Platforms. Angelo Theodorou Senior Software Engineer, MPG Gamelab 2014, 25 th -27 th June

The Vegetation of Horizon Zero Dawn. Gilbert Sanders Principal Artist, Guerrilla Games

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

Bringing Hollywood to Real Time. Abe Wiley 3D Artist 3-D Application Research Group

Dominic Filion, Senior Engineer Blizzard Entertainment. Rob McNaughton, Lead Technical Artist Blizzard Entertainment

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

Michal Valient Lead Tech Guerrilla Games

Basic GPU techniques Josef Pelikán CGG MFF UK Praha.

Game Graphics Programmers

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Technical Guide. Updated August 24, Page 1 of 19

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping

Pipeline Operations. CS 4620 Lecture 14

The Application Stage. The Game Loop, Resource Management and Renderer Design

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

Pipeline Operations. CS 4620 Lecture 10

Beyond Programmable Shading Course ACM SIGGRAPH 2010 Bending the Graphics Pipeline

Vulkan Multipass mobile deferred done right

TSBK03 Screen-Space Ambient Occlusion

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Physically Based Shading in Unity. Aras Pranckevičius Rendering Dude

The Making of Seemore WebGL. Will Eastcott, CEO, PlayCanvas

Wednesday, July 24, 13

Computergrafik. Matthias Zwicker. Herbst 2010

Adaptive Point Cloud Rendering

The Traditional Graphics Pipeline

CS 354R: Computer Game Technology

Enabling immersive gaming experiences Intro to Ray Tracing

Deferred Renderer Proof of Concept Report

Wed, October 12, 2011

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Lecture 9: Deferred Shading. Visual Computing Systems CMU , Fall 2013

Shadow Techniques. Sim Dietrich NVIDIA Corporation

Deus Ex is in the Details

Game Graphics Programmers

Models and Architectures

MAXIS-mizing Darkspore*: A Case Study of Graphic Analysis and Optimizations in Maxis Deferred Renderer

A bit more Deferred - CryEngine 3. Triangle Game Conference 2009 Martin Mittring Lead Graphics Programmer

Scanline Rendering 2 1/42

Game Graphics Programmers

Practical Techniques for Ray Tracing in Games. Gareth Morgan (Imagination Technologies) Aras Pranckevičius (Unity Technologies) March, 2014

Building scalable 3D applications. Ville Miettinen Hybrid Graphics

Computer Graphics Shadow Algorithms

Computer Graphics. Shadows

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Real-Time Universal Capture Facial Animation with GPU Skin Rendering

Graphics Performance Optimisation. John Spitzer Director of European Developer Technology

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Hidden Surfaces II. Week 9, Mon Mar 15

Many rendering scenarios, such as battle scenes or urban environments, require rendering of large numbers of autonomous characters.

The Traditional Graphics Pipeline

rendering rasterization based rendering pipelined architecture, parallel mostly triangles (lines and points possible too)

Interactive Cloth Simulation. Matthias Wloka NVIDIA Corporation

CS4620/5620: Lecture 14 Pipeline

Rendering Structures Analyzing modern rendering on mobile

Resistance: Fall of Man. Insomniac Games

Bringing AAA graphics to mobile platforms. Niklas Smedberg Senior Engine Programmer, Epic Games

Computer Graphics 10 - Shadows

Ultimate Graphics Performance for DirectX 10 Hardware

Chapter 10 Computation Culling with Explicit Early-Z and Dynamic Flow Control

Profiling and Debugging Games on Mobile Platforms

CEng 477 Introduction to Computer Graphics Fall 2007

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

Topics and things to know about them:

Computer Graphics I Lecture 11

Rendering 13 Deferred Shading

Deferred Splatting. Gaël GUENNEBAUD Loïc BARTHE Mathias PAULIN IRIT UPS CNRS TOULOUSE FRANCE.

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Optimizing Mobile Games with Gameloft and ARM

Graphics and Interaction Rendering pipeline & object modelling

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

3D Authoring Tool BS Content Studio supports Deferred Rendering for improved visual quality

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

Lighting Killzone : Shadow Fall

LOD and Occlusion Christian Miller CS Fall 2011

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

The Traditional Graphics Pipeline

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

CS 130 Final. Fall 2015

Photorealism: Ray Tracing

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014

Ray Tracer Due date: April 27, 2011

Mali Demos: Behind the Pixels. Stacy Smith

Rendering Grass with Instancing in DirectX* 10

Synthesis of Textures with Intricate Geometries using BTF and Large Number of Textured Micropolygons. Abstract. 2. Related studies. 1.

3D Rendering Pipeline

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

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Acknowledgement: Images and many slides from presentations by Mark J. Kilgard and other Nvidia folks, from slides on developer.nvidia.

Point based global illumination is now a standard tool for film quality renderers. Since it started out as a real time technique it is only natural

CHAPTER 1 Graphics Systems and Models 3

Mattan Erez. The University of Texas at Austin

Transcription:

Deferred Rendering in Killzone 2 Michal Valient Senior Programmer, Guerrilla

Talk Outline Forward & Deferred Rendering Overview G-Buffer Layout Shader Creation Deferred Rendering in Detail Rendering Passes Light and Shadows Post-Processing SPU Usage / Architecture

Forward & Deferred Rendering Overview

Forward Rendering Single Pass For each object Find all lights affecting object Render all lighting and material in a single shader Shader combinations explosion Shader for each material vs. light setup combination All shadow maps have to be in memory Wasted shader cycles Invisible surfaces / overdraw Triangles outside light influence

Forward Rendering Multi-Pass For each light For each object Add lighting from single light to frame buffer Shader for each material and light type Wasted shader cycles Invisible surfaces / overdraw Triangles outside light influence Lots of repeated work Full vertex shaders, texture filtering

Deferred Rendering For each object Render surface properties into the G-Buffer For each light and lit pixel Use G-Buffer to compute lighting Add result to frame buffer Simpler shaders Scales well with number of lit pixels Does not handle transparent objects

G-Buffer Layout

Target Image

Depth

View-space normal

Specular intensity

Specular roughness / Power

Screen-space 2D motion vector

Albedo (texture colour)

Deferred composition

Image with post-processing (depth of field, bloom, motion blur, colorize, ILR)

G-Buffer : Our approach R8 G8 B8 A8 Depth 24bpp Stencil Lighting Accumulation RGB Intensity Normal X (FP16) Normal Y (FP16) Motion Vectors XY Spec-Power Spec-Intensity Diffuse Albedo RGB Sun-Occlusion DS RT0 RT1 RT2 RT3 MRT - 4xRGBA8 + 24D8S (approx 36 MB) 720p with Quincunx MSAA Position computed from depth buffer and pixel coordinates

G-Buffer : Our approach R8 G8 B8 A8 Depth 24bpp Stencil Lighting Accumulation RGB Intensity Normal X (FP16) Normal Y (FP16) Motion Vectors XY Spec-Power Spec-Intensity Diffuse Albedo RGB Sun-Occlusion DS RT0 RT1 RT2 RT3 Lighting accumulation output buffer Intensity luminance of Lighting accumulation Scaled to range [0 2] Normal.z = sqrt(1.0f - Normal.x 2 - Normal.y 2 )

G-Buffer : Our approach R8 G8 B8 A8 Depth 24bpp Lighting Accumulation RGB Normal X (FP16) Normal Y (FP16) Stencil Intensity DS RT0 RT1 Motion Vectors XY Spec-Power Spec-Intensity RT2 Diffuse Albedo RGB Motion vectors screen space Specular power - stored as log2(original)/10.5 Sun-Occlusion RT3 High range and still high precision for low shininess Sun Occlusion - pre-rendered static sun shadows Mixed with real-time sun shadow for higher quality

G-Buffer Analysis Pros: Highly packed data structure Many extra attributes Allows MSAA with hardware support Cons: Limited output precision and dynamic range Lighting accumulation in gamma space Can use different color space (LogLuv) Attribute packing and unpacking overhead

Deferred Rendering Passes

Geometry Pass Fill the G-Buffer with all geometry (static, skinned, etc.) Write depth, motion, specular, etc. properties Initialize light accumulation buffer with pre-baked light Ambient, Incandescence, Constant specular Lightmaps on static geometry YUV color space, S3TC5 with Y in Alpha Sun occlusion in B channel Dynamic range [0..2] Image based lighting on dynamic geometry

Image Based Lighting Artist placed light probes Arbitrary location and density Sampled and stored as 2 nd order spherical harmonics Updated per frame for each object Blend four closest SHs based on distance Rotate into view space Encode into 8x8 envmap IBL texture Dynamic range [0..2] Generated on SPUs in parallel to other rendering tasks

Scene lighting

Decals and Weapon Passes Primitives updating subset of the G-Buffer Bullet holes, posters, cracks, stains Reuse lighting of underlying surface Blend with albedo buffer Use G-Buffer Intensity channel to fix accumulation Same principle as particles with motion blur Separate weapon pass with different projection Different near plane Rendered into first 5% of depth buffer range Still reacts to lights and post-processing

Light Accumulation Pass Light is rendered as convex geometry Point light sphere Spot light cone Sun full-screen quad For each light Find and mark visible lit pixels If light contributes to screen Render shadow map Shade lit pixels and add to framebuffer

Determine Lit Pixels Marks pixels in front of the far light boundary Render back-faces of light volume Depth test GREATER-EQUAL Write to stencil on depth pass Skipped for very small distant lights

Determine Lit Pixels Find amount of lit pixels inside the volume Start pixel query Render front faces of light volume Depth test LESS-EQUAL Don t write anything only EQUAL stencil test

Render Shadow Map Enable conditional rendering Based on query results from previous stage GPU skips rendering for invisible lights Max 1024x1024xD16 shadow map Fast and with hardware filtering support Single map reused for all lights Skip small objects Small in shadow map and on screen Artist defined thresholds for lights and objects

Shade Lit Pixels Render front-faces of light volume Depth test - LESS-EQUAL Stencil test - EQUAL Runs only on marked pixels inside light Compute light equation Read and unpack G-Buffer attributes Calculate Light vector, Color, Distance Attenuation Perform shadow map filtering Add Phong lighting to frame buffer

Light Optimization Determine light size on the screen Approximation - angular size of light volume If light is very small Don t do any stencil marking Switch to non-shadow casting type Shadows fade-out range Artist defined light sizes at which: Shadows start to fade out Switch to non-shadow casting light

Sun Rendering Full screen quad Stencil mark potentially lit pixels Use only sun occlusion from G-Buffer Run final shader on marked pixels Approx. 50% of pixels skipped thanks 1st pass Also skybox/background Simple directional light model Shadow = min(realtimeshadow, Occlusion)

Sun Real-Time Shadows Cascade shadow maps Provide more shadow detail where required Divide view frustum into several areas Split along view distance Split distances defined by artist Render shadow map for each area Max 4 cascades Max 512x512 pixels each in single texture Easy to address cascade in final render

Sun Real-Time Shadows Issue: Shadow shimmering Light cascade frustums follow camera Sub pixel changes in shadow map Solution! Don t rotate shadow map cascade Make bounding sphere of cascade frustum Use it to generate cascade light matrix Remove sub-pixel movements Project world origin onto shadow map Use it to round light matrix to nearest shadow pixel corner

Sun - Colored shadow Cascades - Unstable shadow artifacts

MSAA Lighting Details Run light shader at pixel resolution Read G-Buffer for both pixel samples Compute lighting for both samples Average results and add to frame buffer Optimization in shadow map filtering Max 12 shadow taps per pixel Alternate taps between both samples Half quality on edges, full quality elsewhere Performance equal to non-msaa case

Forward Rendering Pass Used for transparent geometry Single pass solution Shader has four uberlights No shadows Per-vertex lighting version for particles Lower resolution rendering available Fill-rate intensive effects Half and quarter screen size rendering Half resolution rendering using MSAA HW

Post-Processing Pass Highly customizable color correction Separate curves for shadows, mid-tones, highlight colors, contrast and brightness Everything Depth dependent Per-frame LUT textures generated on SPU Image based motion blur and depth of field Internal lens reflection Film grain filter

SPU Usage and Architecture Putting it all together

SPU Usage We use SPU a lot during rendering Display list generation Main display list Lights and Shadow Maps Forward rendering Scene graph traversal / visibility culling Skinning Triangle trimming IBL generation Particles

SPU Usage (cont.) Everything is data driven No virtual void Draw() calls on objects Objects store a decision-tree with DrawParts DrawParts link shader, geometry and flags Decision tree used for LODs, etc. SPUs pull rendering data directly from objects Traverse scenegraph to find objects Process object's decision-tree to find DrawParts Create displaylist from DrawParts

SPU Architecture PPU SPU 0 SPU 1 SPU 2 SPU 3 Particles, Skinning edgegeom Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generation

SPU Architecture GAME, AI PHYSICS PPU SPU 0 SPU 1 SPU 2 SPU 3 Particles, Skinning edgegeom Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generation

SPU Architecture GAME, AI PHYSICS PREPARE DRAW PPU SPU 0 SPU 1 SPU 2 SPU 3 Particles, Skinning edgegeom Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generation

SPU Architecture GAME, AI PHYSICS PREPARE DRAW PPU SPU 0 SPU 1 SPU 2 SPU 3 Particles, Skinning edgegeom Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generation

SPU Architecture GAME, AI PHYSICS PREPARE DRAW PPU SPU 0 SPU 1 SPU 2 SPU 3 Particles, Skinning edgegeom Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generation

SPU Architecture GAME, AI PHYSICS PREPARE DRAW PPU SPU 0 SPU 1 SPU 2 SPU 3 Particles, Skinning edgegeom Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generation

SPU Architecture GAME, AI PHYSICS PREPARE DRAW PPU SPU 0 SPU 1 SPU 2 SPU 3 Particles, Skinning edgegeom Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generation

SPU Architecture GAME, AI PHYSICS PREPARE DRAW DRAW DATA LOCK GAME, AI PHYSICS PREPARE DRAW PPU SPU 0 SPU 1 SPU 2 SPU 3 Particles, Skinning edgegeom Main scenegraph + displaylist Shadow scenegraph + displaylist IBL generation

Conclusion Deferred rendering works well and gives us artistic freedom to create distinctive Killzone look MSAA did not prove to be an issue Complex geometry with no resubmit Highly dynamic lighting in environments Extensive post-process Still a lot of features planned Ambient occlusion / contact shadows Shadows on transparent geometry More efficient anti-aliasing Dynamic radiosity