Graphics Reference
In-Depth Information
hairEdgePositions [1] = mul ( hairEdgePositions [1] , g_mViewProj );
// Output after screen space expansion
Output . Position = hairEdgePositions [ offDirIndex ]+
hairEdgePositions [ offDirIndex ]. w ￿ OffsetDir [ localVertId ] ￿
float4 ( proj_right [ idx ] ￿ 0.71 f / g_WinSize ,0.0 f ,0.0 f );
Output . Tangent = t [ idx ];
Output . WorldPos = v [ idx ];
// Used for image
based antialiasing ,
// for having the nearest edge positions of
// the hair fiber in the pixel shader
Output . p0 = hairEdgePositions [0]. xy / hairEdgePositions [0]. w ;
Output . p1 = hairEdgePositions [1]. xy / hairEdgePositions [1]. w ;
return Output ;
space
}
Listing 5.1. The vertex shader that performs the hair geometry expansion.
5.3 Lighting
After the geometry expansion occurs in the vertex shader, lighting calculations
follow as one of the first steps in the pixel shader during the hair geometry pass.
The lighting calculations for the hair stem from a fur rendering model in-
troduced by [Kajiya and Kay 89], as well as from work done by in [Marschner
et al. 03]. The lighting equation in [Kajiya and Kay 89] provides a basis for
the lighting with a tangent-based diffuse and specular component. Hair lighting
in [Marschner et al. 03] is based on an analytical approach and adds the concept
of a dual specular highlight. The result of combining these two works can be seen
in a presentation by Scheuermann, where a practical real-time lighting equation
is defined for hair [Scheuermann 04].
5.3.1 Diffuse
The diffuse component is based on applying lambert diffuse lighting to a cylinder.
Kajiya's paper [Kajiya and Kay 89] provides a derivation of the diffuse compo-
nent, which is found by integrating along the circumference of a half cylinder
and accumulating the reflected diffuse component along that circumference. The
derivation ends with a simple equation for the diffuse component:
K d sin( t, l ) ,
where K d is the diffuse reflectance, t is the hair fiber tangent, and l is the light
vector. Given this derivation, the diffuse component will be strongest when the
light direction is perpendicular to the tangent of the hair.
Search WWH ::




Custom Search