Advanced Visual Effects with Direct3D

Similar documents
Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Dynamic Resolution Rendering

Modern Graphics Engine Design. Sim Dietrich NVIDIA Corporation

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

INTRODUCTION TO RENDERING TECHNIQUES

Optimization for DirectX9 Graphics. Ashu Rege

Image Synthesis. Transparency. computer graphics & visualization

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

GPU Architecture. Michael Doggett ATI

Touchstone -A Fresh Approach to Multimedia for the PC

How To Make A Texture Map Work Better On A Computer Graphics Card (Or Mac)

Computer Graphics Hardware An Overview

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith

Radeon HD 2900 and Geometry Generation. Michael Doggett

Introduction to Computer Graphics

Outline. srgb DX9, DX10, XBox 360. Tone Mapping. Motion Blur

OpenGL Performance Tuning

Optimizing AAA Games for Mobile Platforms

Lecture Notes, CEng 477

How To Understand The Power Of Unity 3D (Pro) And The Power Behind It (Pro/Pro)

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

Hi everyone, my name is Michał Iwanicki. I m an engine programmer at Naughty Dog and this talk is entitled: Lighting technology of The Last of Us,

Real-Time Realistic Rendering. Michael Doggett Docent Department of Computer Science Lund university

GPU Christmas Tree Rendering. Evan Hart

Specular reflection. Dielectrics and Distribution in Ray Tracing. Snell s Law. Ray tracing dielectrics

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

Lezione 4: Grafica 3D*(II)

Workstation Applications for Windows. NVIDIA MAXtreme User s Guide

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Deferred Shading & Screen Space Effects

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Midgard GPU Architecture. October 2014

Advanced Rendering for Engineering & Styling

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

NVIDIA GeForce GTX 580 GPU Datasheet

A Short Introduction to Computer Graphics

Low power GPUs a view from the industry. Edvard Sørgård

SkillsUSA 2014 Contest Projects 3-D Visualization and Animation

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 9 The Game Engine

GPUs Under the Hood. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

Image Synthesis. Fur Rendering. computer graphics & visualization

How To Use An Amd Ramfire R7 With A 4Gb Memory Card With A 2Gb Memory Chip With A 3D Graphics Card With An 8Gb Card With 2Gb Graphics Card (With 2D) And A 2D Video Card With

Using Photorealistic RenderMan for High-Quality Direct Volume Rendering

Adding Animation With Cinema 4D XL

SAPPHIRE TOXIC R9 270X 2GB GDDR5 WITH BOOST

Making natural looking Volumetric Clouds In Blender 2.48a

Real-Time BC6H Compression on GPU. Krzysztof Narkowicz Lead Engine Programmer Flying Wild Hog

Performance Optimization and Debug Tools for mobile games with PlayCanvas

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

Far Cry and DirectX. Carsten Wenzel

GPU-Driven Rendering Pipelines

IT 386: 3D Modeling and Animation. Review Sheet. Notes from Professor Nersesian s IT 386: 3D Modeling and Animation course

OpenGL Insights. Edited by. Patrick Cozzi and Christophe Riccio

Computer Graphics. Introduction. Computer graphics. What is computer graphics? Yung-Yu Chuang

Radeon GPU Architecture and the Radeon 4800 series. Michael Doggett Graphics Architecture Group June 27, 2008

Intermediate Tutorials Modeling - Trees. 3d studio max. 3d studio max. Tree Modeling Matthew D'Onofrio Page 1 of 12

To determine vertical angular frequency, we need to express vertical viewing angle in terms of and. 2tan. (degree). (1 pt)

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Advanced Graphics and Animations for ios Apps

How To Teach Computer Graphics

Graphics Cards and Graphics Processing Units. Ben Johnstone Russ Martin November 15, 2011

Plug-in Software Developer Kit (SDK)

BCC Multi Stripe Wipe

One Step Closer to a Fully Realistic 3D World on the Consumer PC A White Paper on the 3dfx T-Buffer

Blender addons ESRI Shapefile import/export and georeferenced raster import

Introduction to Game Programming. Steven Osman

Example Chapter 08-Number 09: This example demonstrates some simple uses of common canned effects found in popular photo editors to stylize photos.

ATI Radeon 4800 series Graphics. Michael Doggett Graphics Architecture Group Graphics Product Group

The In and Out: Making Games Play Right with Stereoscopic 3D Technologies. Samuel Gateau

Overview Motivation and applications Challenges. Dynamic Volume Computation and Visualization on the GPU. GPU feature requests Conclusions

SAPPHIRE HD GB GDDR5 PCIE.

Awards News. GDDR5 memory provides twice the bandwidth per pin of GDDR3 memory, delivering more speed and higher bandwidth.

3D Computer Games History and Technology

Programming 3D Applications with HTML5 and WebGL

Intel Graphics Media Accelerator 900

AMD GPU Architecture. OpenCL Tutorial, PPAM Dominik Behr September 13th, 2009

iz3d Stereo Driver Description (DirectX Realization)

NVIDIA IndeX Enabling Interactive and Scalable Visualization for Large Data Marc Nienhaus, NVIDIA IndeX Engineering Manager and Chief Architect

Water Flow in. Alex Vlachos, Valve July 28, 2010

Multi-Zone Adjustment

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science. Friday 18 th January 2008.

Examples. Pac-Man, Frogger, Tempest, Joust,

SAPPHIRE VAPOR-X R9 270X 2GB GDDR5 OC WITH BOOST

Volume Rendering on Mobile Devices. Mika Pesonen

3D Stereoscopic Game Development. How to Make Your Game Look

Beyond 2D Monitor NVIDIA 3D Stereo

VA (Video Acceleration) API. Jonathan Bian 2009 Linux Plumbers Conference

Writing Applications for the GPU Using the RapidMind Development Platform

NVIDIA workstation 3D graphics card upgrade options deliver productivity improvements and superior image quality

Maxwell Render 1.5 complete list of new and enhanced features

L20: GPU Architecture and Models

The OpenGL Framebuffer Object Extension. Simon Green. NVIDIA Corporation

A Crash Course on Programmable Graphics Hardware

The Car Tutorial Part 1 Creating a Racing Game for Unity

Adobe Marketing Cloud Sharpening images in Scene7 Publishing System and on Image Server

Transcription:

Advanced Visual Effects with Direct3D Presenters: Mike Burrows, Sim Dietrich, David Gosselin, Kev Gee, Jeff Grills, Shawn Hargreaves, Richard Huddy, Gary McTaggart, Jason Mitchell, Ashutosh Rege and Matthias Wloka

All About Anti-Aliasing What is it? Explanation of Multi-sampling Problems & Solutions

What is Anti-Aliasing? On current consumer cards, it s Super-sampling Just render the scene to a 2x2 larger back & zbuffer & filter down Multi-sampling Like the above, but compute coverage at a higher frequency than shading A Mix of the two, 2x multi and 2x supersampling simultaneously

4x Super- vs 4x Multi-Sampling

Note how the super-sampled Image has different shading results for each 2x2 area, and the multisampled one has only one color per 2x2. 4x Super 4x Multi

Multi-sampling saves performance by decoupling shading and coverage computation frequency 4x Super 4x Multi

4X Multi-Sampling on a 1x1 Frame Buffer Step 1 : Render Scene to 2x2 Larger Back Buffer Coverage Sample Locations

4X Multi-Sampling on a 1x1 Frame Buffer Triangles that cross at least one sample location are rasterized, Z/Stencil tested at each covered sample location The Yellow triangle has 2 Z & Stencil values Those triangles that cover > 1 sample point are still shaded only ONCE

4X Multi-Sampling on a 1x1 Frame Buffer Logical Back Buffer Actual Back Buffer

4X Multi-Sampling on a 1x1 2x2 Larger Back Buffer Frame Buffer 2x2 Down-Filter at EndScene 1X Sized Front Buffer

Things that don't get AA'd with Multisampling Render to Texture can t assume it s color Clip planes may be implemented in raster Full screen quads MRT Pixel Shaders Z-replace shaders Texkill Alpha-Test

Things that will Break or Slow Down AA Back Buffer Locking StretchRect() Can Force a down-sample Z Buffer Locking Can Force a down-sample Applying AA Zbuffer to Aliased Texture How is this supposed to work? Just Re-render your z buffer to be sure Multiple EndScenes()

How to Enable Multi-Sampling During CreateDevice() PresentParameters.MultiSampleType

Selecting Multisample Antialiasing Control this in your application Use the API! Let your users set the quality Unless you re using MULTISAMPLEMASK, you only care about these 8 Quality Levels None Nonmaskable 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Multisample Type

Multi-Sample Mask Lets you selectively update each individual multi-sample Not supported if d3dcaps9.rastercaps & D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE

? Questions about Multisampling

Issues & Solutions Texture Atlases Video RAM Usage Format Incompatibility Variable Bandwidth MRT Incompatibility

Issue : Texture Atlases Games with Texture Atlases can have problems with flashing texels at certain angles Like packed lightmaps Multiple Character skins per texture page

4X Multi-Sampling & Texture Atlases Coverage Samples Texture Sample

Although this triangle does cross a sample location - this triangle fails to cross the pixel s texture sampling position

so, the uv coordinate is extrapolated outside the triangle s uv gamut

If using texture atlases, this can cause an incorrect texel to be selected from a different chart Texture Atlas

How Bad Is It? Well, all games ever shipped have had this problem with multi-sampling So it s not fatal But artifacts can be seen on triangles edgeon to the view Gets worse if atlas contains many different colors

Enter the Centroid DirectX9 introduced Centroid Sampling to address this issue Basically, if a texel sample falls outside of the triangle s valid UV gamut, it s snapped to be inside the UV gamut

Centroid sampling forces the interpolated parameter to stay in the triangle s valid uv gamut at the centroid of the covered samples Texture Atlas

Other Solutions Centroid is available on some pixel shader 2.0+ hw Other options include Clamping texture coordinates in the pixel shader to chart s uv rect Using a separate clamped mask texture corresponding to chart Live with it, but store similarly colored lightmaps together Add a border to each chart via dilation filter or calculation outside of chart gamut

Issue : Greater Video Ram Multi-sample AA requires more video ram than aliased rendering Simple formula for 4X AA often wrong : front_buffer_size + 4 * front_buffer_size + 4 * z_buffer_size Exactly how much is not obvious, and can depend on IHV, GPU and driver

More Memory Than Anticipated There may be 2 large back buffers Some HW scans out of super-buffer using DAC There may be > 1 front-buffer-sized back buffer To hold filtered, but not yet displayed buffers Best bet is to query the AvailableVidMem() after device creation in case AA is forced on

Issue : Sparkly Alpha Test Using alpha test without alpha blended edges looks noisy Especially apparent with trees Multi-sampling only samples once per final pixel, not per-sample, so alpha test is binary

Solution : Custom Super- Sampling Use multi-sample masking to render the leaves of an alpha tested tree several times Each render is offset a half pixel or so Not Z correct, but for leaves, ok

Solution : Custom Super- Sampling The blending between the 4 versions of the leaves happens at the normal downfilter time : Either Present() Or StretchRect()

Issue: fp Render Target Incompatibility Multisampling doesn t work with fp16 or fp32 render targets It could, just a limitation of current HW If you want higher quality, you can do your own super-sampling

Solution : Custom AA You can perform your own edge antialiasing one of several ways Render your scene to a 2x2 larger texture, with 2x2 larger z/stencil buffer then bilinear filter it down to the back buffer Ordered Grid Sampling Not Ideal Performs Shader AA also More Expensive than HW Multisampling Needs no extra render passes of scene geometry

Custom AA Use a rotated back buffer for Rotated Grid AA Sampling Unrotate during Down- Filtering Draw HUD after downfilter

Custom AA Render your scene multiple times into different buffers, then average together at EndScene() via pixel shader ala 3dfx T-Buffer Requires multiple scene passes Needs more than 1 Z buffer

Issue : Variable BW Costs During low-action scenes, it would be nice to have very high AA levels During fast-action scenes, especially w/ alpha particles & sounds, frame rate is more important than image quality How to balance these conflicting desires?

Solution : Dynamic AA Variation on Custom AA Allocate 2x2 larger back buffer for AA In high frame rate scenes, just perform normal 4X multi-sampling, but perform your own downfilter using StrechRect()

Dynamic AA During low-frame rate periods, reduce your viewport size on the 2x2 larger back buffer Still StretchRect() to same sized buffer Render HUD Afterwards Keeps framerate more even

Back Buffer Shrinks w/ FPS Down-Filter to Constant Front Buffer Size 70 fps 25 fps 15 fps

Test Results Looked good Except for text, which crawled Just render HUD after the StretchRect() Variable framerate smoothed out Non-integer AA samples don t quite look as good ( a bit blurry ) But restricting the technique to only choose 2x1, 2x2, 3x2, etc. doesn t give enough options Only helps if b/w or shader bound

Issue : Post-Processing w/ AA Can t get have a Multi-Sampled Render Target Texture Can t blt from Multi-Sample Back Buffer to texture in DirectX 9.0a

Solution : DirectX 9.0b & StretchRect The DirectX 9.0b+ runtimes introduced the ability to StretchRect() from a multisampled back buffer to an offscreen texture This can then be manipulated w/ glows, filters, HDR, etc.

Issue : Deferred Lighting One of the main ideas about deferred lighting is to render the light bounds as geometry during lighting passes This is instead of rendering the scene objects again, saving vertex & CPU You can t have a multi-sampled MRT on current HW

Deferred Lighting w/o MRT So, if we want AA, we either have to perform our own custom AA Or, we can try to mix Deferred Lighting and Multi-Sampling Allocate a 4x Multi-Sample Back Buffer Create offscreen surfaces for normal, depth, etc. What size? 1X, or 4X?

Super-Sampled Lighting? Ideally, we would want to treat the multi-sample back buffer as super-sampled That way you could 2x2 over-sample the lighting But, you can t get at the multi-sample buffer this way And there s no guarantee the HW stores it as a contiguous buffer Also exact multi-sample locations are unknown

Back To StretchRect()? So, we re forced to Down-Filter to a 1X buffer for each term Diffuse & Specular Normal Must Renormalize Depth? Triangle Edges aren t really correct

Broken Edges Multi-sampling effectively performs super-sampling when the primitive covers only some sample locations. Filtering these 4 values before lighting is just wrong.

Broken Edges The only way to selectively update the right sub-pixel positions is to re-render the scene geometry! Thus defeating one of the main points of Deferred Shading Rendering the Light geometry on top of the down-filtered normals, depths, etc is wrong.

So, MultiSampling & Deferred Shading Don t Get Along You really need to re-render your scene geometry every time you want to light it Or face, color, depth and normal discontinuities

Questions? sdietrich@nvidia.com