程序代写代做代考 10: The OpenGL Pipeline

10: The OpenGL Pipeline

16: Subsurface Scattering & Skin Rendering

COMP5822M: High Performance Graphics
The Uncanny Valley

COMP5822M: High Performance Graphics
Skin Appearance
Perceptually important to humans
Needs high detail
And subsurface scattering (“the glow”)

COMP5822M: High Performance Graphics
Skin Scattering
Human tissue has subsurface scattering
Very expensive to ray-trace
Strongly affected by wavelength

COMP5822M: High Performance Graphics
Subsurface Scattering
Light bounces around inside object
Gets absorbed, or exits somewhere else
Can be single (1 bounce) or multiple

COMP5822M: High Performance Graphics
Subsurface Approximations
Normal Blurring
Texture Space Diffusion
Depth Map Techniques

http://giga.cps.unizar.es/~amunoz/projects/EG2011_bssrdf/

COMP5822M: High Performance Graphics
Normal Blurring
Multiple scattering can be seen as diffusion
Angular dependence greatly reduced
Equivalent to blurring the normal / angle

Stam 1995 https://d2f99xq7vri1nk.cloudfront.net/legacy_app_files/pdf/egwr95.pdf

COMP5822M: High Performance Graphics
Extending Normal Blurring
Analytical BSSRDF model: Jensen et al https://graphics.stanford.edu/papers/bssrdf/bssrdf.pdf
Diffusion blurring only affects diffuse term
Apply normal map to specular only

BRDF
BSSRDF

COMP5822M: High Performance Graphics
Texture Space Diffusion
Render the diffuse lighting to a texture
Blur the texture
Render the surface

Borshukov and Lewis http://scribblethink.org/Work/Notes/fastsubsurface_web.pdf

COMP5822M: High Performance Graphics
Depth Map Techniques
Refraction on entry to material is ignored
Refraction on exit is modelled
Depth map defines which surface point
So back trace and sum multiple samples

COMP5822M: High Performance Graphics
Skin Reflectance
Oily layer gives near-specular reflectance
But still has small-scale irregularities
Modelled by specular BRDF
Often a physical model

COMP5822M: High Performance Graphics
Skin Subsurface Reflectance
Light not surface-reflected enters tissue
Absorbed / scattered multiple times
Different tissues have different properties
Typically, at least two layers are modelled

COMP5822M: High Performance Graphics
NVIDIA’s Skin System
Specular component (oily reflection)
Analytic BRDF (Kelemen and Szirmay-Kalos 2001, http://www.hungrycat.hu/microfacet.pdf)
Similar to Torrance-Sparrow but cheaper
Subsurface scattering component
Sum-of-Gaussians for diffusion profiles
Modified texture-space diffusion
Transmission via translucent shadow maps
https://dl.acm.org/citation.cfm?id=882433, https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch14.html

COMP5822M: High Performance Graphics
Specular Surface Reflectance
Phong lighting breaks down at grazing angles

COMP5822M: High Performance Graphics

Skin Specularity
Oily layer is dielectric – no colour to reflection
Means we can paint m and onto face
Provides subtle differences for variation
E.g. makes lips & nose shinier

COMP5822M: High Performance Graphics
Factoring BRDFs
Break the BRDF into multiple 2D textures
Use Beckmann distribution function for BRDF
Use Schlick to approximate Fresnel term
Combine to allow roughness m to vary

COMP5822M: High Performance Graphics
Specular BRDF
Evaluated analytically in fragment shader
specularLight += lightColor[i] * lightShadow[i] * rho_s
* specBRDF( N, V, L[i], eta, m) * saturate( dot( N, L[i] ) );
Fresnel term, geometric attenuation
Index of refraction for Fresnel (skin – 1.4)
Roughness parameter m
Fresnel term approximation from Schlick,1993
float fresnelReflectance( float3 H, float3 V, float F0 )
{
float base = 1.0 – dot( V, H );
float exponential = pow( base, 5.0 );
return exponential + F0 * ( 1.0 – exponential );
}

COMP5822M: High Performance Graphics
Subsurface Diffusion
We need to integrate a small local region
Summing light from small neighbourhood
We model this with a diffusion profile
Jensen et al. 2001, https://dl.acm.org/citation.cfm?id=383319

COMP5822M: High Performance Graphics
Diffusion Profiles
How far light scatters before exiting
Dependent on wave length
But generally uniform over the surface
And generally uniform radially

COMP5822M: High Performance Graphics
NVIDIA’s Sum of Gaussians
Gaussian distributions are radially uniform
Sum several to get good profile
Depends only on distance

COMP5822M: High Performance Graphics
Advanced Subsurface
Each Gaussian distribution handled separately
Generates multiple blurred textures
Combined in final render pass
Translucent shadow maps for thin regions

COMP5822M: High Performance Graphics
Texture Distortion
We want area-preserving parameterisations
So blurring is accurate
But textures are always distorted
By an amount related to the Jacobian matrix

COMP5822M: High Performance Graphics
Distortion Correction
Compute a stretch map
Amount of geometric distortion
Use this to weight the texture blurring
Usually separate in u,v coordinates
Since these distort by different amounts

COMP5822M: High Performance Graphics
Texture Space Diffusion
Render shadow maps
Render stretch map
Render irradiance to texture
For each Gaussian:
Blur in U
Blur in V
Render mesh in 3D

COMP5822M: High Performance Graphics
Texture Blurring
Vertex shader unwraps mesh to texture
Fragment shader produces irradiance texture
Compute 6 Gaussian blur textures
Blend all 6 in final step

COMP5822M: High Performance Graphics
Stretch-Correction

COMP5822M: High Performance Graphics
Translucent Shadow Maps
Model light transmitting through thin regions
Often distant in texture space
Compare depth of front & back surfaces

COMP5822M: High Performance Graphics

Translucent Shadow Maps
C is shadowed
But lit anyway
Transmission from A
Simplify the problem
Take B on perpendicular
For small angles, this works

COMP5822M: High Performance Graphics
Translucency Results

COMP5822M: High Performance Graphics
Scattered Diffuse Colour
Diffuse colour can be applied:
Before scattering
After scattering, but before specular
After specular

COMP5822M: High Performance Graphics