Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Get the half angle vector (microfacet normal) */
- H = normalize(exitant - incident);
- /* Get all the dot products. */
- float NdV = abs(incident * normal);
- float NdL = abs(normal * exitant);
- float VdH = abs(incident * H);
- float NdH = abs(normal * H);
- /* Get the half angle vector's angle with the normal. */
- float alpha = acos(H * normal);
- /* Compute the Beckmann distribution term. */
- D = exp(-pow(tan(alpha) / this->roughness, 2));
- /* Normalize the Beckmann distribution. */
- D = D / (PI * pow(this->roughness, 2) * pow(NdH, 4));
- /* Compute the geometric attenuation term. */
- float G = min(1, min(2 * NdH * NdV / VdH, 2 * NdH * NdL / VdH));
- /* ... */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement