|
|
|
|
|
|
// RT3 - 11f:11f:10f |
|
|
|
// In deferred we encode emissive color with bakeDiffuseLighting. We don't have the room to store emissiveColor. |
|
|
|
// It mean that any futher process that affect bakeDiffuseLighting will also affect emissiveColor, like SSAO for example. |
|
|
|
outGBuffer3 = float4(builtinData.bakeDiffuseLighting + builtinData.emissiveColor, 0.0); |
|
|
|
|
|
|
|
// Also if we don't have the room to store AO, then we apply it at this time on bakeDiffuseLighting which will cause a double occlusion with SSAO |
|
|
|
outGBuffer3 = float4(builtinData.bakeDiffuseLighting + builtinData.emissiveColor, 0.0); |
|
|
|
#else |
|
|
|
outGBuffer3 = float4(builtinData.bakeDiffuseLighting * surfaceData.ambientOcclusion + builtinData.emissiveColor, 0.0); |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef SHADOWS_SHADOWMASK |
|
|
|
|
|
|
GBufferType2 inGBuffer2 = LOAD_TEXTURE2D(_GBufferTexture2, positionSS); |
|
|
|
|
|
|
|
// BuiltinData |
|
|
|
builtinData.bakeDiffuseLighting = LOAD_TEXTURE2D(_GBufferTexture3, positionSS).rgb; // This also contain emissive |
|
|
|
builtinData.bakeDiffuseLighting = LOAD_TEXTURE2D(_GBufferTexture3, positionSS).rgb; // This also contain emissive (and * AO if no lightlayers) |
|
|
|
|
|
|
|
// Avoid to introduce a new variant for light layer as it is already long to compile |
|
|
|
if (_EnableLightLayers) |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Premultiply bake diffuse lighting information with DisneyDiffuse pre-integration |
|
|
|
return builtinData.bakeDiffuseLighting * preLightData.diffuseFGD * surfaceData.ambientOcclusion * bsdfData.diffuseColor; |
|
|
|
return builtinData.bakeDiffuseLighting * preLightData.diffuseFGD * bsdfData.diffuseColor; |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------------------------------------------------------- |
|
|
|