|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Computes the fraction of light passing through the object. |
|
|
|
// N.b.: it is not just zero scattering (light traveling in a straight path)! |
|
|
|
// We derive the transmittance function from the SSS profile, by normalizing it s.t. R(0) = 1. |
|
|
|
// Evaluate Int{0, inf}{2 * Pi * r * R(sqrt(r^2 + d^2))}, where R is the diffusion profile. |
|
|
|
// Ref: Approximate Reflectance Profiles for Efficient Subsurface Scattering by Pixar (BSSRDF only). |
|
|
|
float3 ComputeTransmittance(float3 S, float3 volumeAlbedo, float thickness, float radiusScale) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
float3 expOneThird = exp(((-1.0 / 3.0) * thickness) * S); |
|
|
|
|
|
|
|
return 0.5 * (expOneThird + expOneThird * expOneThird * expOneThird) * volumeAlbedo; |
|
|
|
return 0.25 * (expOneThird + 3 * expOneThird * expOneThird * expOneThird) * volumeAlbedo; |
|
|
|
} |
|
|
|
|
|
|
|
void FillMaterialIdStandardData(float3 baseColor, float specular, float metallic, float roughness, float3 normalWS, float3 tangentWS, float anisotropy, inout BSDFData bsdfData) |
|
|
|