Ray differentials are widely used in physically based rendering system for the purpose of texture mapping and particle tracing. While it is easy to trace and calculate the ray differentials of the light transport phenomenons like reflection and refraction, tracing ray differential of BRDF glossy reflection is not easy for usually BRDF sampling will introduce two random numbers. Here we decide to calculate the precise result for glossy reflections for most types BRDF models.
I won't repeat the definitions here. What we concerned more is the differential of ray direction.
1. Phong Models
In phong models importance sampling we will sample an solid angle between the direction R(pure reflection vector) and wo(the out direction of the phong reflection). The general approach is building a tangent frame of specular vector, like the figure below
While we use two random numbers to sample the two angles:
If we assume the sampling function is:
we can easily represent the sample direction like:
In which, U and V are two vetors which will construct the tangent frame with vector R.
Then, we can calculate the differentials for every term in the formula by using the chain rule. Which we will get:
By observing the three term we can easily find out that all the dHdx term is zero(h is just the function of random numbers), and dRdx is easily calculated(see "tracing ray differentials"). The only problems are calculating differentials of U and V. We will solve these step by step.
First we can represent U as the function of R,
The problem is the normalization, we can write it as:
We can finally calculate this as:
For V, we know it is the cross product of U and R, we will apply the differential rules of cross product:
All the differentials are known in this formula so we could easily get dVdx.
2. Microfacet models
In microfacet models like blinn; beckmann or GGX. We will sample an half vector:
Then we deriavte the output direction. Then we can have the differentials:
Generally we sample the H vector in the tangent frame of normal vector. As the derivations before, we can calculate each term in H by using the chain rule. But one thing lucky is that dNdx is always so small that we can treat it as zero. So let dHdx be zero won't cause big problem. We can have:
3. Results
Using the path differentials in texutre mapping we can get more robust results for the benefits of texture mapping.
PS:写的也比较粗糙,权当草稿了。。
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。