Unity3d Hair Real Time rendering real-world hair rendering

Source: Internet
Author: User
Tags asin cos pow sin

Put the effect on first.


I'm recovering from Sylar sauce

The algorithm is Weta digital according to SIGGRAPH2003 's paper to improve, before the improvement of the use of Kajiya and Kay's model, its energy is not conserved, that is, not based on physical, inaccurate



Electron microscope real hair silk fiber photos, we found that there are a lot of overlapping stratum corneum called fur is also called hair scale, their relative root tilt angle of about 3°, approximate model such as



Model of hair fibers
R is reflection (Re?ection), T is penetrating (transmission), which is refraction
This assumes that there are three modes of propagation of light, R, TT, TRT
R is direct reflection,
TT is two times refracted
The TRT is penetrated (refracted) into the inside of the hair, reflected in the inside of the hair, penetrated (refracted) out, detailed


Human hair fiber mainly consists of two parts: the epidermis and the cortex. The epidermis acts as an outer sheath to protect the inner cortical layer, which is important in light scattering, because he is the edge of refraction,
The color of the core of the hair is called medullary, and the pigment in the cortex and medulla determines the color of the hair.
We study the optical properties of hair in two elements: 1. Refractive parameter η (approx. 1.55) 2. Absorption rate of cross-section σ


Geometric graphs such as,
Hair direction from the root to the tip, we assume u is the tan value of the hair, Vector v and W is a right hand standard orthogonal base, the light incident direction is ωi, scattering the direction of the light is ωr, the angle is θi,θr (0° perpendicular to the hair, U is 90°). The azimuth angle around the hair is expressed as φi and Φr (V is 0°w for +90°), and the Difference (ΘI-ΘR)/2 is expressed as θd relative azimuth (φr-φi)/2 for φd. Φr-φi is said to be φ. Average θh = (θi+θr)/2 is half-width.
The absorption of hair mainly depends on the true melanin (eumelanin) and pseudo-melanin (pheomelanin), their concentrations are defined as ρe and ρp, their absorption rate is σa,e and σa,p, the spectral absorption rate of μa =ρeσa,e +ρpσa,p.
The number of changes (refraction, reflection) before the light leaves the hair is p. P∈{r = 0, TT = 1, TRT = 2, TRRT = 3, ...}
The total reflection function S is the sum of all longitudinal scattering (longitudinal scattering) function MP and azimuth scattering function NP product


Our ultimate goal is to add 0-3 of p all S, i.e. R, TT, TRT, TRRT all the rays of light.



longitudinal scattering (longitudinal scattering)
Next is the method of Gaussian MP longitudinal scattering (longitudinal scattering) function.
In cases where the hair is a smooth surface of the perfect arc θr = θi,

reflected on a smooth surface, forming a single cone (left). Because of the rough surface, the MP simulates a surface without a high light, and this cone-like scattering is scaled to the normal plane (right). The light scattering range is wider and the energy decreases.
Because the surface is rough and does not produce perfect specular highlights, Marschner uses a half-width Gaussian function to find MP

<span style= "FONT-SIZE:14PX;" >inlinefixed G (fixed beta, fixed theta) {return pow (E,-(Theta*theta)/(2 * beta * beta))/(sqrt (2 * PIE) * beta); </span>


The G function is a standard Gaussian function with a longitudinal inclination θ, and β is a roughness (standard deviation angle on a longitudinal smooth cone), and αp is a simple function of the inclination of the cortical layer. But the MP energy obtained is not conserved, for the following reasons
1. θ∈{?∞,∞} in the G function, but ΘH∈{?Π/2,Π/2}. Using θh instead of θ will multiply the reflected energy.
2. When θi = Θr, the tapered high-light polarization? Θi to θr involves scaling the cone. Only about 1/cos 2θd in Marschner.
3. Deflection light angle moved a considerable amount of energy resulting in angular greater than Θ∈{?Π/2,Π/2} (angle too large, never received, resulting in energy loss)

We use an MP with conservation of energy.
This method uses spherical Gaussian convolution (Spherical-gaussian convolution) to redistribute the reflection angle in the spherical sphere and obtain

G after a series of deformations to get the final MP:

<span style= "FONT-SIZE:18PX;" >MP = (1/(POW (E, v)-POW (E,-V)) *v)) *pow (E, (sin (-theta_i) *sin (theta_r)/V)) *i0 (cos (-theta_i) *cos (theta_r)/V); &L T;/span>


here v =β2 is the square of the roughness
The I0 function is the first type of Bessel function


The resulting longitudinal scattering curve of energy conservation is as follows

Conical high light is asymmetrical, off-specular Peak is approximate to two-dimensional BRDF all roughness is energy conservation



Azimuth scattering (azimuthal scattering)next calculate the azimuth scattering (azimuthal scattering) Np
Marschner uses the Bravais characteristics in the case of a smooth circular hair, and studies the azimuth scattering in the inner hair fibers.

Fixed refractive index η '
Azimuth change direction φ is related to the offset h∈{?1,1} and P-values in the hair, and the reflection mode is:

Γi = arcsin (h), γt = arcsin (h/η ')



Since h is not available, we are using another method that simulates h
Marschner uses cubic approximation to simulate h, but has not yet verified its accuracy when the P-value is large or the reflection index is low (hair in water)

Roughness azimuth scattering (roughened azimuthal scattering) function NP


We use Gaussian distribution to simulate the effect of a plane surface roughness with a deformation method. Each offset h in the hair fiber produces a continuous distribution DP (Φ?φ (P,H)) of the Azimuth, which is produced by the discrete azimuth φ (p,h) in the Gaussian and smooth hairs in φ. As shown in the following:

Coarse discrete angular scattering (TT): The offset h on a smooth strand can produce a definite azimuth φ (p,h), and the Gaussian distribution DP (Φ?φ (P,H)) of the azimuth can be obtained.
All the emitted rays are integrated together:


A (p,h) is the attenuation caused by light absorption and Fresnel. We use a new standard high-speed distribution function called DP Gaussian detector

<span style= "FONT-SIZE:14PX;" >for (Fixed i =-1; i < 1; i + = 0.1) {mu_a_d = Mu_a/cos (i/eta_d); ref_1 = ACOs (cos (theta_d) * COS (ASIN (i))); F =-_ SC + (1 + _sc) *pow (2, -10 * DOT (ref_1, _eta)); T = exp ( -2 * mu_a_d* (1 + cos (2 * ASIN (I/ETA_D)))); A = POW ((1-f), 2) * POW (F, p-1) * T;//NP + A *DP (Phi-phi_p_h (p, I, eta_d)); Np + = A *DP (phi-phi_p_h (i, Eta_d));} Np *= 0.5;</span>



All of our formulas are finished, and we can use the for loop to accumulate different p-values to get the final result.


The results of the measurement σa,e = {0.419,0.697,1.37}σa,p ={0.187,0.4,1.05} In this paper are relatively true.

Implementation results in the paper

Bloggers are not capable enough to make this kind of hair in unity (feeling that his hair is like a subdivision of the surface) and can only be dine with a better model:



This article is a part of the translation of the blogger's own understanding and implementation, if there is an incorrect place to welcome criticism

Reference:

1. An energy-conserving Hair re?ectance Model

2. Light scattering from Human Hair fibers


-----by wolf96 http://blog.csdn.net/wolf96


Unity3d Hair Real Time rendering real-world hair rendering

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.