|
|
|
|
|
|
bsdfData.ior = ior; |
|
|
|
|
|
|
|
// IOR define the fresnel0 value, so update it also for consistency (and even if not physical we still need to take into account any metal mask) |
|
|
|
bsdfData.fresnel0 = lerp(ConvertIORToFresnel0(ior).xxx, baseColor, metallic); |
|
|
|
bsdfData.fresnel0 = lerp(IORToFresnel0(ior).xxx, baseColor, metallic); |
|
|
|
// Absorption coefficient from Disney: http://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_notes.pdf |
|
|
|
bsdfData.absorptionCoefficient = -log(transmittanceColor + 0.00001) / max(atDistance, 0.000001); |
|
|
|
bsdfData.absorptionCoefficient = TransmittanceColorAtDistanceToAbsorption (transmittanceColor, atDistance); |
|
|
|
bsdfData.transmittanceMask = transmittanceMask; |
|
|
|
bsdfData.thickness = max(thickness, 0.0001); |
|
|
|
} |
|
|
|
|
|
|
preLightData.transmissionRefractV = refraction.rayWS; |
|
|
|
preLightData.transmissionPositionWS = refraction.positionWS; |
|
|
|
preLightData.transmissionTransmittance = exp(-bsdfData.absorptionCoefficient * refraction.distance); |
|
|
|
preLightData.transmissionSSMipLevel = PerceptualRoughnessToMipmapLevel(bsdfData.perceptualRoughness, uint(_GaussianPyramidColorMipSize.z)); |
|
|
|
// Empirical remap to try to match a bit the refractio probe blurring for the fallback |
|
|
|
preLightData.transmissionSSMipLevel = sqrt(bsdfData.perceptualRoughness) * uint(_GaussianPyramidColorMipSize.z); |
|
|
|
#else |
|
|
|
preLightData.transmissionRefractV = -V; |
|
|
|
preLightData.transmissionPositionWS = posInput.positionWS; |
|
|
|