浏览代码

Added builtin debug in shader pass forward unlit

/Yibing-Project-2
Frédéric Vauchelles 7 年前
当前提交
3c9b6c67
共有 2 个文件被更改,包括 26 次插入1 次删除
  1. 1
      ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassForward.hlsl
  2. 26
      ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassForwardUnlit.hlsl

1
ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassForward.hlsl


#endif
#ifdef DEBUG_DISPLAY
// Same code in ShaderPassForward.shader
if (_DebugViewMaterial != 0)
{
float3 result = float3(1.0, 0.0, 1.0);

26
ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/ShaderPassForwardUnlit.hlsl


BSDFData bsdfData = ConvertSurfaceDataToBSDFData(surfaceData);
// TODO: we must not access bsdfData here, it break the genericity of the code!
return float4(bsdfData.color + builtinData.emissiveColor, builtinData.opacity);
float4 outColor = float4(bsdfData.color + builtinData.emissiveColor, builtinData.opacity);
#ifdef DEBUG_DISPLAY
// Same code in ShaderPassForwardUnlit.shader
if (_DebugViewMaterial != 0)
{
float3 result = float3(1.0, 0.0, 1.0);
bool needLinearToSRGB = false;
GetPropertiesDataDebug(_DebugViewMaterial, result, needLinearToSRGB);
GetVaryingsDataDebug(_DebugViewMaterial, input, result, needLinearToSRGB);
GetBuiltinDataDebug(_DebugViewMaterial, builtinData, result, needLinearToSRGB);
GetBSDFDataDebug(_DebugViewMaterial, bsdfData, result, needLinearToSRGB); // TODO: This required to initialize all field from BSDFData...
// TEMP!
// For now, the final blit in the backbuffer performs an sRGB write
// So in the meantime we apply the inverse transform to linear data to compensate.
if (!needLinearToSRGB)
result = SRGBToLinear(max(0, result));
outColor = float4(result, 1.0);
}
#endif
return outColor;
}
正在加载...
取消
保存