浏览代码

HDRP: Move contactShadow from shadow context to light context (fix warning)

/main
sebastienlagarde 6 年前
当前提交
aa607e4a
共有 3 个文件被更改,包括 4 次插入5 次删除
  1. 1
      com.unity.render-pipelines.core/CoreRP/ShaderLibrary/Shadow/Shadow.hlsl
  2. 3
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.hlsl
  3. 5
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoopDef.hlsl

1
com.unity.render-pipelines.core/CoreRP/ShaderLibrary/Shadow/Shadow.hlsl


StructuredBuffer<ShadowData> shadowDatas;
StructuredBuffer<int4> payloads;
SHADOWCONTEXT_DECLARE_TEXTURES( SHADOWCONTEXT_MAX_TEX2DARRAY, SHADOWCONTEXT_MAX_TEXCUBEARRAY, SHADOWCONTEXT_MAX_COMPSAMPLER, SHADOWCONTEXT_MAX_SAMPLER )
float contactShadow;
};
SHADOW_DEFINE_SAMPLING_FUNCS( SHADOWCONTEXT_MAX_TEX2DARRAY, SHADOWCONTEXT_MAX_TEXCUBEARRAY, SHADOWCONTEXT_MAX_COMPSAMPLER, SHADOWCONTEXT_MAX_SAMPLER )

3
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.hlsl


LightLoopContext context;
context.sampleReflection = 0;
context.shadowContext = InitShadowContext();
context.shadowContext.contactShadow = LOAD_TEXTURE2D(_DeferredShadowTexture, posInput.positionSS).y;
context.contactShadow = LOAD_TEXTURE2D(_DeferredShadowTexture, posInput.positionSS).y; // Contactshadow is store in Green Channel of _DeferredShadowTexture
// This struct is define in the material. the Lightloop must not access it
// PostEvaluateBSDF call at the end will convert Lighting to diffuse and specular lighting

5
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoopDef.hlsl


{
int sampleReflection;
ShadowContext shadowContext;
float contactShadow; // Currently we support only one contact shadow per view
};
//-----------------------------------------------------------------------------

// return 1
// On the other hand, if the feature is active it's value is 0 so we can return
// the value fetched at the begining of LightLoop()
return max(lightLoopContact.shadowContext.contactShadow, abs(contactShadowIndex));
}
return max(lightLoopContact.contactShadow, abs(contactShadowIndex));
}
正在加载...
取消
保存