CS代考计算机代写 gui CS580

CS580

Shading Observations
and Related Topics
Ulrich Neumann
CS580
Computer Graphics Rendering

Observations
Highlights often affect only a small portion of a scene or model surface
Classic problem for
adaptive methods
Cho’94 580 project
For mobile platforms, web graphics, or games the specular term is disabled for efficiency and to hide coarse model tessellation
Use a subset of Gouraud (color interpolation) shading that only computes ambient and diffuse terms
a subset of the shading equation

Non-Uniform Scaling
All transforms for our HW contain only R, T, S – where S is a uniform scale applied equally to all dimensions
If we allow non-uniform scale factors, we have to solve a problem that arises with the scaling of Normals
For example – consider a non-uniform scale of 0.5 in X :

………

A non-uniform scale alters the relationship between the surface orientation and a Normal vector
This occurs if we use the same matrix M for transforming the Normals that is used for transforming the vertex coordinates
We can fix this by using a different transformation Q = f(M) for transforming the Normals

N
N’
0,0,0
0,0,0
X – axis

Q for Non-Uniform Scaling
Take any point P in a plane and the plane norm N

N•P = 0 (P plane includes the origin)
N and P written as column vectors

N = (A, B, C)T, P = (x, y, z)T
NT P = 0 is the matrix-product form of the dot product above
If we transform the point P by M (any rotation or scaling transform), then we need to find Q so that (QN)T (MP) = 0
NT QT M P = 0, since (QN)T = NT QT
If QT M = K I, the above eq is satisfied (K can be any constant)
Let’s pick K = 1, then QT = M-1 or Q = (M-1)T

Transform Norms by: Q = transposed-inverse of Xim = (Xim-1)T
Build the Xn stack so that: Xn = (Xim-1)T

For HW4, Xim has uniform scaling, so after removing translation:
Xim-1 = XimT so (XimT)T = Xim Xim = Q = (Xim-1)T
So there is no need to compute Q for HW4

N
0,0,0
P

Use Q for the Xn Transformation
If Xim has non-uniform scaling, we must compute and use Q on the Xn stack
Compute Q = (M-1)T for each M pushed on the Xg stack.
Push Q onto the Xn stack to allow non-uniform scaling

If we push multiple Q on Xn do we get the correct transposed-inverse on the stack?
First we push A, then we push B:
((A B) -1) T = ((B-1 A-1)T = (A-1)T (B-1)T
So, yes, if we push the transposed-inverse of A and B, we get the transposed-inverse of AB (concatenated)

*** Reminder: For a unitary rotation matrix, the inverse transpose is itself. There is no need or point in computing Q for HW4 since we limit Xim to uniform scaling. Translation and Scale are removed to leave only pure rotations for Xn.

Option: Model Space lighting (MSL)
In this case, we need to transform L and E back to model space using inverse transforms

For HW4 we have image-space lights so we must build the inverse of Xn = (Xim)-1, and use it to transform L into model space
If we ensure (Xim)-1 is a pure rotation, the L vector lengths remain normalized

Transform all image-space L vectors into model space each time the Xn matrix is changed. Different models/triangles may use different model matrices.

Eye/camera direction is known in image space (0,0,-1), so it also must also be transformed into model space each time the Xn matrix is changed

Orthonormal Rotation Matrix
Matrix Normalization is needed to keep scaling uniform and remove shears during sequence of incremental rotations from GUI manipulations or animation script
not a HW issue – but needed when 100’s of sequential transformations are done (interactive apps)

Gram–Schmidt Orthogonalization process uses matrix rows r1, r2, r3, (or cols) to form orthogonal basis R1, R2, R3. Normalized R1, R2, R3 yield an orthonormal or pure rotation transformation.
R1 = r1
R2 = r2 – R1 (r2•R1)/(R1•R1)
R3 = r3 – R2 (r3•R2)/(R2•R2) – R1 (r3•R1)/(R1•R1)

Shading Physics
Many materials are not really smooth or uniform at microscopic scale
Small-scale N variations are averaged over macro-scale area

The surface structure impacts light reflection in ways that are not captured in our simple reflectance function
Specular intensity changes with incident angle
Highlight color changes with incident angle due to diffraction effects at varied wavelengths

Other Shading Models
There are other models of illumination that approximate various reflectance effects
Torrance Sparrow (1966) model
based on microfacet distribution
(FvD chapt. 16)
Increased specular reflectance at grazing angles

Other Shading Models (2)
Cook Torrance (~1978) models

Color shift of specular reflections at grazing-angles (see outlined areas)
Color at grazing-angles shifts towards the light source color

Metals (and most natural materials) show similar diffuse and specular color (Kd, Ks) at nominal angles
Plastics have different Kd, Ks at nominal angles (Ks is often just white)

1
2
3

Other Shading Models (3)
Kajiya (1985) modeled anisotropic shading based on Cook Torrance model
Reflectivity (K-terms) are not symmetric about the surface normal
Directional shading is needed for brushed metal, cloth, hair, etc.
Surface normal and tangent define surface orientation (grain-direction)
Cross product produces “binormal” to create local coordinate frame at all surface points

BRDF Definition
General case of reflectance ratio  at a point p is defined by:
Bi-direction Reflectance Distribution Function (BRDF)
(p) = f(, i,  i,  e,  e)
5D function of:
Wavelength  and Light and Eye directions (each 2D angles)

BRDF Measures
5D reflectance function is measured with special instruments called a goniometer, or a light stage, or similar …

BRDF Representations
Approximate BRDFs with coefficients of basis functions
(spherical harmonics) or look up tables (LUTs)

Note: texture-maps are LUTs
structured for fast calculations
during the shading process

Semi-Local Shading
SSS = Subsurface Scattering
Bi-Directional Scattering-Surface Reflectance Distribution Function
A Practical Model for Subsurface Light Transport
Henrik Wann Jensen, Stephen R. Marschner, Marc Levoy, Pat Hanrahan, Stanford University
Siggraph 2001

A “local” volume
phenomena
Many local incident
raysinteract with the
surface to impact an
outgoing ray

E
E

Simi-Local Shading
AO = Ambient Occlusion
Local geometry impacts how much ambient light reaches a surface point
Estimate fraction of hemisphere that is open to ambient light at each shading calculation point
Rays sample local geometry over a hemisphere

Nelson Max (1986) Shadows for
Bump-Mapped surfaces. In: Kunii TL (ed) Advanced Computer Graphics. Springer, Tokyo Berlin Heidelberg New York, pp 145–156

The General Rendering Equation
A generalization is presented as a “rendering equation” by Kajiya (1986)

x, x’, x” are points in environment (set x as camera focal point, for example)
I(x,x’) is radiance of all light reflected from all points x’ to x (camera).
g(x,x’) is geometry term that models occlusion between x’ and x (0 or 1/r2)
(x,x’) is radiance of light source emitted from x’ to x (light source at x’)
Integral is taken over all environment points x” of light heading to point x’ and reflecting to x. (all surface points x’’ illuminate x’)
I(x’,x”) is radiance of light from x” to x’.
(x, x’, x”) is surface reflectivity function (BRDF) of surface point x’, given x and x” – also has to include light transmission if x’ is translucent material.
Solving this for any case depends on what we set constant, what we ignore, and what functions we use to model/approximate real physical behaviors. E.g., Integration is generally approximated as summation.

I(x,x’)g(x,x’)(x,x’)(x,x’,x”)I(x’,x”)dx”
s






