10: The OpenGL Pipeline
12: Fur Shading
COMP5822M: High Performance Graphics
Texturing Problems
Nearly anything can be mapped to a surface
We will look at one in particular: fur
Very fine short hairs growing on a body
COMP5822M: High Performance Graphics
Basic Idea
Fur is made up of many hairs – > 1,000,000
We could try rendering each one
But it’s too expensive, and they’d alias
They’re all (roughly) the same length
So there’s a region of space full of them
Extending a short distance from the surface
I.e. we have a volume rendering problem
COMP5822M: High Performance Graphics
Refresh: DVR
Raytraced
Very very slow
But accelerated
Shear-warp
I.e. slice-based
COMP5822M: High Performance Graphics
Basic DVR
Loops through each pixel
For each pixel, loops along ray
Assume steps are 1 unit (for now)
COMP5822M: High Performance Graphics
Shear-Warp
Invert the loops
Converts it to a set of textured sheets
This is just
image compositing
COMP5822M: High Performance Graphics
Fur Modelling
Treat the hairs as occluding light
And contributing colour
Store “fur” in a volume grown out from body
As a set of textures
Keep the opacity binary (0/1)
And use Perlin noise to generate colour
COMP5822M: High Performance Graphics
Fur Shells
Meyer & Neyret 1998, Lengyel & al. 2001
Fur rendered as a volume around the body
Using textures for the DVR
COMP5822M: High Performance Graphics
Fur Shell Rendering
COMP5822M: High Performance Graphics
Fur Silhouettes
This breaks down a little at silhouettes
So we add artificial silhouettes
By adding fins
Quads drawn upwards from the surface
Textured (again) with the volume data
COMP5822M: High Performance Graphics
Silhouettes
Any edge connects two triangles
One triangle points toward the eye
The other points away from the eye
Test this with triangle normals (not vertex!)
COMP5822M: High Performance Graphics
Fins & Shells
Shells Only
Fins Only
Shells and Fins
COMP5822M: High Performance Graphics
Lengyel’s Approach
Input: Triangle Mesh, Vector Field on Mesh
Geometry Pre-Processing:
Compute texture patches on surface
Texture Pre-Processing:
Grow geometric model of patch of hair
Sample it to construct shell & fin textures
Runtime: render textured shells & fins
COMP5822M: High Performance Graphics
Geometry Pre-processing
Pick a set of random locations
Grow patches outwards until they meet
Lapped textures (http://hhoppe.com/lapped.pdf)
Parameterise each patch in texture domain
I.e. construct a surface parameterisation
COMP5822M: High Performance Graphics
Hair Patch Modelling
Choose seeds for each hair
Grow outwards
Use vector field to direct growth
COMP5822M: High Performance Graphics
Shell Pattern Generation
Simple Random Pattern
Each hair grows outward
Possibly biasing by vector
Until known length
Fixed density for all layers
http://www.xbdev.net/directx3dx/specialX/Fur/index.php
COMP5822M: High Performance Graphics
Advanced Shell Pattern
Hair length differs
Terminate some early
Gives varying density
Varying density across layers
http://www.xbdev.net/directx3dx/specialX/Fur/index.php
COMP5822M: High Performance Graphics
Shell Texture Construction
For each z, create a separate texture
Write (render) the hair into it
Then stack the textures to get a volume
COMP5822M: High Performance Graphics
Fin Texture Construction
Fin textures are just cross-sections
So take one cross-section and store it
Or store everything in a volume texture
COMP5822M: High Performance Graphics
Run Time Fur Rendering
Render the base surface
Render the fins with opacity
Render the shells with opacity
COMP5822M: High Performance Graphics
Fin Construction
For each edge in the mesh
Test whether it is a silhouette edge
COMP5822M: High Performance Graphics
Shell Construction
For each vertex in the mesh
Add weighted normal vector to the vertex
Use new vertex position instead of old
Render the triangles in new positions
COMP5822M: High Performance Graphics
Vertex Shader(s)
Separate pipelines for base, fins and shells
Base: as usual
Fins: call once
Render opacity texture
Shells: call multiple times
Each time with a larger distance weight
Render opacity texture
COMP5822M: High Performance Graphics
Implementing This
We will provide:
Sphere & bunny models
Texture image for shell(s) & fins
So you can do the basic version
For the advanced version:
Compute your own textures
Using a compute shader
COMP5822M: High Performance Graphics
Fin Generation
We only render fins on silhouette edges
In Geometry Shader or on CPU
For each edge, (pre-) compute triangle normals
Take dot products with eye direction
Compare for opposite signs
If fin is silhouetted, generate quad
Easiest to do on CPU (first)
COMP5822M: High Performance Graphics
State of the Art
https://cseweb.ucsd.edu/~ravir/paper_fur.pdf
COMP5822M: High Performance Graphics