程序代写代做代考 algorithm data structure 10: The OpenGL Pipeline

10: The OpenGL Pipeline

15: Real-Time Water

COMP5822M: High Performance Graphics
Water = Simulation
Getting water right always means simulation
We’re only interested in rendering it now

COMP5822M: High Performance Graphics
Caustics
Characteristic dappled look of water
Light reflects/refracts from a curved surface
Also happens with glass objects (bottles)

COMP5822M: High Performance Graphics
Rendering Caustics
Ray-traced is not a problem
Impulse refraction / reflection does it fine
So we’re really interested in real-time
Object space techniques (not real time)
Image space techniques (texture tricks)

COMP5822M: High Performance Graphics
Interactive Caustics
Caustics are an integral over multiple rays
Highlights occur where rays converge
Inherently high-frequency
So blurring doesn’t work well

COMP5822M: High Performance Graphics
Image Space Caustics
Two-Pass algorithm (Davis & Wyman 2006)
Pass 1: Scatter Pass
Emit photons from light source
Identify which surfaces they strike
Store in a caustic map (like shadow map)
Pass 2: Gather Pass
Sum contributions after refraction

COMP5822M: High Performance Graphics
Caustic Mapping
Render from light source
Store in image buffer
Shows which surfaces are lit
First diffuse surface struck
Stores x,y,z
Also store photon direction / intensity
Integration done separately

COMP5822M: High Performance Graphics
Quad Photon Gathering
Connect photons in light-space to form quads
Compute energy of the beam of light
It will spread out in the image plane

COMP5822M: High Performance Graphics
Beam Distortion
R is the ratio of caustic light to regular light
Approximate by projection to unit sphere
This gives an estimate of amount of light

COMP5822M: High Performance Graphics
Caustic Polygon Intensity

Intensity
at
Direct Lighting
Refracted Lighting
Computes a scale factor for indirect lighting
Assumes refraction is uncoloured

COMP5822M: High Performance Graphics
Caustic Polygon Render
Draw each caustic polygon separately
Composite with alpha-blending
Adds extra light to the surface
But costs in terms of render time
Precompute the caustic map
As long as we only change viewpoint
But this can cause aliasing

COMP5822M: High Performance Graphics
Result:

No Caustics
Caustics
Caustic polygons

COMP5822M: High Performance Graphics
Nearby Neighbour Gathering
Avoids object-space texture increments
And complex 3D data structures
Three steps:
Render photons to eye/light-space buffer
Count contributions of photons to texels
Render final scene, reading from texture

COMP5822M: High Performance Graphics
NN Gathering Idea
Essentially a form of render to texture
Real time light map after refraction

COMP5822M: High Performance Graphics
NN Gathering

Direct Lighting
Caustic Lighting
With average incident photon direction
With approximate direction (less common)

COMP5822M: High Performance Graphics

Surrounding Pixels
For each pixel
Search a 7×7 pixel neighbourhood
Compute area covered by nearby pixels
In world-space
Approximate lighting for each neighbor
Weight contributions with a Gaussian
Denoise by discarding if < 3 photons hit COMP5822M: High Performance Graphics Compared w/ Photon Maps COMP5822M: High Performance Graphics Hierarchical Caustic Maps Mipmap the caustic maps Most photons do not hit refractor Early discard photons that do nothing COMP5822M: High Performance Graphics Height Field Caustics Caustic map for surface not light source Assume a flat finite plane Result maps caustics onto the plane Grey scale gives incoming light intensity http://www.cemyuksel.com/research/heightfield_caustics/fastcaustics.pdf COMP5822M: High Performance Graphics Caustics Computation For each pixel, define illumination centre (R) Sum all refractions through rectangle So long as R is large & heightfield is small COMP5822M: High Performance Graphics Caustics Passes Pass 1: X-Direction Caustics Pass 2: Y-Direction Caustics COMP5822M: High Performance Graphics Pass 1: X-Direction 1A: Illumination centre per caustic pixel n 1B: Find M neighbouring pixels in Y n 1C: Forward project height field samples 1D: Project intensity (2 pixels each) COMP5822M: High Performance Graphics Pass 2: Y-Direction Now sum across Y-direction of pixels Implemented in fragment shaders COMP5822M: High Performance Graphics Results - Static COMP5822M: High Performance Graphics Real-Time Results COMP5822M: High Performance Graphics Off-Line Results COMP5822M: High Performance Graphics Online Resources https://dl.acm.org/citation.cfm?id=1111439 https://dl.acm.org/citation.cfm?id=1342276 http://www.cemyuksel.com/research/heightfield_caustics/fastcaustics.pdf https://cg.tuwien.ac.at/courses/Seminar/WS2007/arbeit_fleck.pdf COMP5822M: High Performance Graphics