The principle of refraction is the use of a spherical Gaussian approximation of the BTDF
The source of the refracted light needs to be considered, and it is common to think of environmental mapping (IBL) or grab texture, but the refraction light does not all come from a plane, so select the environment map as the refraction light.
The effect is mainly btdf to calculate refraction light, and BRDF to calculate the reflected light of the object, both plus and that is the final result.
The parameters we need to use
Our final implementation formula is:
Fr is brdf,ft is BTDF.
Fr
We first review the BRDF, because BTDF also need to use BRDF knowledge. Detailed BRDF Please see this article:Unity3d based on physical rendering physically-based rendering specular BRDF
BRDF to simulate the real world lighting is mainly to do energy conservation, we have some rendering model to achieve.
such as the specular model: Phong,blinn-phong
Diffuse reflection Model: Lambert,oren-nayar
According to the MIRCOFACET model, the specular reflection formula for FR is:
The MIRCOFACET model is a smooth micro-plane with many different directions (roughness) on the assumption plane, which simulates the reflection of roughness.
which
The d term represents the normal distribution function, and the normal distribution functions
Represents the probability of distribution of the Mircofacet center normal and the orientation of any direction (half-vector) within the hemisphere
The f term represents the Fresnel function
Fresnel reflection is simply the reflection of the surface of the object, and your line of sight and the size of the surface normal angle of the relationship between the line of sight and normal angle, the lower the reflectivity, the more easily see the natural color and texture of the object itself, the opposite angle is larger, the greater the degree of reflection.
The G term is a geometric decay term (Geometry attenuation Factor)
Number of incident/reflected light (visibility function) Considering the occlusion of the MIRCOFACET micro-plane
Ft
Fr solved, let's see the FT formula again.
The ωi is the incident light, and the ωo is the emitted light, which reflects the light.
Half-width vector with ωht as refraction
F,d,g is the same as BRDF, but note that incoming parameters are different
Adding the roughness by adding the variable KG,KD to the G and D items
KG is:
KD controls roughness for variable variables
The resulting improved D function is
Results
Add them together,
Test Engine: Unity 5.0
Reference: Real-time Rough refraction
Blogger's recent rendering: 2016 rendering
----by wolf96
Unity3d BTDF Real-time refraction simulates a translucent object with roughness