Renderer Design for Multiple Lights

Slides:



Advertisements
Similar presentations
Destruction Masking in Frostbite 2 using Volume Distance Fields
Advertisements

Exploration of advanced lighting and shading techniques
Deferred Shading Optimizations
An Optimized Soft Shadow Volume Algorithm with Real-Time Performance Ulf Assarsson 1, Michael Dougherty 2, Michael Mounier 2, and Tomas Akenine-Möller.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Light Pre-Pass -Deferred Lighting: Latest Development-
Game Programming 09 OGRE3D Lighting/shadow in Action
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.
Building a Dynamic Lighting Engine for Velvet Assassin Christian Schüler.
Pre-lighting in Resistance 2
Renderer Design for Multiple Lights by Wolfgang Engel 05/27/08.
Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based.
I3D Fast Non-Linear Projections using Graphics Hardware Jean-Dominique Gascuel, Nicolas Holzschuch, Gabriel Fournier, Bernard Péroche I3D 2008.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
4.2. D EFERRED S HADING Exploration of deferred shading (rendering)
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
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.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CSE 381 – Advanced Game Programming Basic 3D Graphics
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Visual quality techniques.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Fast Cascade VSM By Zhang Jian.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
SIGGRAPH 2010 Course: Physically Based Shading Models in Film and Game Production SIGGRAPH 2010 Physically Based Shading Models in Film and Game Production.
Stencil Routed A-Buffer
- Laboratoire d'InfoRmatique en Image et Systèmes d'information
Emerging Technologies for Games Deferred Rendering CO3303 Week 22.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Single Pass Point Rendering and Transparent Shading Paper by Yanci Zhang and Renato Pajarola Presentation by Harmen de Weerd and Hedde Bosman.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
CSCE 441: Computer Graphics Ray Tracing
From Turing Machine to Global Illumination Chun-Fa Chang National Taiwan Normal University.
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.
Postmortem: Deferred Shading in Tabula Rasa Rusty Koonce NCsoft September 15, 2008.
1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles.
- Introduction - Graphics Pipeline
Discrete Techniques.
Real-Time Soft Shadows with Adaptive Light Source Sampling
© University of Wisconsin, CS559 Spring 2004
Photorealistic Rendering vs. Interactive 3D Graphics
Computer Graphics Chapter 9 Rendering.
Patrick Cozzi University of Pennsylvania CIS Fall 2013
Deferred Lighting.
3D Graphics Rendering PPT By Ricardo Veguilla.
From Turing Machine to Global Illumination
The Graphics Rendering Pipeline
Understanding Theory and application of 3D
Real-Time Volume Graphics [06] Local Volume Illumination
Lighting.
UMBC Graphics for Games
Texture and Shadow Mapping
CS5500 Computer Graphics May 29, 2006
Last Time Presentation of your game and idea Environment mapping
CSCE 441: Computer Graphics Ray Tracing
Frame Buffer Applications
Presentation transcript:

Renderer Design for Multiple Lights by Wolfgang Engel 05/27/08

Agenda What is a Renderer? What does the Renderer do? Z Pre-Pass Renderer Deferred Renderer Light Pre-Pass Renderer Conclusion

What is a Renderer It is the fundament of your game engine The software layer that feeds the graphics card with data

What does the Renderer do? First render phase - Shadow pass: Cascaded Shadows for day light, night-time shadows, cloud shadows, character shadows - Z pre-pass / G-Buffer update / Light Pre-pass Second render phase - Screen-space ambient occlusion / local irradiance Third render phase - In case of a Light Pre-Pass renderer: fill up the light buffer with all light properties - Global Illumination: collects light data - Reflections / refractions / environment reflections Fourth render phase (Opaque objects) - Lighting and rendering the opaque objects with shadow data sorted by shaders and / or front-to-back (also water + refraction map) Fifth render phase - Dynamic sky-dome Sixth render phase (Transparent objects) - Lighting and rendering the transparent objects with shadow data sorted back-to-front + alpha-to-coverage objects - Foliage rendering Seventh render phase (Particles) - Render high-res particles into back-buffer - Render low-res particles into smaller render target - Composite smaller particle render target with main render target Eight render phase - MSAA resolve to a potentially lower-res render target (for certain target platforms) - PostFX (HDR, Depth of Field, Depth Fog, Height-Based fog, motion blur, heat haze, tear gas, drunk-effect Ninth render phase -- Up-scaling of lower res render target (for certain target platforms) -- UI etc.

Z Pre-Pass Renderer Render opaque objects Transparent objects Depth Buffer Z pre-pass Switch off depth write Forward Rendering Sort Front-To-Back Forward Rendering First mentioned by John Carmack [Carmack] Shows phase four and six from the overview above Separate render path for opaque and transparent objects Z Pre-Pass Layout depth data and hardware culling data Utilizes fast double-speed depth writes Forward rendering is the common way to render objects Sort Back-To-Front

Z Pre-Pass Renderer II Multi-Light solutions One render pass per light <-> lots of draw calls Render 4 – 8 lights per drawcall Pixel shader can render e.g. up to eight lights Requires to split up geometry following the amount of lights <-> hardware likes low number of draw calls 2 ½ D light solution with light properties in textures Store light properties in 2D textures Use index texture to index into those light property textures <-> hardware does not like dependent texture reads

Deferred Renderer Normals Specular / Motion Vec Albedo / Shadow Depth Buffer Deferred Lighting Switch off depth write First mentioned in [Deering] Shows phase four and six from the overview above Separate render path for opaque and transparent objects G-Buffer == Multiple-Render Target (Killzone 2) [Valient] Holds material properties: mainly specular and albedo Lighting phase: reads DS, RT1 – RT3 and renders the image per light into RT0 -> renders as often as there are lights Forward Rendering Sort Back-To-Front

Deferred Renderer II Reading the G-Buffer for each light -> lots of memory bandwidth -> solutions: Scissoring out the 3D bounding box volume of the light projected into a 2D rectangle [Placeres] Render for each light convex geometry Point light == sphere; spotlight == cone If camera is inside light volume only render back facing pixels when depth test fails (D3DCMP_GREATER instead of D3DCMP_LESSEQUAL ) [Thibieroz04] Like stencil shadow volumes Like above but increment stencil test When drawing front-facing light volumes set the depth test to D3DCMP_LESSEQUAL and decrement the stencil test when the depth test fails Only light pixels are rendered where the stencil value is greater than or equal to 1 [Hargreaves][Valient]. G-Buffer holds all material properties -> the restricted number of storage space restricts the game to a low variety of materials Hardware MSAA is not available on DX9 PC graphics hardware and quite expensive on XBOX 360 / PS3

Light Pre-Pass Renderer Render opaque objects Transparent objects Normals Depth Buffer Switch off depth write Light Buffer Forward Rendering Sort Front-To-Back Stores normals in a normal buffer and the depth values in a depth buffer Stores light properties in a light buffer -> use same memory bandwidth optimizations as Deferred Renderer Renderes forward while re-constructing the lighting equation Forward Rendering Sort Back-To-Front

Light Pre-Pass Renderer II What are the light properties? Color = Ambient + Shadow * Att * (N.L * DiffColor * DiffIntensity * LightColor + R.V^n * SpecColor * SpecIntensity * LightColor) Properties that depend on the light vector N.L LightColor R.V^n Attenuation Simple Light Pre-Pass LightColor.r * N.L * Att LightColor.g * N.L * Att LightColor.b * N.L * Att R.V^n * N.L * Att Spotlight: Att represents spotlight factor

Light Pre-Pass Renderer III Simple Pre-Pass Renderer does not allow to re-construct the specular term of the lighting equation -> therefore a separate diffuse term need to be stored like this LightColor.r * N.L * Att LightColor.g * N.L * Att LightColor.b * N.L * Att R.V^n * N.L * Att N.L * Att Now we can do (R.V^n * N.L * Att) / (N.L * Att) Each pixel of the light buffer represents the specular term of all light sources Adding a material specular power value can be done like this (R.V^n)^mn Adding a material specular color is done like this (R.V^n)^nm * Spec Thinking of this specular term as an intensity term, we can construct all kind of specular terms and multiply it with it. Fresnel is just N.V in the forward rendering path

Light Pre-Pass Renderer IV Compared to the Z Pre-Pass Renderer Design Less material variety than a Z Pre-Pass renderer Probably consumes more memory bandwidth Needs higher spec graphics hardware It is easier to implement more lights Compared to the Deferred Renderer Design Light Pre-Pass offers more material variety Hardware MSAA is easy to implement Memory bandwidth lower -> reading normal and depth buffer for each light is less than reading the G-Buffer in the Deferred Renderer Cost per light is lower than with a Deferred Renderer -> more lights Easy to implement on low spec graphics hardware with pixel shader model 1.4 and higher

Conclusion If a game requires lots of dynamic lights, a Light Pre-Pass renderer is a good choice to achieve this goal If minimum hardware capabilities are quite low (no programmable pixel shader), the Z Pre-Pass Renderer is better

Thanks wengel@rockstarsandiego.com

References [Bavoil] Louis Bavoil, Kevin Myers, Deferred Rendering using a Stencil Routed K-Buffer, ShaderX6 [Calver] Dean Calver's article in deferred rendering on beyond3d http://www.beyond3d.com/content/articles/19/ [Carmack] John Carmack ?? [Deering] Michael Deering "The triangle processor and normal vector shader: a VLSI system for high performance graphics" SIGGRAPH 1988 [Hargreaves] Shawn Hargreaves, “Deferred Shading”, http://www.talula.demon.co.uk/DeferredShading.pdf [Placeres] Frank Puig Placeres, “Overcoming Deferred Shading Drawbacks”, pp. 115 – 130, ShaderX5 [Thibieroz04] Nick, Thibieroz, “Deferred Shading with Multiple-Render Targets”, pp. 251- 269, ShaderX2 – Shader Programming Tips & Tricks with DirectX9 [Thibieroz07] Nick, Thibieroz, “Robust Order-Independent Transparency via Reverse Depth Peeling in DirectX® 10”, ShaderX6 [Valient] Michal Valient, “Deferred Rendering in Killzone 2”, http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf