“A bit more Deferred” - CryEngine 3

Slides:



Advertisements
Similar presentations
A Real Time Radiosity Architecture for Video Games
Advertisements

Destruction Masking in Frostbite 2 using Volume Distance Fields
Introduction to Direct3D 10 Course Porting Game Engines to Direct3D 10: Crysis / CryEngine2 Carsten Wenzel.
Finding Next Gen CryEngine2
Go Parallel – Multicore Programming & Game Development The Importance of Multi-Core for Game Development at Crytek Martin Mittring Lead Graphics Programmer.

Exploration of advanced lighting and shading techniques
POST-PROCESSING SET09115 Intro Graphics Programming.
Deferred Shading Optimizations
Cs /11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
Sven Woop Computer Graphics Lab Saarland University
Dynamic Sky Dome GDC March 2nd, 2011 by Igor Lobanchikov
Solving Some Common Problems in a Modern Deferred Rendering Engine
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Light Pre-Pass -Deferred Lighting: Latest Development-
Graphics Pipeline.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
Graphics Hardware CMSC 435/634. Transform Shade Clip Project Rasterize Texture Z-buffer Interpolate Vertex Fragment Triangle A Graphics Pipeline.
ADVANCED SKIN SHADING WITH FACEWORKS Nathan Reed — NVIDIA March 24, 2014.
The Art and Technology Behind Bioshock’s Special Effects
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Pre-lighting in Resistance 2
Renderer Design for Multiple Lights by Wolfgang Engel 05/27/08.
Deferred Shading Patrick Cozzi University of Pennsylvania CIS Fall 2014.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
Computer Graphics Hardware Acceleration for Embedded Level Systems Brian Murray
(conventional Cartesian reference system)
3D Graphics Processor Architecture Victor Moya. PhD Project Research on architecture improvements for future Graphic Processor Units (GPUs). Research.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
Status – Week 277 Victor Moya.
GPUGI: Global Illumination Effects on the GPU
02/04/03 Page 1 Rendering Visibility Lighting Texturing.
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
Shadow No, not the Hank Marvin kind!. Go to: ows.html ows.html.
Ray Tracing and Photon Mapping on GPUs Tim PurcellStanford / NVIDIA.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Today More raytracing stuff –Soft shadows and anti-aliasing More rendering methods –The text book is good on this –I’ll be using images from the CDROM.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
4.1. R ENDERING Aspects of Game Rendering. From Wikipedia: Rendering is the process of generating an image from a model. The model is a description.
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
- Laboratoire d'InfoRmatique en Image et Systèmes d'information
Emerging Technologies for Games Deferred Rendering CO3303 Week 22.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
VLF Rendering & Implementation Details Virtual Light Field Group University College London GR/R13685/01 Research funded by: Jesper.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
Parallel Lighting Directional Lighting Distant Lighting (take your pick) Paul Taylor 2010.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Ambient Occlusion Patrick Cozzi University of Pennsylvania CIS Fall 2013.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles.
Aspects of Game Rendering
Patrick Cozzi University of Pennsylvania CIS Fall 2013
Renderer Design for Multiple Lights
Deferred Lighting.
The Graphics Rendering Pipeline
Understanding Theory and application of 3D
(c) 2002 University of Wisconsin
UMBC Graphics for Games
(c) 2002 University of Wisconsin
Selective material rendering
Patrick Cozzi University of Pennsylvania CIS Fall 2012
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Frame Buffer Applications
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

“A bit more Deferred” - CryEngine 3 “A bit more Deferred” – Deferred in the way of using the so called “deferred rendering” techniques Triangle Game Conference 2009 Martin Mittring – Lead Graphics Programmer

Crytek Main office: Germany Frankfurt More studios: Kiev, Budapest, Sofia, Nottingham, Seoul English as company language 30+ nationalities CryEngine 1: PC only (Far Cry …) CryEngine 2: PC only (Crysis …) CryEngine 3: PC, XBox360, PS3 (announced GDC09)

32/64 Bit, WinXP/Vista, DX9/10, Multi CPU/GPU WYSIWYP ResourceCompiler Source asset -> Platform specific Direct Light: Shadow mapping Indirect Light (AO): SSAO / RAM / ... No precomputed lighting Production time saver, Memory, Consistency, Dynamic content Übershaders WYSIWYP: What You See Is What You Play SSAO: Screen Space Ambient Occlusion [Mittring07]

Goals after CryEngine 2 PS3 / XBox360 GPU, CPU, memory Improve streaming Improve multithreading Improve lighting More predictable performance Tackle the shader combination issue

What is the shader combination issue? Übershader is one shader with many features (e.g. 0..4 lights, light types, CM reflection, fog, detail texture, normalmap, specular texture) Compiling all possible permutations is a memory, production and performance problem Usual solutions: dynamic branching / separating into multiple passes / reducing combinations and accepting less functionality and less performance Asynchronous shader compiling Distributed Job System to compile the shader cache Millions of combinations We did all of the usual solutions but wanted to do better

Why Deferred Rendering? Rendering is a multi-dimensional query: View x Geometry x Material x Light Classic Forward Rendering: for each light render geometry from scene query with shader Classic Deferred Rendering: render geometry from scene query outputting GBuffer render each light from scene query and shade with GBuffer => Decouples geometric complexity from lighting and shading => Helps on shader combination issue and predictable performance

GBuffer in CryEngine 2 Minimal GBuffer (depth) Z Minimal GBuffer (depth) Slower Early Z pass when outputting linear depth Formats: R16 R16G16 R32 Proved to be very useful

Deferred in CryEngine 2 Main use: Deferred shadows, Per pixel fog Additionally: Soft Z clipped Particles, Motion Blur, Beach/Ocean, EdgeAA, Sun Rays, SSAO, Fake lights, 2.5D TerrainAO SSAO ShadowMask

Deferred Lighting in CryEngine 3 Z (native) Normal Specular Power Passes: 1) Forward GBuffer generation 2) Deferred light accumulation into texture (Phong) 3) Forward shading with light accumulation texture => No deferred shading Deferred Lighting* + Multiple light primitives are possible + even Image Based Lighting (IBL) + easy to extend Compared to Deferred Shading + Less bandwidth and memory problems (10MB EDRAM XBox360) + More flexibility on shading (besides Phong) IBL: Image Based Lighting * [Geldreich09] aka Light Pre-Pass Renderer [Engel08]

Options for the light accumulation texture * sRGB helps to distribute more details in dark areas 6 channels: Diffuse and Specular two 7e3 7e3 7e3, A16R16G16B16f or A8R8G8B8* 4 channels: Diffuse and Specular strength a single A16R16G16B16f or A8R8G8B8* (specular approximated by diffuse*strength) The following pictures show lighting with two differently coloured lights: 6 channels (correct) 4 channels (fast)

Light accumulation texture in IBL The following pictures show lighting with Diffuse and Specular Cubemaps: Diffuse RGB Specular RGB High Quality (left) Diffuse RGB Specular Strength Fast Rendering (right) Difference often neglectable (depends on environment) CM: Cubemap

Storing normals in the GBuffer XYZ world space 8 bit: problematic with extreme reflections/specular 10 bit: good, but what about specular power and PS3 Solving Quantization Artefacts Detail Normalmaps, Noise, Dither XY view space (Z reconstruct) 8/10/16 bit, negate Z bit (perspective and normal mapping) XY view space: z = z_sign * sqrt(1-x*x-y*y) Near z=0 the precision gets quite bad => Problematic [Lee09] [Lob09]

Alternative: VS Normal in 2 scalars -1..1 => -1..1 Normal to GBufffer: G=normalize(N.xy)*sqrt(N.z*0.5+0.5) GBuffer to Normal: N.z=length2(G.xy)*2-1 N.xy=normalize(G.xy)*sqrt(1-N.z*N.z) + more precision where it matters (bright part) + framebuffer blending friendly + no z reconstruction issues wasted area more ALU than WS VS: view space (z -1 means pointing towards the viewer) WS: world space ALU arithmetic instructions Lerp: => still, WS normals are faster

Improved SSAO (with normals) SSAO: Screen Space Ambient Occlusion Video Improved SSAO (with normals)

Light rasterization in 2D (Rectangle) or 3D (Convex Object) + cheap WS position reconstruction (Interpolator+MAD) + Combining multiple lights Stencil prepass (if not fullscreen) Coarse blocks can be rejected based on z min/max 3D + Z buffer + tighter bounding object (less pixels to process) Depth bounds test (only on some HW)

Deferred Light Types 1/3: Directional light optional with cloud shadows, multiple shadowmaps Point/Projector lights optional with projector texture Procedural Caustics (before this was multi-pass, one drawcall for each object under water including terrain) Interleaved Shadowmap lookups no extra memory less bandwidth needed no limits on shadow mask channel count

Deferred Light Types 2/3: Image Based Lighting (IBL) Light Probes are the high quality solution for distant light Cubemaps allow efficient HDR lighting in real-time Diffuse CM can be computed from specular CM Mip adjusted lookup allows different specular power values Improves shading in ambient lighting condition by adding normal dependent and specular lighting Light Probes can be generated at specified level positions Deferred Lighting allows blending of localized Light Probes Looks even better with SSAO specular effects = view dependent lighting

Ambient without SSAO with hemispherical lighting Maximum boring hemispherical lighting: normals facing upside are slightly brighter shaded in ambient Ambient without SSAO with hemispherical lighting

Black ambient Shadow casting light source SSAO Bright ambient SSAO Black ambient Shadow casting light source SSAO Hemispherical () Grey ambient (hemispherical) Shadow casting light source SSAO IBL ambient (Specular and Diffuse) Shadow casting light source SSAO

IBL ambient (Specular and Diffuse) SSAO * brightened up for better display Video IBL ambient (Specular and Diffuse) SSAO

Deferred Light Types 3/3: Real-time Dynamic Global Illumination Details will be presented at upcoming Siggraph 2009 by Anton Kaplanyan who developed that at Crytek Implemented and fast on XBox360, PS3 and PC No precomputation Fully dynamic (geometry, materials and lights) Unified for static and dynamic objects

Global Illumination off black ambient (to emphasize where GI affects the image) color bleeding bump without light fully dynamic real-time Global Illumination on

* brightened up for better display Global Illumination

Something missing? Transparency => falling back to well known techniques: Per pixel global fog and fog volumes (deferred) Back to front sorted alpha transparent objects Volume texture clouds, Imposter clouds, Distance clouds Particle systems avoiding per particle sorting Anti-aliasing => Nasty but possible EdgeAA, … ... we work on it

References [Mittring07] “Finding Next Gen CryEngine2“ Siggraph 2007, Martin Mittring http://ati.amd.com/developer/gdc/2007/mittring-finding_nextgen_cryengine2(siggraph07).pdf [Engel08] “The Light Pre-Pass Renderer“ ShaderX7, Wolfgang Engel http://diaryofagraphicsprogrammer.blogspot.com/2008/03/light-pre-pass-renderer.html [Lee09a] “Prelighting“ Mark Lee http://www.insomniacgames.com/tech/articles/0209/files/prelighting.pdf [Lee09b] “Pre-lighting in Resistance 2“ GDC 2009, Mark Lee http://www.gdconf.com/conference/Tutorial%20Handouts/200_insomniac/gdc09_insomniac_prelighting.pdf [Geldreich09] ”Deferred Lighting and Shading” GDC 2009, Rich Geldreich, Matt Pritchard, John Brooks http://archive.gdconf.com/gdc_2004/pritchard_matt.ppt [Shish05] “Deferred Shading in S.T.A.L.K.E.R.“ GPU Gems 2, Oles Shishkovtsov http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter09.html [Lob09] S.T.A.L.K.E.R : Clear Sky – a showcase for Direct3D 10.0/1 GDC 2009, Igor A. Lobanchikov, Holger Gruen http://www.gdconf.com/conference/Tutorial%20Handouts/100_Advanced%20Visual%20Effects%20with%20Direct3D/100_Handout%202.pdf [Valient07] “Deferred Rendering in Killzone 2“ Develop Conference 2007, Michal Valient http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf Link to the slides might change Slides should be soon at http://www.crytek.com/technology/presentations Special thanks to all the passionate people at Crytek