Real-time volumetric effects Andrei Tatarinov. NVIDIA Confidential Talk outline Introduction Part I – Generating fire with Perlin noise Part II – Generate.

Презентация:



Advertisements
Похожие презентации
11 BASIC DRESS-UP FEATURES. LESSON II : DRESS UP FEATURES 12.
Advertisements

DRAFTING TECHNIQUES I 136. Here is a basic shape. From here, we will do some advanced drafting once we put this shape on a sheet as a drawing. Select.
REFERENCE ELEMENTS 64. If your REFERENCE ELEMENTS toolbar is not in view and not hidden, you can retrieve it from the toolbars menu seen here. 65.
Centrifugal force (rotating reference frame). Centrifugal force (from Latin centrum "center" and fugere "to flee") can generally be any force directed.
O O O O O O H H Proton Site with σ intra Organic Molecular single crystal : a specimen of arbitrary shape 4 point star indicates the molecule at a central.
Effects in Computer Graphics. Modern effects Introduction 80-90s effects My own effects Some info.
ADVANCED DRESS-UP FEATURES 39. Once OK has been selected, your part will appear with the filleted area highlighted by orange lines at the boundaries.
Diffraction and Interference. Interference and Diffraction Distinguish Waves from Particles O The key to understanding why light behaves like waves is.
Tornadoes ГБОУ СОШ 298 Учитель: Мирошниченко Ирина Алексеевна УМК Spotlight The 8 th form.
SIR model The SIR model Standard convention labels these three compartments S (for susceptible), I (for infectious) and R (for recovered). Therefore, this.
Effect of Structure Flexibility on Attitude Dynamics of Modernizated Microsatellite.
Coriolis effect. In physics, the Coriolis effect is a deflection of moving objects when they are viewed in a rotating reference frame. In a reference.
© 2006 Cisco Systems, Inc. All rights reserved. MPLS v Complex MPLS VPNs Introducing Central Services VPNs.
Dynamic Designer Is the easy way for you to cut as much as 80% from the time and cost of getting your new products to market, and improving the old ones.
Welcome to…. YOUR FIRST PART – START TO FINISH 2.
DRAWING USING SURFACES 115. To start your SURFACES drawing, go to new drawing, choose PART. Once the Part screen appears, click on START, choose MECHANICAL.
What to expect? How to prepare? What to do? How to win and find a good job? BUSINESS ENGLISH COURSE NOVA KAKHOVKA GUMNASUIM 2012.
Introduction The modern world of computer graphics is mostly dominated by polygonal models. Due to their scalability and ease of rendering such models.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Route Selection Using Policy Controls Using Multihomed BGP Networks.
Учимся писать Эссе. Opinion essays § 1- introduce the subject and state your opinion § 2-4 – or more paragraphs - first viewpoint supported by reasons/
Транксрипт:

Real-time volumetric effects Andrei Tatarinov

NVIDIA Confidential Talk outline Introduction Part I – Generating fire with Perlin noise Part II – Generate smoke using 3D fluid simulation Part III – Rendering volumetrics

NVIDIA Confidential Why is this cool? Volumetrics represent such common effects as fog, smoke, fire, explosions Current approaches to rendering volumetrics in games have limitations Video textures Particle systems

NVIDIA Confidential What do we have now? Most volumetric effects are represented as sets of video textures Everything looks cool until effect intersects an obstacle

NVIDIA Confidential Why now? Sheer number of operations needed can only be supported by modern high end GPUs New features in DirectX10 Render to 3D texture Integer maths Geometry Shader Stream Out

NVIDIA Confidential Part I - Fire Outline Perlin noise overview Simplex noise overview Ways to generate procedural textures How to generate a flame using Perlin noise

NVIDIA Confidential Perlin Fire Fire in NVIDIAs DirectX10 SDK Sample

NVIDIA Confidential Perlin noise Given an input point P Find its neighboring grid points Q For each grid point Pick pseudo-random gradient vector G Compute linear function G * (P - Q) Interpolate between values in grid points

NVIDIA Confidential Random Number generation on GPU Use a set of power and modulation operations, using some big prime number as a modulation base Use a permutation texture R = PermTex.Sample ( P.yw + PermTex.Sample ( P.xz ) )

NVIDIA Confidential Simplex Noise The same as Perlin noise, but using a simplex grid instead of hypercube grid For a space with N dimensions, simplex is the most compact shape that can be repeated to fill the entire space Using simplex grid can significantly reduce a number of interpolations

NVIDIA Confidential Procedural Textures Use a weighted sum of several noise frequencies to create a texture ++++= =

NVIDIA Confidential Procedural Textures Try noise in different expressions noisesin (x + sum 1/f( |noise| )) sum 1/f(noise)sum 1/f( |noise| )

NVIDIA Confidential Volumetric Effects Use noise to animate turbulent flow Flame Clouds

NVIDIA Confidential Flame Take a basic fire shape and revolve it around y-axis to create a fire unit Fire shape can be customized to achieve different look and feel Basic shapeFire unit y

NVIDIA Confidential Flame Perturb fire unit with 4D noise (4th component stands for time) += Fire unitPerlin noise turbulence field Flame

NVIDIA Confidential Flame Use a weighted sum of several noise frequencies. Change weights to achieve different look ++++ = =

NVIDIA Confidential Part II - Smoke Outline Why 3D fluid simulation is important Overview of process Fluid simulation basics Dynamic arbitrary boundaries

NVIDIA Confidential Smoke Smoke in NVIDIAs DirectX10 SDK Sample

NVIDIA Confidential Overview Composite on top of scene Render Discretize space and simulate Decide where to place the smoke Scene

NVIDIA Confidential Fluid Simulation A fluid (with constant density and temperature) is described by a velocity and pressure field Navier-Stokes equations mathematically defines the evolution of these fields over time; impose that the field conserves both mass and momentum To use these equations we discretize the space into a grid Define smoke density, velocity and pressure at the center of each grid cell At each time step, we use the equations to determine the new values of the fields Pressure Density Velocity

NVIDIA Confidential Fluid Simulation steps Advect Add Density Add Velocity Project Density Velocity Iterate Pressure Density Velocity Pressure Each time step * We skip the diffusion step Initialize

NVIDIA Confidential Advect Velocity Density Time Step t Time Step t + 1 Density

NVIDIA Confidential Fluid Simulation on the GPU Velocity, Density, Pressure Textures Simulate one substep for entire grid Render a grid sized, screen aligned, quad Calculations for a grid cell Pixel Shader Output values using Render to Texture

NVIDIA Confidential Advect on the GPU Density Texture at timestep t Velocity Texture at timestep t rasterized rendered Texture fetch Render Target Density for timestep t+1 Quad M O M O M O M O Pixel Shader PS_ADVECT calculate new density for this grid cell using the density and velocity textures from the previous time step Velocity in x Velocity in y

NVIDIA Confidential Texture fetch GS is used to rasterize each quad to proper layer in output Render Target Advect on the GPU in 3D Density Texture at timestep t Velocity Texture at timestep t rasterized rendered Pixel Shader Render Target Density for timestep t+1 N Quads M O M O M PS_ADVECT calculate new density for this grid cell using the density and velocity textures from the previous time step N O M N O N

NVIDIA Confidential Obstacles Smoke interacting with obstacles and compositing with the scene Smoke only compositing with the scene

NVIDIA Confidential Obstacles Implicit shapes Like spheres, cylinders Voxelize objects Static : Voxelize just once, offline Moving:Voxelize objects per frame Obstacle texture Fluid cell inside obstacle Fluid cell outside obstacle

NVIDIA Confidential Dealing with Obstacles How should the fluid react to obstacles? The fluid should not enter obstacles cells If the obstacles are moving they should impart the correct velocity on the fluid How the fluid reacts to the obstacles Boundary Conditions

NVIDIA Confidential Boundary Conditions for Density No density should be added to or advected into the interior of obstacles Density Obstacles

NVIDIA Confidential Boundary Conditions for Pressure Derivative of the pressure across the boundary should be zero (Neumann boundary conditions - specifying derivative ) cell1 u v cell2 PressureCell1 – PressureCell2 = 0 PressureCell1 = PressureCell2

NVIDIA Confidential Boundary Conditions for Velocity The velocity normal to the boundary of the obstacle should be equal for fluid and obstacle (Dirichlet boundary conditions – specifying value) u v

NVIDIA Confidential Voxelizing an object Obstacle texture Obstacle Velocity texture

NVIDIA Confidential Use low res collision model for voxelization

NVIDIA Confidential Voxelizing a simple object ?

NVIDIA Confidential Voxelizing a simple object Orthographic camera Near plane Far plane Stencil Buffer Decrement on back faces Increment on front faces

NVIDIA Confidential Voxelization ……… 2DArray of N stencil buffers Render model N times, each time with a different near plane

NVIDIA Confidential Part III - Rendering Outline Ray marching Occluding the scene Artifacts and ways to avoid them

NVIDIA Confidential Rendering Render front faces of box Raycast into the 3D Density texture Composite into scene

NVIDIA Confidential Raycasting into 3D texture What we haveWhat we dont have - Ray from eye to box- Ray in texture space Transform from world to texture space Transform from world to texture space Transform from world to grid space - Ray box intersection - Distance the eye ray traverses through the box - Ray entry point in the texture - Number of voxels the ray traverses = Number of samples to take 3D Density Texture

NVIDIA Confidential Raycasting: blending FinalColor.rgba = 0 FinalColor.rgb += sampleColor.rgb * SampleColor.a *(1.0 – FinalColor.a) FinalColor.a += SampleColor.a * (1.0 – FinalColor.a) Density Texture = Trilinear sample from 3D texture Render Fullscreen quad to frame buffer RayDataTexture PositionInTexture = TransformToTexSpace (RayDataTexture.rgb) MarchingVector = TransformToTexSpace (eye - RayDataTexture.rgb) NumberOfSamples = TransformToGridSpace (RayDataTexture.a)

NVIDIA Confidential Occluding the scene Smoke correctly compositing with the scene Smoke directly blended on top of the scene

NVIDIA Confidential Integrating scene depth

NVIDIA Confidential Artifacts During the ray-marching use jittering to avoid banding Without jitteringWith jittering

NVIDIA Confidential Jittered sampling During the ray-marching use jittering to avoid banding

NVIDIA Confidential Artifacts Increase sampling rate to reduce a noise caused by jittering Increasing sampling rate leads to performance loss Low sampling rateHigh sampling rate

NVIDIA Confidential Artifacts Correctly using the depth by weighted sampling Artifacts resulting from an integral number of samples

NVIDIA Confidential Correctly integrating scene depth by weighting the last sample FinalColor.rgb += d/sampleWidth * SampleColor.rgb * SampleColor.a * (1.0 – FinalColor.a) FinalColor.a += d/sampleWidth * SampleColor.a * (1.0 – FinalColor.a) sampleWidth d

NVIDIA Confidential Combining techniques

NVIDIA Confidential Conclusion Interactive volumetric effect simulation at reasonable grid resolutions is feasible for games We presented here a brief overview of the entire process More information NVIDIA DirectX10 SDK code sample Upcoming GPU Gems3 article

NVIDIA Confidential Questions?