Parallel Lighting Directional Lighting Distant Lighting (take your pick) Paul Taylor 2010.

Slides:



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

Exploration of advanced lighting and shading techniques
Deferred Shading Optimizations
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
COMPUTER GRAPHICS CS 482 – FALL 2014 NOVEMBER 10, 2014 GRAPHICS HARDWARE GRAPHICS PROCESSING UNITS PARALLELISM.
Solving Some Common Problems in a Modern Deferred Rendering Engine
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
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
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading.
The Art and Technology Behind Bioshock’s Special Effects
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.
Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based.
1Notes  Assignment 1 is out, due October 12  Inverse Kinematics  Evaluating Catmull-Rom splines for motion curves  Wednesday: may be late (will get.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
1 CSCE 641: Computer Graphics Lighting Jinxiang Chai.
Status – Week 277 Victor Moya.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Course Website: Computer Graphics 16: Illumination.
4.2. D EFERRED S HADING Exploration of deferred shading (rendering)
Advanced Computer Graphics Bas Zalmstra Marries van de Hoef Tim de Jager.
SET09115 Intro Graphics Programming
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.
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.
Lecture 3 : Direct Volume Rendering Bong-Soo Sohn School of Computer Science and Engineering Chung-Ang University Acknowledgement : Han-Wei Shen Lecture.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
-Global Illumination Techniques
TERRAIN SET09115 Intro to Graphics Programming. Breakdown  Basics  What do we mean by terrain?  How terrain rendering works  Generating terrain 
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Week 6 - Wednesday.  What did we talk about last time?  Light  Material  Sensors.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Multi-pass Rendering. © 2002 James K. Hahn, N.H. Baek2 Multi-pass Rendering Repeat: image  Rendering pass  result imageRepeat: image  Rendering pass.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
CSE 381 – Advanced Game Programming GLSL Lighting.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
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.
Emerging Technologies for Games Deferred Rendering CO3303 Week 22.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Current Student – University of Wisconsin – Stout Applied Mathematics and Computer Science: Software Development Associate Degree in Computer Programming.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
CSE 681 Introduction to Ray Tracing. CSE 681 Ray Tracing Shoot a ray through each pixel; Find first object intersected by ray. Image plane Eye Compute.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
1cs426-winter-2008 Notes. 2 Atop operation  Image 1 “atop” image 2  Assume independence of sub-pixel structure So for each final pixel, a fraction alpha.
Computer Graphics: Illumination
Reflective Shadow Mapping By: Mitchell Allen.
Photorealistic Rendering vs. Interactive 3D Graphics
Patrick Cozzi University of Pennsylvania CIS Fall 2013
Renderer Design for Multiple Lights
Deferred Lighting.
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
Lighting.
UMBC Graphics for Games
Texture and Shadow Mapping
CS5500 Computer Graphics May 29, 2006
RADEON™ 9700 Architecture and 3D Performance
Frame Buffer Applications
Presentation transcript:

Parallel Lighting Directional Lighting Distant Lighting (take your pick) Paul Taylor 2010

Simulation of the Sun, Moon and other big fat distant light sources g.html

We must know the direction The position is NOT relevant, as we can assume the surface is precisely  meters away

But it’s Similar to diffuse and Specular Yes it is We are not concerned with where the light comes from, only its direction. Diffuse light can utilise attenuation, it’s a waste on a parallel light

Dividing light sources into four groups Ambient Lights Parallel Lights Point Lights Spot Lights

Dividing light sources into four groups Ambient Lights – You’re good with this! – We only need one ambient source to use on all our surfaces

Dividing light sources into four groups Parallel Lights – We don’t calculate the light direction – This is provided by the light – Both Specular and diffuse light are easily performed Point Lights – We always recalculate the light direction, as it changes quickly with position – For this we must have the light location – Attenuation is also valuable (we cover this next)

Dividing light sources into four groups Spot Lights – These are the ugly ones – We need both the light direction and position – Multiple forms of attenuation Light distance Angle from Light Direction – A very similar calculation to Specular Reflection (except the light vector is reversed) Angle from Surface Normal

The last Complication: A Shader Based on Light Type We will need four helper functions, and call each based on the type of light present So: If light is Parallel Parallel(....) Else if (....).... Then add Ambient

That’s the last evil lighting function Now we need to start creating some lighting finesse....

Basic Lighting Pixel Shader in HLSL FX Take in Vertex Compute WVP and W coordinates For Each Light; Select Type; Call Function Parallel Use Dir Calculate Reflection Point Calculate Dir Calculate Reflection Calculate Dist Attenuation Spotlight Calculate Dir Calculate Reflection Calculate Dist Attenuation Calculate Cone Attenuation Add Ambient Light Factor Pixel Colour Out

Attenuation In the real world: I(d) = I 0 / d 2 This would be great.... If we had realistic surfaces and light sources But we don’t, so we have to fake it yet again

Virtual Attenuation I(d) = I 0 / a 0 + a 1 d+ a 2 d 2 This equation can mimik real attenuation a 0 = 0, a 1 = 0, a 2 = 1.0

Virtual Attenuation Graphs

Range One extra variable that cuts the light regardless of attenuation This can help reduce the shader workload – Can also be used to create a bounding volume for dynamic lighting calculations You could also create a strange / sudden effect

The End

Deferred Lighting Subset of a presentation on the AGT forum. – All about handling dynamic lighting Stolen from: ons/siggraph/Engel/LightPrePass.ppt

Rendering Many Lights History Forward / Z Pre-Pass rendering – Re-render geometry for each light -> lots of geometry throughput (still an option on older hardware) – Write pixel shader with four or eight lights -> draw lights per-object -> need to split up geometry following light distribution – Store light properties in textures and index into this texture -> dependent texture look-up and lights are not fully dynamic

Killzone 2 Deferred Shading / Rendering Split up rendering into a geometry pass and a lighting pass -> makes lights independent from geometry Geometry pass stores all material and light properties Killzone 2’s G-Buffer Layout (courtesy of Michal Valient)

Rendering Many Lights History Deferred Shading / Rendering Depth Buffer Deferred Lighting Forward Rendering Switch off depth write Specular / Motion Vec Normals Albedo / Shadow Sort Back-To-Front Render opaque objectsTransparent objects

Rendering Many Lights History Advantages: – Only one geometry pass for the main view (probably more than a dozen for other views like shadows, reflections, transparent objects etc.) – Lights are blit and therefore only limited by memory bandwidth Disadvantages: – Memory bandwidth (reading four render targets for each light) – Recalculate full lighting equation for every light – Limited material representation in G-Buffer – MSAA difficult compared to Forward Renderer

Light Pre-Pass Light Pre-Pass / Deferred Lighting

2 Versions of Lighting Pre-Pass V1 – Geometry – Light – Geometry V2 – Geometry – Light – Ambient + MSAA (Multi Sample AA)

Light Pre-Pass Version A: – Geometry pass: fill up normal and depth buffer – Lighting pass: store light properties in light buffer – 2. Geometry pass: fetch light buffer and apply different material terms per surface by re- constructing the lighting equation

Light Pre-Pass Version B (similar to S.T.A.L.K.E.R: Clear Skies [Lobanchikov]): – Geometry pass: fill up normal + spec. power and depth buffer and a color buffer for the ambient pass – Lighting pass: store light properties in light buffer – Ambient + Resolve (MSAA) pass: fetch light buffer use its content as diffuse and specular content and add the ambient term while resolving into the main buffer

The lighting is done using 4x quad buffers, instead of the full accuracy 6x quad buffers

Light Pre-Pass CryEngine 3: On the right the approx. specular term of the light buffer and on the left a correct specular term with its own specular color (courtesy of Martin Mittring)

Light Pre-Pass CryEngine 3: On the right the approx. specular term of the light buffer and on the left the final image (courtesy of Martin Mittring)

3 Different Optimisations Dx9 Dx10 PS3

Light Pre-Pass Implementation Memory Bandwidth Optimizations (DirectX 9) – Depth-fail Stencil lights: render light volume in stencil and then blit light [Hargreaves][Valient] – Geometry lights: render bounding geometry -> never get inside light -> avoid depth func change [Thibieroz04] – Scissor lights: construct scissor rectangle from bounding volume and set it [Placeres] (PS3: depth bound testing ~ scissor in 3D) – Batched lights: sort lights by size, x and y position in screenspace. Render close lights in batches of 4, 8, 16 Distance from Camera

Light Pre-Pass Implementation Memory Bandwidth Optimizations (DirectX 10, 10.1, 11) – GS bounding box: construct bounding box in geometry shader – Implement lighting with the compute shader Memory Bandwidth Optimizations (DirectX 8) – Same as DirectX 9 if supported – Re-render geometry per light as alternative

Light Pre-Pass Implementation Memory Bandwidth Optimizations (PS3) 1.Full GPU solution [Lee]: like DirectX9 with depth buffer access and depth bounds testing + batched light support 2.SPE (Synergistic Processing Element) + GPU solution [Palestra] : divide light buffer in tiles: a)Cull tile frustum against light frustum on SPE and keep track of which light goes into which tile b)Render lights in batches per tile on GPU into light buffer 3.Full SPE solution [Swoboda][Tovey]: like 2 a) but render lights in batches on the SPE into the light buffer

Light Pre-Pass Implementation Resistance 2 TM in-game screenshot; first row on the left is the depth buffer, on the right is the normal buffer; in the second row is the diffuse light buffer and on the right is the specular light buffer; in the last row is the final result.

Light Pre-Pass Implementation Uncharted TM in-game screenshot

MSAA Multisample Anti-Aliasing (courtesy of Nicolas Thibieroz)

Future The story of the Light Pre-Pass / Deferred Lighting is still not fully written and there are many things waiting to be discovered in the future …

Future Compute Shader Implementation Johan Andersson, DICE -> check out the Beyond Programmable Shading course

Also: Bungie Publications