浏览代码

Comments.

/StackLit2
Stephane Laroche 7 年前
当前提交
17a0a722
共有 3 个文件被更改,包括 12 次插入5 次删除
  1. 4
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl
  2. 8
      com.unity.render-pipelines.high-definition/HDRP/Material/MaterialEvaluation.hlsl
  3. 5
      com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.shader

4
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl


// If refraction is enable we use the transmittanceMask to lerp between current diffuse lighting and refraction value
// Physically speaking, transmittanceMask should be 1, but for artistic reasons, we let the value vary
//
// Note we also transfer the refracted light (lighting.indirect.specularTransmitted) into diffuseLighting
// since we know it won't be further processed: it is called at the end of the LightLoop(), but doing this
// enables opacity to affect it (in ApplyBlendMode()) while the rest of specularLighting escapes it.
#if HAS_REFRACTION
diffuseLighting = lerp(diffuseLighting, lighting.indirect.specularTransmitted, bsdfData.transmittanceMask);
#endif

8
com.unity.render-pipelines.high-definition/HDRP/Material/MaterialEvaluation.hlsl


void ApplyAmbientOcclusionFactor(AmbientOcclusionFactor aoFactor, inout BakeLightingData bakeLightingData, inout AggregateLighting lighting)
{
// Note: in case of Lit, bakeLightingData.bakeDiffuseLighting contain indirect diffuse + emissive,
// so Ambient occlusion is multiply by emissive which is wrong but not a big deal
// so Ambient occlusion is multiply by emissive which is wrong but not a big deal.
// Also, we have double occlusion for diffuse lighting:
// The baked diffuse lighting part from builtinData.bakeDiffuseLighting = SampleBakedGI() already
// had precomputed (aka "FromData") AO applied, and will get double occluded from screen space AO
// (this was done to avoid storing AOFromData in the GBuffer, hence why GetScreenSpaceAmbientOcclusion*()
// is called with AOFromData = 1.0 in Lit:PostEvaluateBSDF(), hence why we only have SSAO in the aoFactor
// here)
bakeLightingData.bakeDiffuseLighting *= aoFactor.indirectAmbientOcclusion;
lighting.indirect.specularReflected *= aoFactor.indirectSpecularOcclusion;
lighting.direct.diffuse *= aoFactor.directAmbientOcclusion;

5
com.unity.render-pipelines.high-definition/HDRP/Material/StackLit/StackLit.shader


#pragma shader_feature _USE_UV2
#pragma shader_feature _USE_UV3
#pragma shader_feature _USE_TRIPLANAR
// ...TODO: for surface gradient framework eg see litdata.hlsl,
// but we need it right away for toggle with LayerTexCoord mapping so we might need them
// from the Frag input right away. See also ShaderPass/StackLitSharePass.hlsl.
#pragma shader_feature _BLENDMODE_PRESERVE_SPECULAR_LIGHTING // easily handled in material.hlsl, so adding this already.
#pragma shader_feature _BLENDMODE_PRESERVE_SPECULAR_LIGHTING // handled in material.hlsl
#pragma shader_feature _ENABLE_FOG_ON_TRANSPARENT
// MaterialFeature are used as shader feature to allow compiler to optimize properly

正在加载...
取消
保存