

VEX hair shader 
arno_hair_far_field
																													
parametric far field hair / fiber shader:

- physically based (full implementation of Marschner et al. plus some additional corrections of the formulae)
- for hair with noncircular (elliptic) cross section
- distant viewer & distant light sources	
- includes three scattering components: 

R:   direct backward reflection (white)
TT:  one time forward transmitted (colored, very strong when there is a light source from behind)
TRT: backward transmitted-internal reflected-transmitted (colored)

Note:

All parameters passed to the shaders are local ("per vertex" + interpolation) parameters unlike the standard VEX hair shader.
Please let me know if you need a  per hair ("per primitive") version of this shader with tip / root parameter sets. 

history:	 
-------														

version 0.1 (3.01.05)
	first build 
version 1.0 (17.01.05)
	fixed: a_caustic: float -> vector
	fixed: caustic intensity estimation 
version 1.1 (21.01.05)
	fixed: opacity hack: theta_r -> abs(theta_r)
	fixed: opacity hack: linear interpolation instead of smooth(), opacity_offset 
version 1.2 (25.01.05)
	fixed: 1/theta_d instead of 1/theta_d2
	fixed: no need of major_axis vector for circular hair now (eccentricity = 1)
version 1.3 (9.02.05)
	fixed: ambient illumination
	fixed: history :)
version 1.4 (14.03.05)
	fixed: removed n_TRT = set (0.,0.,0.)
	fixed: fresnel cos_theta = 0 -> return 1.
	fixed: opacity for each color component
	fixed: floating point consistency !!!!!!
	

copyright:
----------

All copyrights (c) 2004 Arno Zinke
Please do not modify without my permission !

contact:
--------

If you need support, or other sophisticated (simplified & ultra fast, more accurate, near field: for close-ups & light hair)
fiber shaders, parameter settings or if you have any comments feel free to contact me... 

www.gfar.de
zinke@gfar.de

 

external parameters:
--------------------


matrial properties
------------------


//shifts of the modes with respect to specular cone
longitudinal_shift_R
longitudinal_shift_TT
longitudinal_shift_TRT

// width of the modes
// to be more precise: 0.5/(width*width)
longitudinal_width_R			
longitudinal_width_TT			
longitudinal_width_TRT			

// glint scale factor
glint_scale					

// azimutal width of the caustic
azimutal_caustic_width		

// fade range of the caustic
fade_range_caustic_merge		

// intensity limit of the caustic
caustic_intensity_limit		

// to scale the intensity of each mode independently
// these factors could be used for normalization purposes widht respect to the widths (for the Gaussians: 1/(sqrt(2*PI)*width))
scale_R
scale_TT					
scale_TRT					

// absolute absorption coefficients per unit length (for: red, green, blue)
float absorption_coefficient_r		
float absorption_coefficient_g		
float absorption_coefficient_b		

// diffuse color
// could be set with respect to absorption coefficients: exp(-1.5*absorption*radius)
diffuse_color

// diffuse intensity
diffuse_intensity			

// ambient color
// could be set with respect to absorption coefficients: exp(-2.0*absorption*radius)
ambient_color

// ambient intensity
ambient_intensity			


// the ratio between index of refractions inside the hair and sourounding medium (ior_inside/ior_outside)
index_of_refraction_ratio

// this factor limits the intensity factor due to projection of the solid angle
_1_div_cos_max_theta	

// factor for opacity correction
opacity_factor

// offset for opacity correction
opacity_offset


opacity = 1. - (opacity_offset - opacity_factor * theta_r) * TT_color + diffuse_intensity * ({1.,1.,1.} - diffuse_color)

geometrical properties
----------------------

// fiber cross section radius
radius

// eccentricity (minor / major) of fibers cross section
eccentricity				

// (unnormalized) local fiber tangent direction (for hairs: points from root to top)
vector tangent

// unnormalized direction of the local  semi major axis vector
// basically a vector which is projected onto the local cross section plane
// and then defines the semi major axis of a noncircular cross section
// for a circular cross section every vector, which is not parallel to hair tangent will do 					 
vector major_axis



internal parameters:
--------------------

// ratio between perpendicular and parallel polarized light
// usually 0.5 (unpolarized)
_per_par_polarization_ratio
 																															 																					
