Building a Dynamic Lighting Engine for Velvet Assassin Christian Schüler.

Slides:



Advertisements
Similar presentations
Exploration of advanced lighting and shading techniques
Advertisements

Advanced Light and Shadow Culling Methods Eric Lengyel.
Optimized Stencil Shadow Volumes
Graphics Pipeline.
Optimized Stencil Shadow Volumes
GAM532 DPS932 – Week 7 Introduction to shadows. Shadow Effects Light Surface No Shadows Shadows.
Computer graphics & visualization Global Illumination Effects.
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
Photon Mapping. How did I use it 10 years ago? Why might you want to use it tomorrow?
CSE 381 – Advanced Game Programming Scene Management
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
黃聰賢. Light Position Mesh Polygon Shadow Polygon  Clear color buffer and stencil buffer  Render the scene with ambient only.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
1 Advanced Scene Management System. 2 A tree-based or graph-based representation is good for 3D data management A tree-based or graph-based representation.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
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 Algorithms Ikrima Elhassan.
Ray Tracing and Photon Mapping on GPUs Tim PurcellStanford / NVIDIA.
Lecture 5: 3D Rendering Pipeline (II) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
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.
-Global Illumination Techniques
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Game Engine Jian-Liang Lin ( 林建良 )
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Shadows. Shadows is important in scenes, consolidating spatial relationships “Geometric shadows”: the shape of an area in shadow Early days, just pasted.
Collaborative Visual Computing Lab Department of Computer Science University of Cape Town Graphics Topics in VR By Shaun Nirenstein.
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
3D Game Engine Design 1 3D Game Engine Design Ch D MAP LAB.
- Laboratoire d'InfoRmatique en Image et Systèmes d'information
CSCE 552 Spring D Models By Jijun Tang. Triangles Fundamental primitive of pipelines  Everything else constructed from them  (except lines and.
Emerging Technologies for Games Deferred Rendering CO3303 Week 22.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
Pure Path Tracing: the Good and the Bad Path tracing concentrates on important paths only –Those that hit the eye –Those from bright emitters/reflectors.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Maths & Technologies for Games Spatial Partitioning 2
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Stencil Shadows Garrett Weng. What are stencil shadows? Also known as shadow volumes Relies on use of the stencil buffer Create volumes of the shadows.
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
SHADOW CASTER CULLING FOR EFFICIENT SHADOW MAPPING JIŘÍ BITTNER 1 OLIVER MATTAUSCH 2 ARI SILVENNOINEN 3 MICHAEL WIMMER 2 1 CZECH TECHNICAL UNIVERSITY IN.
1 Geometry for Game. Geometry Geometry –Position / vertex normals / vertex colors / texture coordinates Topology Topology –Primitive »Lines / triangles.
Basic Ray Tracing CMSC 435/634.
Scene Manager Creates and places movable objects like lights and cameras so as to access them efficiently, e.g. for rendering. Loads and assembles world.
Bounding Volume Hierarchies and Spatial Partitioning
Bounding Volume Hierarchies and Spatial Partitioning
3D Graphics Rendering PPT By Ricardo Veguilla.
Understanding Theory and application of 3D
© University of Wisconsin, CS559 Fall 2004
CSCE 441: Computer Graphics Hidden Surface Removal
Chapter 6.6 Lighting.
UMBC Graphics for Games
A Hierarchical Shadow Volume Algorithm
Presentation transcript:

Building a Dynamic Lighting Engine for Velvet Assassin Christian Schüler

Velvet Assassin  3rd person stealth game  Formerly known as “Sabotage 1943”  First concepts: late 2000  Release: April 2009  Platforms PC, X360 My role: tech. dir. plus lead engine programmer

Engine Goals  Must look great!  (of course)  Everything is dynamically lit  Cannot use Lightmaps  Lighting is part of gameplay  If it looks dark, the player should be hidden!  Light sources become game entites.

Engine Goals? So, what about...  … scene visibility  … light influence  … indirect lighting (like radiosity) … if every object can possibly move, even light sources?

First Engine (2003)

Axioms (2003)  World is a loose octree of objects  Objects are OBB trees of triangles  Multi-pass lighting with stencil shadows  Occlusion culling for visibility  Indirect illumination via bounce lights

Shipping Engine (2009)

Axioms (2009)  World is a loose octree of objects  Objects are OBB trees of triangles  Hybrid single/multi-pass lighting with shadow maps  Portals for visibility  Indirect illumination via bounce lights + XBox 360 specific optimizations

Loose Octrees Thatcher Ulrich (2001):  Cells are overlapping (loose)  Insertion is efficient  No need to rebuild the whole octree if an element moves!  Perfect as spatial index of a dynamic scene!

Loose Octrees contd. Base cell Extended volume

Loose Octrees contd. Object inserted if inside extended volume  O(1) insertion

Loose Octrees contd. Used in finding out  Objects in a view frustum  Objects influenced by a light  Lights influencing an object  Broad phase for ray tests  Gameplay objects in range And everything can be dynamic!

OBB Trees Oriented Bounding Box Tree S. Gottschalk et al (1995)  Used on the polygon level  Build as a pre-process over mesh data  Allows efficient ray-mesh and mesh-mesh interference tests

OBB Trees contd. Axis aligned … … vs oriented!

OBB Trees contd. Construction: Principal axes (gaussian point distribution)* Minimize Box volume (possibly iterative) *eigenvectors of covariance matrix

Hybrid Lighting A hybrid between multi-pass and single-pass forward renderer:  One pass for each primary light  One pass for all secondary lights combined

Hybrid Lighting contd. Primary lights  Classic multi-pass (Doom 3 style)  One pass per primary light  Can cast shadows  The light queries for surrounding geometry

Hybrid Lighting contd. Secondary lights  Classic single-pass (HL2 style)  Lights collected into one pass  (shader variation based on count)  Can not cast shadows  The geometry queries for surrounding lights  (up to a maximum amount)

Hybrid Lighting contd. primary spot secondary points

Hybrid Lighting contd. primary directional secondary points

Bounce Light axis N L (NL) · f(axisL) Gives appearance of first bounce indirect light from a surface. Must not illuminate the surface it is placed on. Has a half-sphere influence radius determined by axis.

Bounce Light contd. primary spot secondary bounce

Bounce Light contd. primary spot 2 secondary ambients

Bounce Light contd.... and even back in 2003 (it‘s not rocket science)

So, for each frame … 1. Get all primary lights in view 2. Distribute shadow map pool 3. Render shadow maps, for each:  Render all objects contained in light frustum  Get all objects in view  Render base pass  For each object, collect nearest N secondary lights (sorted by importance) for the shader  Render additive passes for each …  … primary light: for each object that is in the view and also in the light frustum. That is why you need an efficient spatial index data structure.

Fog Zones A.k.a.: There has to be at least one benefit for manual portalization! Here it is: Fog Zones!

Fog Zones contd. portal separates fog environments

Fog Zones contd. … from the other side

Fog Zones contd. Multiply-Add is your friend! (instead of lerping against a constant fog color) C = C 0 ∙ T + S C 0 original color Tfog transmittance Sfog in-scatter = (1−T) ∙ C Fog traditionally

Fog Zones contd. C = ( C 0 ∙ T B + S B ) ∙ T A + S A AB portal C = C 0 ∙ ( T B ∙ T A ) + ( S B ∙ T A + S A )

Fog Zones contd.  Modify T and S of the new environment with T and S from the portal polygon  Calculate fog from the distance of the portal  Repeat recusively

Fill Optimization  Only done for XBox 360  Selected particle effects rendered into off-screen render target at half resolution to save fill rate  (against half resolution depth buffer)  Composited over the final image

Fill Optimization contd.

Again, multiply-add solves the math (in the form of pre-multiplied alpha) Off-screen target: C Target ’ = (1−A Particle ) · C Target + C Particle A Target ’ = (1−A Particle ) · A Target + A Particle Compositing: C Frame ’ = (1−A Target ) · C Frame + C Target

Multi-threading  XBox 360 needed it; a dual-core PC at least benefits  First thread performs all spatial queries and compiles a “drawlist”  Second thread sets shader registers, render states and submits batches  Most scenes from 300 to 1200 batches/frame

The End Questions?