Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of...
Transcript of Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of...
![Page 1: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/1.jpg)
![Page 2: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/2.jpg)
Screen Space Fluid Rendering for Games
Simon Green, NVIDIA
![Page 3: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/3.jpg)
Overview
Introduction Fluid Simulation for Games Screen Space Fluid Rendering Demo
![Page 4: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/4.jpg)
Introduction
DirectX 11 and DirectCompute enable physics effects to be computed and rendered directly on the GPU
DirectCompute allows flexible general purpose computation on the GPU sorting, searching spatial data structures
DirectX 11 has good interoperability between Compute shaders and graphics can render results efficiently
![Page 5: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/5.jpg)
Fluid Simulation for Games Fluids are well suited to GPU
data parallel
Many different techniques Eulerian (grid-based) Lagrangian (particle-based) Heightfield
Each has its own strengths and weaknesses
To achieve realistic results, games need to combine techniques
![Page 6: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/6.jpg)
Particle Based Fluid Simulation Smoothed particle hydrodynamics
(SPH) Good for spray, splashes Easy to integrate into games
no fixed domain particles simple to collide with scene
Simulation can be provided by Physics middleware (e.g. Bullet,
Havok, PhysX) or custom DirectCompute or CPU code
![Page 7: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/7.jpg)
![Page 8: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/8.jpg)
Fluid Rendering
Rendering particle-based fluids is difficult Simulation doesn’t naturally generate
a surface (no grid, no level set) Just get particle positions and density
Traditionally, rendering done using marching cubes Generate density field from particles Extract polygon mesh isosurface Can be done on GPU, but very
expensive
![Page 9: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/9.jpg)
Screen Space Fluid Rendering Inspired by “Screen Space
Meshes” paper (Müller et al) See: van der Laan et al “Screen
space fluid rendering with curvature flow”, I3D 2009
Operates entirely in screen-space No meshes
Only generates surface closest to camera
![Page 10: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/10.jpg)
Screen Space Fluid Renderingcamera
particles
surface
![Page 11: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/11.jpg)
Screen Space Fluid Rendering - Overview Generate depth image of particles
Render as spherical point sprites Smooth depth image
Gaussian bilateral blur Calculate surface normals and
position from depth Shade surface
Write depth to merge with scene
![Page 12: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/12.jpg)
Screen Space Fluid Rendering
DepthImage
ThicknessImage
BackgroundImage
DepthSmoothing
Particles
SmoothedDepthImage
SurfaceShader
Scene
FinalShadedImage
![Page 13: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/13.jpg)
Rendering Particle Spheres Render as point sprites (quads) Calculate quad size in vertex
shader (constant in world-space) Calculate sphere normal and depth
in pixel shader Discard pixels outside circle Not strictly correct (perspective
projection of a sphere can be an ellipsoid) But works fine in practice
![Page 14: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/14.jpg)
PSOutput particleSpherePS(float2 texCoord : TEXCOORD0,float3 eyeSpacePos : TEXCOORD1,float sphereRadius : TEXCOORD2,float4 color : COLOR0)
{PSOutput OUT;
// calculate eye-space sphere normal from texture coordinatesfloat3 N;N.xy = texCoord*2.0-1.0;float r2 = dot(N.xy, N.xy);if (r2 > 1.0) discard; // kill pixels outside circleN.z = -sqrt(1.0 - r2);
// calculate depthfloat4 pixelPos = float4(eyeSpacePos + N*sphereRadius, 1.0);float4 clipSpacePos = mul(pixelPos, ProjectionMatrix);OUT.fragDepth = clipSpacePos.z / clipSpacePos.w;
float diffuse = max(0.0, dot(N, lightDir));OUT.fragColor = diffuse * color;
return OUT;}
Rendering Particle Spheres 0
1
1
r
![Page 15: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/15.jpg)
Point Sprite Spheres
![Page 16: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/16.jpg)
Sphere Depth
![Page 17: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/17.jpg)
Calculating Normals
Store eye-space sphere depth to floating point render target
Can calculate eye-space position from UV coordinates and depth
Use partial differences of depth to calculate normal Look at neighbouring pixels
Have to be careful at edges Normal may not be well-defined At edges, use difference in opposite
direction (hack!)
![Page 18: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/18.jpg)
Calculating Normals (code)
// read eye-space depth from texturefloat depth = tex2D(depthTex, texCoord).x;if (depth > maxDepth) {
discard;return;
}
// calculate eye-space position from depthfloat3 posEye = uvToEye(texCoord, depth);
// calculate differencesfloat3 ddx = getEyePos(depthTex, texCoord + float2(texelSize, 0)) - posEye;float3 ddx2 = posEye - getEyePos(depthTex, texCoord + vec2(-texelSize, 0));if (abs(ddx.z) > abs(ddx2.z)) {
ddx = ddx2;}
float3 ddy = getEyePos(depthTex, texCoord[0] + vec2(0, texelSize)) - posEye;float3 ddy2 = surfacePosEye - getEyePos(depthTex, texCoord + vec2(0, -texelSize));if (abs(ddy2.z) < abs(ddy.z)) {
ddy = ddy2;}
// calculate normalvec3 n = cross(ddx, ddy);n = normalize(n);
ddx
ddy n
![Page 19: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/19.jpg)
Sphere Normals Calculated From Depth
![Page 20: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/20.jpg)
Smoothing
By blurring the depth image, we can smooth the surface
Use Gaussian blur Needs to be view-invariant
Constant width in world space -> Variable in screen-space space
Calculate filter width in shader Clamped to maximum radius in screen
space (e.g. 50 pixels) for performance
![Page 21: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/21.jpg)
Sphere Depth
![Page 22: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/22.jpg)
Naively Smoothed Depth
![Page 23: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/23.jpg)
Calculated Normal
![Page 24: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/24.jpg)
Diffuse Shaded Surface
![Page 25: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/25.jpg)
Bilateral Filter
Problem: we want to preserve the silhouette edges in depth image So particles don’t get blended into
background surfaces Solution: Bilateral Filter
Edge-preserving smoothing filter Called “Surface Blur” in Photoshop Regular Gaussian filter is based only
on only distance in image domain Bilateral filter also looks at difference
in range (image values) Two sets of weights
![Page 26: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/26.jpg)
Bilateral Filter Codefloat depth = tex2D(depthSampler, texcoord).x;
float sum = 0;float wsum = 0;for(float x=-filterRadius; x<=filterRadius; x+=1.0) {
float sample = tex2D(depthSampler, texcoord + x*blurDir).x;
// spatial domainfloat r = x * blurScale;float w = exp(-r*r);
// range domainfloat r2 = (sample - depth) * blurDepthFalloff;float g = exp(-r2*r2);
sum += sample * w * g;wsum += w * g;
}
if (wsum > 0.0) {sum /= wsum;
}return sum;
Note – not optimized!
![Page 27: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/27.jpg)
Sphere Depth
![Page 28: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/28.jpg)
Bilateral Filtered Depth
![Page 29: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/29.jpg)
Diffuse Shaded Surface
![Page 30: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/30.jpg)
Bilateral Filter
Bilateral filter is not strictly separable Can’t separate into X and Y blur
passes Non-separable 2D filter is very
expensive But we can get away with
separating, with some artifacts Artifacts not very visible once other
shading added
![Page 31: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/31.jpg)
Diffuse Shaded SurfaceUsing Separated Bilateral Filter
![Page 32: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/32.jpg)
Surface Shading
Why not just blur normals? We also calculate eye-space
surface position from the smoothed depth Important for accurate specular
reflections Once we have a per-pixel surface
normal and position, can shade as usual
![Page 33: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/33.jpg)
![Page 34: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/34.jpg)
![Page 35: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/35.jpg)
![Page 36: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/36.jpg)
Diffuse Shading – dot(N, L)
![Page 37: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/37.jpg)
Wrapped Diffuse Shading – dot(N,L)*0.5+0.5
![Page 38: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/38.jpg)
Specular (Blinn-Phong)
![Page 39: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/39.jpg)
Fresnel Surfaces are more reflective at
glancing angles Schlick's approximation
θ is incident angle cos(θ) =dot(N, V)
R0 is the reflectance at normal incidence
Can vary exponent for visual effect
![Page 40: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/40.jpg)
Fresnel Approximation
![Page 41: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/41.jpg)
Cubemap Reflection
![Page 42: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/42.jpg)
Cubemap Reflection * Fresnel
![Page 43: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/43.jpg)
Final Opaque Surface with Reflections
![Page 44: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/44.jpg)
Thickness Shading
Fluids are often transparent Screen-space surface rendering
only generates surface nearest camera Looks strange with transparency Can’t see surfaces behind front
Solution – shade fluid as semi-opaque using thickness through volume to attenuate color
![Page 45: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/45.jpg)
Generating Thickness
Render particles using additive blending (no depth test) Store in off-screen render target Render smooth Gaussian splats or just discs, and then blur
Only needs to be approximate Very fill-rate intensive
Can render at lower resolution
![Page 46: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/46.jpg)
Volume Thickness
![Page 47: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/47.jpg)
Volumetric Absorption
d
I=exp(-kd)
I=1
Beer's Law Light decays exponentially with distance Use different constant k for each color
channel
![Page 48: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/48.jpg)
Color due to Absorption
![Page 49: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/49.jpg)
Background Image Refracted in 2Dtex2D(bgSampler, texcoord+N.xy*thickness)
![Page 50: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/50.jpg)
Transparency (based on thickness)
![Page 51: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/51.jpg)
Final Shaded Translucent Surface
![Page 52: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/52.jpg)
Shadows
Since fluid is translucent, we expect it to cast coloured shadows
Solution - render fluid surface again (using same technique), but from light’s point of view
Generate depth (shadow) map and color map (thickness)
Project onto receivers (surface and ground plane)
![Page 53: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/53.jpg)
![Page 54: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/54.jpg)
Surface Without Shadows
No Shadows
![Page 55: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/55.jpg)
Surface Without Shadows
Shadow Map
![Page 56: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/56.jpg)
With Shadows
![Page 57: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/57.jpg)
Problems
Only generates surface closest to camera Hidden somewhat by thickness
shading Could be correctly rendered using
ray tracing Multiple refractions, reflections
Possible to ray trace using the same uniform grid acceleration structure used for simulation But still quite slow today
![Page 58: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/58.jpg)
Artifact – can’t see further surfaces through volume
![Page 59: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/59.jpg)
Caustics
Refractive caustics are generated when light shines through a transparent and refractive material
Light is focused into distinctive patterns
![Page 60: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/60.jpg)
Caustics
Image by Rob Ireton
![Page 61: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/61.jpg)
Caustics Algorithm
We use a simple image-space technique Similar to Wyman et al (see refs.)
For each point in light view, calculate ray refracted through surface from light uses surface position and normal
Intersect ray with ground plane Render point splats (“photons”)
with additive blending
![Page 62: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/62.jpg)
Caustics Diagram
surface
receiver
lightimage plane
![Page 63: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/63.jpg)
Without Caustics
![Page 64: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/64.jpg)
With Caustics
![Page 65: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/65.jpg)
Caustics
Note - caustics are only cast on ground plane, not on fluid surface!
Can perform multiple times with different indices of refraction to simulate refractive dispersion (R, G, B)
Quite expensive – requires rendering e.g. 512*512 = 256K points
![Page 66: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/66.jpg)
Adding Surface Detail
Surface can be too smooth Doesn’t show flow well
Solution: add noise Render spheres again, using 3D
noise texture in object-space Moves with fluid
Store in noise render target Can be used during surface shading to
perturb normal
![Page 67: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/67.jpg)
![Page 68: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/68.jpg)
![Page 69: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/69.jpg)
![Page 70: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/70.jpg)
DEMO
![Page 71: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/71.jpg)
Summary
Particle-based fluids are practical for use in games using today’s hardware
Rendering particle-based fluids can be simple and fast
![Page 72: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/72.jpg)
Future Work
Use Compute Shader for more efficient bilateral blur Similar to diffusion DOF
Polygon mesh collisions using BVH Add spray / foam Wet maps Direct3D 11 sample to be released
in SDK soon
![Page 73: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/73.jpg)
Questions?
![Page 74: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/74.jpg)
Thanks
Wladimir J. van der Laan, Rouslan Dimitrov, Miguel Sainz
![Page 75: Screen Space Fluid - Nvidia...Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games Chris Wyman and Scott Davis.](https://reader030.fdocuments.net/reader030/viewer/2022041121/5f357eed45ad9a07b75ae288/html5/thumbnails/75.jpg)
References Robert Bridson, “Fluid Simulation for Computer
Graphics”, A K Peters, 2008 M. Müller, S. Schirm, S. Duthaler, ”Screen
Space Meshes”, in Proceedings of ACM SIGGRAPH / EUROGRAPHICS Symposium on Computer Animation (SCA), 2007
CORDS, H., AND STAADT, O. 2008. “Instant Liquids”. In Poster Proceedings of ACM Siggraph/Eurographics Symposium on Computer Animation
Wladimir J. van der Laan, Simon Green, Miguel Sainz, “Screen space fluid rendering with curvature flow”, Proceedings of the 2009 symposium on Interactive 3D graphics and games
Chris Wyman and Scott Davis. "Interactive Image-Space Techniques for Approximating Caustics." ACM Symposium on Interactive 3D Graphics and Games, 153-160. (March 2006)