presentation - AUEB Graphics Group

advertisement
Introduction | Crepuscular rays and Caustics
• Caustics are high intensity highlights due to convergence of light via
different paths
• Crepuscular rays (godrays) are formed by the in-scattering of light in
dense participating media, like water
• Why are godrays and caustics important?
– Both phenomena present in shallow water environments
– They convey the presence of a dense volume
– Define the proximity and direction of surface and lighting
Introduction | Offline rendering
• Caustics:
– Bidirectional ray tracing
– Particle tracing from light source (sun)
• Local contribution to shading (no gathering step)
• Godrays:
– Ray marching - Integration of in/out-scattering functions over the
line of sight in view direction.
• Monte Carlo integration
• Stratified sampling with constant jittering
Moving to Real Time | Early Approaches
• Caustics
– Render the caustics as an animated
texture
– Projective texturing
– Inverse tracing of rays to a light map
above water using surface vertex data
– Intersect geometric light shafts
(polyhedra) with receiving geometry
• Godrays
– Render godrays as geometry “shafts”
(polyhedra)
– Sample a variable density function on
planes parallel to the view plane.
Moving to Real Time | Particle Tracing?
• Generic GPU-based particle tracing:
– Fully captures the effects
– Unsuitable for real-time rendering (too slow)
• Point-based particle tracing (splatting)
– Can effectively model caustics
– Replaces near-sample search (particle tracing) by point
accumulation
– The approach:
• Considers light-space line segments
• Intersects segments with Z-buffer
• Accumulates point samples in frame buffer
– Does not account for godrays
Our Method | Introduction
• Specialized particle tracing
• Traces particles from the light through the water surface to the
underwater part of the scene
• Handles both caustics and godrays
• Compatible with both direct and deferred rendering schemes
Our Method | Overview
•
•
•
•
•
•
•
•
Render the scene (camera view)  depth buffer
Render the scene (light view)  shadow map
Create photon mask
Cast photons:
– Generate coarse light-space point grid
– Tesselate the grid
– Cast photons and create refracted trajectories
– Intersect trajectories with depth buffer  photon
positions
– Produce underwater godray line segments
Draw (image space splatted) photons  caustics
Draw (image space weighted) godrays
Filter caustics and godrays
Combine results
Mask
Frame Preparation
• Rendering:
– The scene is normally rendered
– We record the frame buffer (in FBO)
– The shadow map of the “sun” light source is
captured
• The above steps are standard to any rendering
engine
• Photon (shadow) mask:
– The shadow map is compared with the water
level
– No photons will be cast for lit points above
water level (outside the water volume)
– Saves on calculations
– Ensures proper shadowing for floating props
Depth buffer
Shadow map
Mask
Photon Tracing | Photon generation
(in light space)
• Render a coarse grid of points
• In a geometry shader:
– Tesselate grid
– Generate primary ray
– Produce refracted ray
– Calculate intersection point
between refracted ray and
shadow map
Photon Tracing | Intersection estimation
• Uses an Newton-Rhapson-like image space (shadow map) estimator
• Approximates the intersection point in two iterations:
A
Water surface
intersection
B
Initial estimate
Water surface
intersection
d
second estimate
Water surface
intersection
Initial estimate
d
projection
projection
final point
Rendering the Caustics | Splatting
• Splatting replaces the photon storage and search stage of
conventional photon mapping
• Photons are transformed to screen space and rendered as points
• We splat the photons by perspectively varying the point primitive size:
– Account for perspective foreshortening
– Ensure adequate blending for photons near view plane
– Avoid excessive overlap for distant photons
• Points are attenuated according to distance from water surface
(absorption)
γ = 9.2W/sr
Rendering the Caustics | Splatting
Rendering the Godrays
• Godrays are rendered as line primitives in screen space
• They are attenuated per fragment accounting for:
– Fragment-to-eye absorption (out-scattering)
– Surface-to-fragment absorption (out-scattering)
– Light-to-viewing direction contribution (in-scattering)
dfromViewer
Line
frags
• Mie scattering is modeled by the Henyey-Greenstein phase function
Post-Filtering
•
•
•
•
In low-intensity areas (poor photon concentration), aliasing may occur
The same goes for the godrays
Both buffers are post-filtered to spread the intensity
We use a rotating-kernel joint bilateral gaussian filter
– Kernel size is modulated by depth
skernel  z  smin  (1  z ) smax , z  [0,1]
Post-Filtering | Caustics
Unfiltered
Filtered
Post-Filtering | Godrays
Unfiltered
Filtered
Putting it All Together
•
•
Godrays + caustics + filtering + SSAO + shadows: 1440X850 @ 60+ fps
800X600 @ 110+ fps
Thank you!
The work presented in this paper is funded by the Athens University of
Economics and Business Special Account for Research Grants (EP-160010/00-1)
Download