浏览代码

Merge remote-tracking branch 'origin/master' into HDRP_GraphicTests

/main
Remy 7 年前
当前提交
6d165864
共有 16 个文件被更改,包括 312 次插入303 次删除
  1. 1
      .gitignore
  2. 365
      ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3002_ObjectMotionVector.unity.png
  3. 12
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Debug.hlsl
  4. 101
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugColorPicker.shader
  5. 25
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplay.hlsl
  6. 38
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugFullScreen.shader
  7. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs
  8. 39
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  9. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs
  10. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.cs
  11. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.cs.hlsl
  12. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CameraMotionVectors.shader
  13. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset
  14. 4
      ScriptableRenderPipeline/Core/.npmrc
  15. 4
      ScriptableRenderPipeline/HDRenderPipeline/.npmrc
  16. 4
      ScriptableRenderPipeline/LightweightPipeline/.npmrc

1
.gitignore


*.aspx
*.sdf
*.userprefs
*.npmrc

365
ImageTemplates/HDRenderPipeline/Scenes/3xxx_DebugView/3002_ObjectMotionVector.unity.png
文件差异内容过多而无法显示
查看文件

12
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Debug.hlsl


else if (index == 8)
outColor = real3(0.75, 1.0, 0.25);
else if (index == 9)
outColor = real3(0.75, 0.25, 1.0);
outColor = real3(0.75, 0.25, 1.0);
outColor = real3(0.25, 1.0, 0.75);
outColor = real3(0.25, 1.0, 0.75);
outColor = real3(0.75, 0.75, 0.25);
outColor = real3(0.75, 0.75, 0.25);
outColor = real3(0.75, 0.25, 0.75);
outColor = real3(0.75, 0.25, 0.75);
outColor = real3(0.25, 0.75, 0.75);
outColor = real3(0.25, 0.75, 0.75);
outColor = real3(0.25, 0.25, 0.75);
outColor = real3(0.25, 0.25, 0.75);
else if (index == 15)
outColor = real3(0.75, 0.25, 0.25);

101
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugColorPicker.shader


int _ColorPickerMode;
float3 _ColorPickerFontColor;
float _ApplyLinearToSRGB;
float _RequireToFlipInputTexture;
struct Attributes
{

return output;
}
float4 DisplayPixelInformationAtMousePosition(Varyings input, float4 result, float4 mouseResult)
float4 DisplayPixelInformationAtMousePosition(Varyings input, float4 result, float4 mouseResult, float4 mousePixelCoord)
if (_MousePixelCoord.z >= 0.0 && _MousePixelCoord.z <= 1.0 && _MousePixelCoord.w >= 0 && _MousePixelCoord.w <= 1.0)
bool flipY = _RequireToFlipInputTexture > 0.0;
if (mousePixelCoord.z >= 0.0 && mousePixelCoord.z <= 1.0 && mousePixelCoord.w >= 0 && mousePixelCoord.w <= 1.0)
{
// As when we read with the color picker we don't go through the final blit (that current hardcode a conversion to sRGB)
// and as our material debug take it into account, we need to a transform here.

// Display message offset:
int displayTextOffsetX = 1.5 * DEBUG_FONT_TEXT_WIDTH;
#if UNITY_UV_STARTS_AT_TOP
int displayTextOffsetY = -DEBUG_FONT_TEXT_HEIGHT;
#else
int displayTextOffsetY = DEBUG_FONT_TEXT_HEIGHT;
#endif
int displayTextOffsetY;
if (flipY)
{
displayTextOffsetY = DEBUG_FONT_TEXT_HEIGHT;
}
else
{
displayTextOffsetY = -DEBUG_FONT_TEXT_HEIGHT;
}
uint2 displayUnormCoord = uint2(_MousePixelCoord.x + displayTextOffsetX, _MousePixelCoord.y + displayTextOffsetY);
uint2 displayUnormCoord = uint2(mousePixelCoord.x + displayTextOffsetX, mousePixelCoord.y + displayTextOffsetY);
uint2 unormCoord = input.positionCS.xy;
if (_ColorPickerMode == COLORPICKERDEBUGMODE_BYTE || _ColorPickerMode == COLORPICKERDEBUGMODE_BYTE4)

DrawCharacter('R', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawInteger(mouseValue.x, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('R', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawInteger(mouseValue.x, _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
displayUnormCoord.x = _MousePixelCoord.x + displayTextOffsetX;
displayUnormCoord.x = mousePixelCoord.x + displayTextOffsetX;
DrawCharacter('G', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawInteger(mouseValue.y, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
displayUnormCoord.x = _MousePixelCoord.x + displayTextOffsetX;
DrawCharacter('G', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawInteger(mouseValue.y, _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
displayUnormCoord.x = mousePixelCoord.x + displayTextOffsetX;
DrawCharacter('B', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawInteger(mouseValue.z, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
displayUnormCoord.x = _MousePixelCoord.x + displayTextOffsetX;
DrawCharacter('B', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawInteger(mouseValue.z, _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
displayUnormCoord.x = mousePixelCoord.x + displayTextOffsetX;
DrawCharacter('A', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawInteger(mouseValue.w, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('A', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawInteger(mouseValue.w, _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter('X', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawFloat(mouseResult.x, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('X', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawFloat(mouseResult.x, _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
displayUnormCoord.x = _MousePixelCoord.x + displayTextOffsetX;
displayUnormCoord.x = mousePixelCoord.x + displayTextOffsetX;
DrawCharacter('Y', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawFloat(mouseResult.y, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
displayUnormCoord.x = _MousePixelCoord.x + displayTextOffsetX;
DrawCharacter('Y', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawFloat(mouseResult.y, _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
displayUnormCoord.x = mousePixelCoord.x + displayTextOffsetX;
DrawCharacter('Z', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawFloat(mouseResult.z, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
displayUnormCoord.x = _MousePixelCoord.x + displayTextOffsetX;
DrawCharacter('Z', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawFloat(mouseResult.z, _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
displayUnormCoord.x = mousePixelCoord.x + displayTextOffsetX;
DrawCharacter('W', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawFloat(mouseResult.w, _ColorPickerFontColor, unormCoord, displayUnormCoord, result.rgb);
DrawCharacter('W', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawCharacter(':', _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
DrawFloat(mouseResult.w, _ColorPickerFontColor, unormCoord, displayUnormCoord, flipY, result.rgb);
}
}
}

float4 Frag(Varyings input) : SV_Target
{
if (_RequireToFlipInputTexture > 0.0)
{
input.texcoord.y = 1.0 - input.texcoord.y;
}
float4 mouseResult = SAMPLE_TEXTURE2D(_DebugColorPickerTexture, sampler_DebugColorPickerTexture, _MousePixelCoord.zw);
float4 mousePixelCoord = _MousePixelCoord;
if (_RequireToFlipInputTexture > 0.0)
{
mousePixelCoord.y = _ScreenParams.y - mousePixelCoord.y;
// Note: We must not flip the mousePixelCoord.w coordinate
}
return DisplayPixelInformationAtMousePosition(input, result, mouseResult);
float4 mouseResult = SAMPLE_TEXTURE2D(_DebugColorPickerTexture, sampler_DebugColorPickerTexture, mousePixelCoord.zw);
float4 finalResult = DisplayPixelInformationAtMousePosition(input, result, mouseResult, mousePixelCoord);
return finalResult;
}
ENDHLSL

25
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugDisplay.hlsl


// color is current screen color
// color of the font to use
// direction is 1 or -1 and indicate fixedUnormCoord block shift
void DrawCharacter(uint asciiValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, inout float3 color, int direction)
void DrawCharacter(uint asciiValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, bool flipY, inout float3 color, int direction)
#if UNITY_UV_STARTS_AT_TOP
localCharCoord.y = DEBUG_FONT_TEXT_HEIGHT - localCharCoord.y;
#endif
if (!flipY)
localCharCoord.y = DEBUG_FONT_TEXT_HEIGHT - localCharCoord.y;
asciiValue -= DEBUG_FONT_TEXT_ASCII_START; // Our font start at ASCII table 32;
uint2 asciiCoord = uint2(asciiValue % DEBUG_FONT_TEXT_COUNT_X, asciiValue / DEBUG_FONT_TEXT_COUNT_X);

}
// Shortcut to not have to file direction
void DrawCharacter(uint asciiValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, inout float3 color)
void DrawCharacter(uint asciiValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, bool flipY, inout float3 color)
DrawCharacter(asciiValue, fontColor, currentUnormCoord, fixedUnormCoord, color, 1);
DrawCharacter(asciiValue, fontColor, currentUnormCoord, fixedUnormCoord, flipY, color, 1);
void DrawInteger(int intValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, inout float3 color)
void DrawInteger(int intValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, bool flipY, inout float3 color)
{
const uint maxStringSize = 16;

for (uint i = 0; i < maxStringSize; ++i)
{
// Numeric value incurrent font start on the second row at 0
DrawCharacter((absIntValue % 10) + '0', fontColor, currentUnormCoord, fixedUnormCoord, color, -1);
DrawCharacter((absIntValue % 10) + '0', fontColor, currentUnormCoord, fixedUnormCoord, flipY, color, -1);
if (absIntValue < 10)
break;
absIntValue /= 10;

if (intValue < 0)
{
DrawCharacter('-', fontColor, currentUnormCoord, fixedUnormCoord, color, -1);
DrawCharacter('-', fontColor, currentUnormCoord, fixedUnormCoord, flipY, color, -1);
}
// 5. Reset cursor at end location

void DrawFloat(float floatValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, inout float3 color)
void DrawFloat(float floatValue, float3 fontColor, uint2 currentUnormCoord, inout uint2 fixedUnormCoord, bool flipY, inout float3 color)
DrawInteger(intValue, fontColor, currentUnormCoord, fixedUnormCoord, color);
DrawCharacter('.', fontColor, currentUnormCoord, fixedUnormCoord, color);
DrawInteger(intValue, fontColor, currentUnormCoord, fixedUnormCoord, flipY, color);
DrawCharacter('.', fontColor, currentUnormCoord, fixedUnormCoord, flipY, color);
DrawInteger(fracValue, fontColor, currentUnormCoord, fixedUnormCoord, color);
DrawInteger(fracValue, fontColor, currentUnormCoord, fixedUnormCoord, flipY, color);
}
#endif

38
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugFullScreen.shader


TEXTURE2D(_DebugFullScreenTexture);
SAMPLER(sampler_DebugFullScreenTexture);
float _FullScreenDebugMode;
float _RequireToFlipInputTexture;
struct Attributes
{

}
// Motion vector debug utilities
// >>>
float DistanceToLine(float2 p, float2 p1, float2 p2)
{
float2 center = (p1 + p2) * 0.5;

float2 SampleMotionVectors(float2 coords)
{
#if UNITY_UV_STARTS_AT_TOP
coords.y = 1.0 - coords.y;
#endif
float2 mv = SAMPLE_TEXTURE2D(_DebugFullScreenTexture, sampler_DebugFullScreenTexture, coords).xy;
#if UNITY_UV_STARTS_AT_TOP
mv.y *= -1.0;
#endif
return mv;
return SAMPLE_TEXTURE2D(_DebugFullScreenTexture, sampler_DebugFullScreenTexture, coords).xy;
// <<<
// end motion vector utilties
if (_RequireToFlipInputTexture > 0.0)
{
input.texcoord.y = 1.0 - input.texcoord.y;
}
// SSAO
if (_FullScreenDebugMode == FULLSCREENDEBUGMODE_SSAO)
{

{
#if UNITY_UV_STARTS_AT_TOP
input.texcoord.y = 1.0 - input.texcoord.y;
#endif
float4 color = SAMPLE_TEXTURE2D(_DebugFullScreenTexture, sampler_DebugFullScreenTexture, input.texcoord);
if (any(isnan(color)) || any(isinf(color)))

float rows = floor(kGrid * _ScreenParams.y / _ScreenParams.x);
float cols = kGrid;
float2 size = _ScreenParams.xy / float2(cols, rows);
float body = min(size.x, size.y) / 1.4142135623730951; // sqrt(2)
float body = min(size.x, size.y) / sqrt(2.0);
float2 texcoord = input.positionCS.xy;
float2 center = (floor(texcoord / size) + 0.5) * size;
texcoord -= center;

if (_RequireToFlipInputTexture > 0.0)
{
arrow_coord.y = 1.0 - arrow_coord.y;
}
if (_RequireToFlipInputTexture == 0.0)
{
mv_arrow.y *= -1;
}
// Skip empty motion
float d = 0.0;

14
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Decal/DecalSystem.cs


m_CachedTransforms[decal.CullIndex] = decal.transform.localToWorldMatrix;
Matrix4x4 decalRotation = Matrix4x4.Rotate(decal.transform.rotation);
// z/y axis swap for normal to decal space
Vector4 row2 = decalRotation.GetRow(2);
decalRotation.SetRow(2, decalRotation.GetRow(1));
decalRotation.SetRow(1, row2);
// z/y axis swap for normal to decal space, Unity is column major
float y0 = decalRotation.m01;
float y1 = decalRotation.m11;
float y2 = decalRotation.m21;
decalRotation.m01 = decalRotation.m02;
decalRotation.m11 = decalRotation.m12;
decalRotation.m21 = decalRotation.m22;
decalRotation.m02 = y0;
decalRotation.m12 = y1;
decalRotation.m22 = y2;
m_CachedNormalToWorld[decal.CullIndex] = decalRotation;
m_BoundingSpheres[decal.CullIndex] = GetDecalProjectBoundingSphere(m_CachedTransforms[decal.CullIndex]);

39
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


// TODO: Try to arrange code so we can trigger this call earlier and use async compute here to run sky convolution during other passes (once we move convolution shader to compute).
UpdateSkyEnvironment(hdCamera, cmd);
RenderPyramidDepth(camera, cmd, renderContext, FullScreenDebugMode.DepthPyramid);
RenderPyramidDepth(hdCamera, cmd, renderContext, FullScreenDebugMode.DepthPyramid);
if (m_CurrentDebugDisplaySettings.IsDebugMaterialDisplayEnabled())

RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.PreRefraction);
RenderForwardError(m_CullResults, camera, renderContext, cmd, ForwardPass.PreRefraction);
RenderGaussianPyramidColor(camera, cmd, renderContext, true);
RenderGaussianPyramidColor(hdCamera, cmd, renderContext, true);
// Render all type of transparent forward (unlit, lit, complex (hair...)) to keep the sorting between transparent objects.
RenderForward(m_CullResults, hdCamera, renderContext, cmd, ForwardPass.Transparent);

RenderTransparentDepthPostpass(m_CullResults, camera, renderContext, cmd, ForwardPass.Transparent);
PushFullScreenDebugTexture(cmd, m_CameraColorBuffer, hdCamera, FullScreenDebugMode.NanTracker);
RenderGaussianPyramidColor(camera, cmd, renderContext, false);
RenderGaussianPyramidColor(hdCamera, cmd, renderContext, false);
PushFullScreenDebugTexture(cmd, m_CameraColorBuffer, hdCamera, FullScreenDebugMode.NanTracker);
// The final pass either postprocess of Blit will flip the screen (as it is reverse by default due to Unity openGL legacy)
// Postprocess system (that doesn't use cmd.Blit) handle it with configuration (and do not flip in SceneView) or it is automatically done in Blit
// Final blit
if (m_FrameSettings.enablePostprocess && CoreUtils.IsPostProcessingActive(postProcessLayer))
{

{
using (new ProfilingSample(cmd, "Blit to final RT", CustomSamplerId.BlitToFinalRT.GetSampler()))
{
// This Blit will flip the screen anything other than openGL
// Simple blit
cmd.Blit(m_CameraColorBufferRT, BuiltinRenderTextureType.CameraTarget);
}

// Caution: RenderDebug need to take into account that we have flip the screen (so anything capture before the flip will be flipped)
RenderDebug(hdCamera, cmd);
// Make sure to unbind every render texture here because in the next iteration of the loop we might have to reallocate render texture (if the camera size is different)

// Depth texture is now ready, bind it.
cmd.SetGlobalTexture(HDShaderIDs._MainDepthTexture, GetDepthTexture());
// for alpha compositing, color is cleared to 0, alpha to 1
// for alpha compositing, color is cleared to 0, alpha to 1
Color clearColor = new Color(0.0f, 0.0f, 0.0f, 1.0f);
Color clearColor = new Color(0.0f, 0.0f, 0.0f, 1.0f);
CoreUtils.SetRenderTarget(cmd, m_DbufferManager.GetDBuffers(), m_CameraDepthStencilBufferRT, ClearFlag.Color, clearColor);
// we need to do a separate clear for normals, because they are cleared to a different color

{
using (new ProfilingSample(cmd, "Blit DebugView Material Debug", CustomSamplerId.BlitDebugViewMaterialDebug.GetSampler()))
{
// This Blit will flip the screen anything other than openGL
cmd.Blit(m_CameraColorBufferRT, BuiltinRenderTextureType.CameraTarget);
}
}

}
}
void RenderGaussianPyramidColor(Camera camera, CommandBuffer cmd, ScriptableRenderContext renderContext, bool isPreRefraction)
void RenderGaussianPyramidColor(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext renderContext, bool isPreRefraction)
{
if (isPreRefraction)
{

last = HDShaderIDs._GaussianPyramidColorMips[i + 1];
}
PushFullScreenDebugTextureMip(cmd, m_GaussianPyramidColorBufferRT, lodCount, m_GaussianPyramidColorBufferDesc, isPreRefraction ? FullScreenDebugMode.PreRefractionColorPyramid : FullScreenDebugMode.FinalColorPyramid);
PushFullScreenDebugTextureMip(cmd, m_GaussianPyramidColorBufferRT, lodCount, m_GaussianPyramidColorBufferDesc, hdCamera, isPreRefraction ? FullScreenDebugMode.PreRefractionColorPyramid : FullScreenDebugMode.FinalColorPyramid);
cmd.SetGlobalTexture(HDShaderIDs._GaussianPyramidColorTexture, m_GaussianPyramidColorBuffer);

}
}
void RenderPyramidDepth(Camera camera, CommandBuffer cmd, ScriptableRenderContext renderContext, FullScreenDebugMode debugMode)
void RenderPyramidDepth(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext renderContext, FullScreenDebugMode debugMode)
{
using (new ProfilingSample(cmd, "Pyramid Depth", CustomSamplerId.PyramidDepth.GetSampler()))
{

cmd.CopyTexture(HDShaderIDs._DepthPyramidMips[i + 1], 0, 0, m_DepthPyramidBufferRT, 0, i + 1);
}
PushFullScreenDebugDepthMip(cmd, m_DepthPyramidBufferRT, lodCount, m_DepthPyramidBufferDesc, debugMode);
PushFullScreenDebugDepthMip(cmd, m_DepthPyramidBufferRT, lodCount, m_DepthPyramidBufferDesc, hdCamera, debugMode);
cmd.SetGlobalTexture(HDShaderIDs._DepthPyramidTexture, m_DepthPyramidBuffer);

}
}
// allowFlip is false if we call the function after the FinalPass or cmd.Blit that flip the screen
public void PushColorPickerDebugTexture(CommandBuffer cmd, RenderTargetIdentifier textureID, HDCamera hdCamera)
{
if (m_CurrentDebugDisplaySettings.colorPickerDebugSettings.colorPickerMode != ColorPickerDebugMode.None)

}
}
void PushFullScreenDebugTextureMip(CommandBuffer cmd, RenderTargetIdentifier textureID, int lodCount, RenderTextureDescriptor desc, FullScreenDebugMode debugMode)
void PushFullScreenDebugTextureMip(CommandBuffer cmd, RenderTargetIdentifier textureID, int lodCount, RenderTextureDescriptor desc, HDCamera hdCamera, FullScreenDebugMode debugMode)
{
if (debugMode == m_CurrentDebugDisplaySettings.fullScreenDebugMode)
{

}
}
void PushFullScreenDebugDepthMip(CommandBuffer cmd, RenderTargetIdentifier textureID, int lodCount, RenderTextureDescriptor desc, FullScreenDebugMode debugMode)
void PushFullScreenDebugDepthMip(CommandBuffer cmd, RenderTargetIdentifier textureID, int lodCount, RenderTextureDescriptor desc, HDCamera hdCamera, FullScreenDebugMode debugMode)
{
if (debugMode == m_CurrentDebugDisplaySettings.fullScreenDebugMode)
{

cmd.SetGlobalTexture(HDShaderIDs._DebugFullScreenTexture, m_DebugFullScreenTempRT);
// TODO: Replace with command buffer call when available
m_DebugFullScreen.SetFloat(HDShaderIDs._FullScreenDebugMode, (float)m_CurrentDebugDisplaySettings.fullScreenDebugMode);
// Everything we have capture is flipped (as it happen before FinalPass/postprocess/Blit. So if we are not in SceneView
// (i.e. we have perform a flip, we need to flip the input texture)
m_DebugFullScreen.SetFloat(HDShaderIDs._RequireToFlipInputTexture, hdCamera.camera.cameraType != CameraType.SceneView ? 1.0f : 0.0f);
CoreUtils.DrawFullScreen(cmd, m_DebugFullScreen, (RenderTargetIdentifier)BuiltinRenderTextureType.CameraTarget);
PushColorPickerDebugTexture(cmd, m_DebugFullScreenTempRT, hdCamera);

// The material display debug perform sRGBToLinear conversion as the final blit currently hardcode a linearToSrgb conversion. As when we read with color picker this is not done,
// we perform it inside the color picker shader. But we shouldn't do it for HDR buffer.
m_DebugColorPicker.SetFloat(HDShaderIDs._ApplyLinearToSRGB, m_CurrentDebugDisplaySettings.IsDebugMaterialDisplayEnabled() ? 1.0f : 0.0f);
// Everything we have capture is flipped (as it happen before FinalPass/postprocess/Blit. So if we are not in SceneView
// (i.e. we have perform a flip, we need to flip the input texture) + we need to handle the case were we debug a fullscreen pass that have already perform the flip
m_DebugColorPicker.SetFloat(HDShaderIDs._RequireToFlipInputTexture, hdCamera.camera.cameraType != CameraType.SceneView ? 1.0f : 0.0f);
CoreUtils.DrawFullScreen(cmd, m_DebugColorPicker, (RenderTargetIdentifier)BuiltinRenderTextureType.CameraTarget);
}
}

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDStringConstants.cs


public static readonly int _ColorPickerMode = Shader.PropertyToID("_ColorPickerMode");
public static readonly int _ApplyLinearToSRGB = Shader.PropertyToID("_ApplyLinearToSRGB");
public static readonly int _ColorPickerFontColor = Shader.PropertyToID("_ColorPickerFontColor");
public static readonly int _RequireToFlipInputTexture = Shader.PropertyToID("_RequireToFlipInputTexture");
public static readonly int _DebugFullScreenTexture = Shader.PropertyToID("_DebugFullScreenTexture");
public static readonly int _BlitTexture = Shader.PropertyToID("_BlitTexture");

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.cs


// SpecularColor fold into fresnel0
// SSS
public int diffusionProfile;
public uint diffusionProfile;
public float subsurfaceMask;
// Transmission

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.cs.hlsl


float metallic;
float coatMask;
float3 specularColor;
int diffusionProfile;
uint diffusionProfile;
float subsurfaceMask;
float thickness;
float3 tangentWS;

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CameraMotionVectors.shader


float2 previousPositionCS = (prevHPos + 1.0) / 2.0;
float2 positionCS = (curHPos + 1.0) / 2.0;
#if !UNITY_UV_STARTS_AT_TOP
#if UNITY_UV_STARTS_AT_TOP
previousPositionCS.y = 1.0 - previousPositionCS.y;
positionCS.y = 1.0 - positionCS.y;
#endif

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/HDRenderPipelineResources.asset


cameraMotionVectors: {fileID: 4800000, guid: 035941b63024d1943af48811c1db20d9, type: 3}
copyStencilBuffer: {fileID: 4800000, guid: 3d1574f1cdfa0ce4995f9bc79ed7f8ec, type: 3}
blit: {fileID: 4800000, guid: 370f7a9cc4e362d488af024d371091e8, type: 3}
blitFlipMip: {fileID: 4800000, guid: ef092fc4aaa1bb546a9ab4e457c4b07a, type: 3}
blitCubemap: {fileID: 4800000, guid: d05913e251bed7a4992c921c62e1b647, type: 3}
buildProbabilityTables: {fileID: 7200000, guid: b9f26cf340afe9145a699753531b2a4c,
type: 3}

4
ScriptableRenderPipeline/Core/.npmrc


registry=https://api.bintray.com/npm/unity/unity-staging
_auth=ZmVsaXBlQHVuaXR5OmVhMjExNjJiMTNjZmI1MWRmNzk5NjNhMzBmMWFjMGU1OWUzZThkZTQ=
always-auth=true
email=felipe@unity3d.com

4
ScriptableRenderPipeline/HDRenderPipeline/.npmrc


registry=https://api.bintray.com/npm/unity/unity-staging
_auth=ZmVsaXBlQHVuaXR5OmVhMjExNjJiMTNjZmI1MWRmNzk5NjNhMzBmMWFjMGU1OWUzZThkZTQ=
always-auth=true
email=felipe@unity3d.com

4
ScriptableRenderPipeline/LightweightPipeline/.npmrc


registry=https://api.bintray.com/npm/unity/unity-staging
_auth=ZmVsaXBlQHVuaXR5OmVhMjExNjJiMTNjZmI1MWRmNzk5NjNhMzBmMWFjMGU1OWUzZThkZTQ=
always-auth=true
email=felipe@unity3d.com
正在加载...
取消
保存