|
|
|
|
|
|
// bake lighting function |
|
|
|
//----------------------------------------------------------------------------- |
|
|
|
|
|
|
|
// GetBakedDiffuseLigthing function compute the bake lighting + emissive color to be store in emissive buffer (Deferred case) |
|
|
|
// GetBakedDiffuseLighting function compute the bake lighting + emissive color to be store in emissive buffer (Deferred case) |
|
|
|
float3 GetBakedDiffuseLigthing(SurfaceData surfaceData, BuiltinData builtinData, BSDFData bsdfData, PreLightData preLightData) |
|
|
|
float3 GetBakedDiffuseLighting(SurfaceData surfaceData, BuiltinData builtinData, BSDFData bsdfData, PreLightData preLightData) |
|
|
|
{ |
|
|
|
if (HasFeatureFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_SUBSURFACE_SCATTERING)) |
|
|
|
{ |
|
|
|
|
|
|
float3 modifiedDiffuseColor = ApplySubsurfaceScatteringTexturingMode(texturingMode, bsdfData.diffuseColor); |
|
|
|
|
|
|
|
// Apply the albedo to the direct diffuse lighting (only once). The indirect (baked) |
|
|
|
// diffuse lighting has already had the albedo applied in GetBakedDiffuseLigthing(). |
|
|
|
// diffuse lighting has already had the albedo applied in GetBakedDiffuseLighting(). |
|
|
|
diffuseLighting = modifiedDiffuseColor * lighting.direct.diffuse + bakeDiffuseLighting; |
|
|
|
|
|
|
|
// If refraction is enable we use the transmittanceMask to lerp between current diffuse lighting and refraction value |
|
|
|