COSC 448: REAL-TIME INDIRECT ILLUMINATION

Similar documents
CS354R: Computer Game Technology

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

The Animation Process. Lighting: Illusions of Illumination

GUERRILLA DEVELOP CONFERENCE JULY 07 BRIGHTON

Graphics for VEs. Ruth Aylett

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

Accelerated Ambient Occlusion Using Spatial Subdivision Structures

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

Advanced Computer Graphics CS 563: Screen Space GI Techniques: Real Time

TSBK03 Screen-Space Ambient Occlusion

Shadow Techniques. Sim Dietrich NVIDIA Corporation

Enabling immersive gaming experiences Intro to Ray Tracing

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

03 RENDERING PART TWO

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

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Scalable multi-gpu cloud raytracing with OpenGL

Screen Space Ambient Occlusion. Daniel Kvarfordt & Benjamin Lillandt

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

Here s the general problem we want to solve efficiently: Given a light and a set of pixels in view space, resolve occlusion between each pixel and

NVIDIA Case Studies:

Enhancing Traditional Rasterization Graphics with Ray Tracing. March 2015

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

CSCI 4972/6963 Advanced Computer Graphics Quiz 2 Tuesday April 17, 2007 noon-1:30pm

COM337 COMPUTER GRAPHICS Other Topics

Screen Space Ambient Occlusion TSBK03: Advanced Game Programming

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Interactive Methods in Scientific Visualization

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

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

CS451Real-time Rendering Pipeline

Graphics for VEs. Ruth Aylett

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

Final Project: Real-Time Global Illumination with Radiance Regression Functions

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

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

global light baking software

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

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

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

GLOBAL ILLUMINATION IN UNITY 5

Chapter 7 - Light, Materials, Appearance

Real Time Rendering of Complex Height Maps Walking an infinite realistic landscape By: Jeffrey Riaboy Written 9/7/03

Real-Time Universal Capture Facial Animation with GPU Skin Rendering

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Photorealistic 3D Rendering for VW in Mobile Devices

Computer Graphics and Visualization. What is computer graphics?

CPSC GLOBAL ILLUMINATION

CHAPTER 1 Graphics Systems and Models 3

Motivation. My General Philosophy. Assumptions. Advanced Computer Graphics (Spring 2013) Precomputation-Based Relighting

Lighting & 3D Graphics. Images from 3D Creative Magazine

Hardware Displacement Mapping

There are many kinds of surface shaders, from those that affect basic surface color, to ones that apply bitmap textures and displacement.

Introduction to Visualization and Computer Graphics

Anti-aliasing. Images and Aliasing

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Rasterization Overview

Advanced Graphics. Path Tracing and Photon Mapping Part 2. Path Tracing and Photon Mapping

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

Building scalable 3D applications. Ville Miettinen Hybrid Graphics

Volume Illumination, Contouring

Rendering Part I (Basics & Ray tracing) Lecture 25 December 1, 2015

Fog and Cloud Effects. Karl Smeltzer Alice Cao John Comstock

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Global Illumination. CSCI 420 Computer Graphics Lecture 18. BRDFs Raytracing and Radiosity Subsurface Scattering Photon Mapping [Ch

Game Technology. Lecture Physically Based Rendering. Dipl-Inform. Robert Konrad Polona Caserman, M.Sc.

CS 4620 Program 3: Pipeline

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

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

Lighting. Figure 10.1

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

Comp 410/510 Computer Graphics. Spring Shading

Deferred Rendering Due: Wednesday November 15 at 10pm

Models and Architectures

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

After the release of Maxwell in September last year, a number of press articles appeared that describe VXGI simply as a technology to improve

Dynamic Ambient Occlusion and Indirect Lighting. Michael Bunnell NVIDIA Corporation

Real-Time Image Based Lighting in Software Using HDR Panoramas

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

GPU Ray Tracing at the Desktop and in the Cloud. Phillip Miller, NVIDIA Ludwig von Reiche, mental images

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

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

Virtual Reality for Human Computer Interaction

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Lecture 18: Primer on Ray Tracing Techniques

Hardware Accelerated Volume Visualization. Leonid I. Dimitrov & Milos Sramek GMI Austrian Academy of Sciences

Real-Time Voxelization for Global Illumination

x ~ Hemispheric Lighting

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

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

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Topics and things to know about them:

The Rendering Equation and Path Tracing

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

Adding Spherical Harmonic Lighting to the Sushi Engine. Chris Oat 3D Application Research Group. ATI Research, Inc.

Mali Demos: Behind the Pixels. Stacy Smith

Global Illumination. COMP 575/770 Spring 2013

Transcription:

U B C O K A N A G A N Department of Computer Science COSC 448: REAL-TIME INDIRECT ILLUMINATION Written by Stephen Smithbower Supersor: Dr. Ramon Lawrence January 2010 - April 2010 University of British Columbia Okanagan - Department of Computer Science

Table of Contents Overew! Purpose! Overew! Candidate Approaches! The Chosen Approach! Implementation! Overew! Deferred Rendering! Reflexive Shadowmap! Instant Radiosity! Conclusion! iv i i

Overew Purpose The aim of this project was to design and implement a system to allow for the real-time calculation of single-bounce indirect illumination in dynamic, interactive 3d-enronments. Overew Indirect illumination is a natural phenomenon that results when light from a light source (known as direct lighting, or incident lighting) partially reflects off of a surface and continues to illuminate other surfaces until the majority of the light is absorbed. This effect is readily observed in every-day life, and is particularly noticeable in brightly-coloured enronments. The primary effect of this indirect illumination is a general brightening of a given room, versus the ambient light level that would have resulted if lighting was a result of direct illumination only. A very pronounced consequence of this is an effect known as light-bleeding, where coloured light is reflected off one surface onto another in a very noticeable fashion (such as when light bleeds off of a white couch onto a red wall, appearing to stain the wall red). Indirect illumination, and in particular light bleeding, is a very powerful technique for softening the generally harsh lighting that direct lighting calculations prode in simulated 3d enronments, and help to not only add a sense of realism to a scene, but also prode artists with a powerful tool to create mood and atmosphere. Indirect illumination is not a new concept in 3d enronments. In fact offline reproduction (pre-calculating lighting results in a pre-production phase) has been in use for several years - particularly in animated films. For example, Shrek 2 was the first film to incorporate the effect into its production. However until recently, commodity desktop graphics hardware has not been powerful enough to calculate the full lighting solution (both direct and indirect lighting) at speeds which would allow for seamless user interaction. Over the last 10 years hardware dedicated to at first transforming 3d geometry and performing the direct illumination calculations, and recently to performing general purpose floating point calculates, has been developed at an incredible pace. This hardware is known as the graphics processing unit, or GPU, and works in tandem with the traditional CPU in order to prode ever-more elaborate lighting calculations at interactive frame rates. The GPU has now reached a performance threshold where it is now conceivable to move beyond direct illumination, which is the traditional approach to real-time lighting, and into performing both direct and indirect illumination in interactive scenes. Candidate Approaches A literature search in the area of real-time indirect illumination proded a list of possible candidate techniques that have been implemented on recent GPU architectures. The following were considered. Spherical Harmonics! During a pre-processing step, the geometry of the scene is considered, and a light transfer function is calculated for each vertex in the scene. This transfer function is then encoded as a third-order wavelet and stored along with the scene geometry. At runtime, the entire transfer function can be quickly evaluated by taking the dot product

of the wavelet and the incident light vector, for each light in the scene. This technique prodes very fast run-time evaluation of the indirect lighting solution, and prodes other benefits such as soft-shadows, ambient occlusion, and support for sub-surface scattering. However, drawbacks include a very intensive and long pre-processing procedure, the ability to represent a transfer function for only distant light sources (such as the sun) due to wavelet compression, and support only for static geometry (wavelets can be rotated easily, which allows for dynamic, mong light sources, but they cannot be displaced, rendering the lighting solution invalid if geometry within the scene were to move). Finally, because a wavelet must be stored per-vertex, the storage requirements for the lighting solution quickly become prohibitive for complex geometry. Unfortunately, the restrictions on scene geometry and light distance render this technique unfit for our purposes. Cube Map Array! During level design, a grid array of light probes (implemented as cube maps on graphics hardware) are placed throughout the scene. At runtime, the world is rendered using directed lighting into each cubemap-probe and then blurred, proding a low-frequency representation of the incoming light at each probe position. This technique is very similar to a popular photography technique used to measure light levels and propagation within a room. For each vertex in the scene, the nearest N probes are interpolated and sampled, proding the amount of indirect lighting available to that surface. This technique prodes a rough approximation of indirect illumination that maps fairly well to commodity graphics hardware, utilizing a natural data structure, and supports completely dynamic geometry. However the amount of scene geometry that must be processed when updating the light probes can quickly become a bottleneck, and choosing the correct N probes per-vertex results in a very large under-utilization of the graphics hardware (due to cache misses, which hurts parallelism performance). Photon Mapping! During a pre-processing phase, photons are traced out from light sources into the scene geometry, and intersections are mapped to a spatially-aware data structure (such as a BSP tree, Octree, or K-D Tree). During runtime, light is traced from the incident light source and propagated using the accelerated data structure. The final values are then mapped into a texture for use on the GPU, and read in as part of the lighting equation. This technique has only been implemented with limited success, and has been largely abandoned as of late. The pre-processing step limits the solution to static geometry (unless highly elaborate schemes are employed to prode temporal updating of the accelerating data structure), and mapping the data structure to the GPU has proven to be a very large challenge. Screen-Space Indirect Illumination! This technique is relatively new, and is an extension of an earlier technique pioneered by Crytek in their game Crysis. Crytek developed a screen-space (working only on scene information encoded in a texture from the user s point of ew) technique for faking ambient occlusion as a post-process, by comparing the depths and normals of small regions of pixels in order to accumulate a blocking factor for each given pixel in the scene. Screen Space Indirect Illumination works in a very similar fashion, however instead of accumulating a blocking factor, an incoming reflected light factor is accumulated from neighboring pixels. While not even close to being physically accurate, this technique prodes fast light bleeding and works well with small details and low frequencies. It maps very well the GPU (being entirely texture-based) and makes no assumptions on the general makeup of the scene. However this technique suffers from extreme locality - the search radius for influencing neighboring pixels must be kept moderately small in order to maintain performance (a larger radius greatly increase the number of cache misses on the GPU and breaks parallelism), so many influences will be missed, and any influencers from outside of the user s field of i

ew will not affect the indirect illumination for the scene. As a result, light bleeding can pop in and out, depending on scene occlusion. This lack of continuity renders this technique suitable only for small, low-resolution details. Reflective Shadow Maps! Reflective shadow maps draws from the principle of deferred rendering in order to accelerate what is generally the most expensive step in the indirect lighting calculations - the light-ray intersection with the scene, required to location reflective surfaces. In this approach, the scene is rendered from each light s point of ew, with geometry position, normal, and diffuse reflectance (the direct lighting) encoded as textures in GPU memory, forming what is referred to as a geometry buffer. Each pixel in this geometry buffer acts as a point light source. This geometry buffer is iterated over, and the lighting contribution from each pixel is propagated back into the scene. This technique maps very well to modern graphics hardware, requires no pre-processing of the scene, handles fully dynamic scenes, and is not ew dependent. However, treating each pixel in the geometry buffer as a light source is extremely expensive - a very large number of calculations must be performed per-pixel, saturating both memory and FLOP bandwidth, to the point where the technique is not able for more than a single light source. Instant Radiosity! Instant radiosity uses the fact that indirect lighting is low-frequency, and so attempts to minimize the number of light traces required to propagate light within a scene by interpolating lighting values between two points. This is mapped well to the GPU by treating each reflective point as a rtual 180 degree light dome (or spotlight) and utilizing the GPU s built in support for calculating direct lighting equations. At runtime, rays are traced from each light source until they intersect with the scene. At the point of intersection a rtual light source is placed, with its properties (radius of influence, colour) based on the reflective material properties of the given surface. The scene is then rendered with the accumulation of both the direct and indirect (a the rtual lights) light contributions. This technique is ew-independent, makes no presumptions on the scene (and therefore handles dynamic geometry), and maps well to the GPU. However, much of the work is still done on the CPU (the scene ray-tracing) which is slow, and bottlenecks occur when attempting to transfer the rtual light information over to the GPU (the scene must be rendered once per rtual light). Several hundred rtual light sources are required in order to produce an aesthetically pleasing light-bleed effect, rendering this technique impractical for all but the simplest scenes. The Chosen Approach A combination of three approaches was chosen in order to attempt to implement a solution that would allow for a single bounce of indirect illumination in fully dynamic and interactive scenes. The overall goal was to take the strengths from each technique and combine them in order to move as much work onto the GPU as possible, and map scene and lighting information into data structures that maximize GPU utilization. To do this, a hybrid of Screen Space Indirect Illumination, Reflective Shadowmaps, and Instant Radiosity was designed, as well as changing rendering paradigms from traditional forward rendering to deferred rendering. Instant radiosity s approach of using rtual light sources distributed throughout the scene to represent indirect light was chosen as it maps very well to the GPU architecture, taking advantage of modern techniques and advancements, iv

and is the least intrusive technique when used on arbitrary scene geometry. However, instead of tracing out light rays from each light source in order to place the rtual lights (a very slow process), a reflexive shadowmap will be used instead. The scene will be rendered from the light s point of ew, with each pixel representing a possible rtual light that can then be placed into the scene without any intersection tests. In order to minimize the number of lights generated, only a subset of pixels will be sampled (for sake of simplicity and generality, a poisson disc sampling pattern was used, pre-computed and stored in a texture lookup table). In order to address the bandwidth problems associated with rendering the scene once for each rtual light source, deferred rendering is used to shift all light rendering onto the GPU, so that scene geometry has a fixed overhead. Screen-Space Indirect Illumination is then performed on the final scene with a very small search radius, so that it can quickly fill in only minor, highly local details (such as light bleeding at contact points). This approach supports dynamic scenes, is only partially ew-dependent, is scalable, and maps very well to the GPU. Additionally, because no elaborate data structures are required, implementation is relatively simple, and can sit along side existing rendering infrastructures. Deferred Rendering Deferred rendering is an approach for rendering that attempts to separate geometry from lighting, decoupling the two so that an increase in complexity for one does not also increase the complexity for the other. In deferred rendering the scene is rendered from the user s point of ew, and geometry information (such as depth and surface normal) are encoded into textures and stored in a geometry buffer. Each light is then drawn into the scene using proxy geometry (a sphere for point lights, a cone for spot lights), sampling any pixels from the geometry buffer that the proxy geometry overlaps. Lighting is then calculated for these pixels using values from the geometry buffer, and stored into a light accumulation buffer. The scene is then rendered again with more material properties, sampling lighting values from the light accumulation buffer, and the result is a fully illuminated scene. By encoding the scene geometry into textures which are stored on the GPU, a large number of light sources may be rendered in real time without have to re-download scene data to the GPU for each light source. This alleates the bandwidth bottleneck that plagues traditional forward rendering with complex scenes. v

Implementation Overew Original implementation was to be done using Java, on top of OpenGL (for cross-platform compatibility). However, after a couple of weeks worth of development on the java-based graphics engine, it was decided that too much time was being invested into infrastructure development. A switch was made to the TrueVision3D graphics engine, and DirectX. This allowed us to focus on implementation of the proposed lighting pipeline, and not have to worry about managing the graphics API, cross-platform compatibility, or resource management. Light Pre-Pass, a specific technique for deferred rendering, was implemented with good success. A demo was built that showcased up to 1000 dynamic light sources (powered by the Newton physics engine) in ew at the same time, running at over 60 frames per second. Implementation of the reflexive shadowmap was also completed with success. Optimization techniques were used in both the geometry buffer required for the deferred rendering, and for the reflexive shadowmap. Implementation of instant radiosity utilizing the reflexive shadowmap was met with mixed results. While the approach was technically implemented, performance and aesthetic results were not acceptable. More work is required in both the sampling pattern used for rtual light placement and scaling, and in optimizing the generation of the rtual lights. Deferred Rendering Fairly standard implementation of light pre-pass, utilizing a two-buffer system. One buffer stored the depth of the scene, from the camera, and another stored the world-space normals of the scene. Depth was used as it could be compressed from a floating point value to an integer using 4 channels of the buffer, cutting bandwidth requirements in half. Spherical coordinate compression was used for normals in order to reduce the number of required channels from 4 to 2, also to cut down on the bandwidth required for storage (specialized two-channel texture formats were used). Lights were rendered using instanced proxy geometry - light positions, ranges, colours and rotations were uploaded as a large block to the GPU, and the same light geometry was then modified solely on the GPU using these values. For 1000 light sources, this reduced the number of draw calls from 1000 to 4, for the light sources (a maximum of 250 light sources could be rendered in a single call). During rendering, depth information was decoded and used to reconstruct the world-space position of a given pixel, based on the ew frustum. MRT (multiple render targets) was used in order to draw to multiple buffers with a single draw call. GPU utilization was fairly high with this approach, and performance exceeded expectations. Reflexive Shadowmap Implementation was very similar to the geometry buffer implemented for deferred rendering. The same compression techniques were implemented, and MRT was used. 3 buffers were required for the reflexive shadow map - depth, normals, and diffuse reflectance (often referred to as flux).

Instant Radiosity Implementation at this stage was difficult and never reached satisfactory results. While the theory worked (some light bleeding was observed by redistributing rtual lights using the reflexive shadowmap), the sampling pattern employed (using a poisson disc distribution) yielded concentrations of light in some areas of the scene, and a lack of indirect in others. Additionally, performance was poor, mostly due to the unoptimized read-back of pixel values on the CPU. A further optimization that was not attempted due to lack of time would be to generate the instancing data for the rtual lights purely on the GPU with no read-back, by hang each light source use its index to sample a lookup table that could prode correct texture coordinates in order to sample from the reflective shadow map. This would (potentially) remove the bandwidth issues bottlenecking the current pixel read-back. Further work is required in order to come up with an optimal sampling pattern for light distribution, and for properly modeling the light transfer function. i

Conclusion The feasibility of real-time indirect illumination in dynamic scenes is still an open question at this point in time. However, even with only the partial results observed in this study, there is indication that with further work and optimization, this combination of techniques could very well lead to a suitable implementation. The key work done in this study is adapting several existing techniques in order to better utilize the power of the GPU. Exceptionally positive results were observed with deferred rendering, and there is still a large amount of room available for further optimizations. At this point in time, instant radiosity still remains highly sensitive to artist-based parameters, such as sampling pattern, strength of rtual light sources, and scaling of the scene. Further work in this area is recommended in order to better produce a natural, self-adjusting system that can automatically adjust to several different scene types.