浏览代码

Fix issue with defaultAdditionalData creating unwanted light + fix stencilMask for deferred

/main
sebastienlagarde 7 年前
当前提交
d3e56499
共有 5 个文件被更改,包括 14 次插入15 次删除
  1. 10
      ScriptableRenderPipeline/Core/CoreRP/ComponentSingleton.cs
  2. 10
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Deferred.shader
  3. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
  4. 7
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/CombineLighting.shader
  5. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CopyStencilBuffer.shader

10
ScriptableRenderPipeline/Core/CoreRP/ComponentSingleton.cs


{
get
{
return s_Instance ?? (s_Instance = new GameObject("Default " + typeof(TType))
if (s_Instance == null)
hideFlags = HideFlags.HideAndDontSave
}.AddComponent<TType>());
GameObject go = new GameObject("Default " + typeof(TType)) { hideFlags = HideFlags.HideAndDontSave };
go.SetActive(false);
s_Instance = go.AddComponent<TType>();
}
return s_Instance;
}
}
}

10
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Deferred.shader


Properties
{
// We need to be able to control the blend mode for deferred shader in case we do multiple pass
_SrcBlend("", Float) = 1
_DstBlend("", Float) = 1
[HideInInspector] _SrcBlend("", Float) = 1
[HideInInspector] _DstBlend("", Float) = 1
_StencilRef("", Int) = 0
_StencilCmp("", Int) = 3
[HideInInspector] _StencilMask("_StencilMask", Int) = 7
[HideInInspector] _StencilRef("", Int) = 0
[HideInInspector] _StencilCmp("", Int) = 3
}
SubShader

Stencil
{
ReadMask[_StencilMask]
Ref [_StencilRef]
Comp [_StencilCmp]
Pass Keep

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs


CoreUtils.SetKeyword(m_deferredLightingMaterial[index], "SHADOWS_SHADOWMASK", shadowMask == 1);
CoreUtils.SetKeyword(m_deferredLightingMaterial[index], "DEBUG_DISPLAY", debugDisplay == 1);
m_deferredLightingMaterial[index].SetInt(HDShaderIDs._StencilMask, (int)HDRenderPipeline.StencilBitMask.LightingMask);
m_deferredLightingMaterial[index].SetInt(HDShaderIDs._StencilRef, outputSplitLighting == 1 ? (int)StencilLightingUsage.SplitLighting : (int)StencilLightingUsage.RegularLighting);
m_deferredLightingMaterial[index].SetInt(HDShaderIDs._StencilCmp, (int)CompareFunction.Equal);
m_deferredLightingMaterial[index].SetInt(HDShaderIDs._SrcBlend, (int)BlendMode.One);

7
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/CombineLighting.shader


[HideInInspector] _StencilMask("_StencilMask", Int) = 7
}
HLSLINCLUDE
int _StencilMask;
ENDHLSL
SubShader
{
Pass

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CopyStencilBuffer.shader


#include "../Lighting/LightDefinition.cs.hlsl"
int _StencilRef;
int _StencilMask;
RW_TEXTURE2D(float, _HTile); // DXGI_FORMAT_R8_UINT is not supported by Unity
struct Attributes

正在加载...
取消
保存