浏览代码

Rename _MainDepthTexture to _CameraDepthTexture (For builtin compatibility)

Old code require to use _CameraDepthTexture name, we have change it to
MainDepthTexture  a while ago because of bug due to usage of
GetTemporaryRT, as we don't use GetTemporaryRT anymore we can now come
back to the original name
/main
sebastienlagarde 7 年前
当前提交
89270e64
共有 10 个文件被更改,包括 17 次插入18 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugViewMaterialGBuffer.shader
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugViewTiles.shader
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Deferred.shader
  4. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/DeferredDirectionalShadow.compute
  5. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/Deferred.compute
  6. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.shader
  7. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/CameraMotionVectors.shader
  8. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassDBuffer.hlsl
  9. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderVariables.hlsl
  10. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/OpaqueAtmosphericScattering.shader

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugViewMaterialGBuffer.shader


float4 Frag(Varyings input) : SV_Target
{
// input.positionCS is SV_Position
float depth = LOAD_TEXTURE2D(_MainDepthTexture, input.positionCS.xy).x;
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, input.positionCS.xy).x;
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
BSDFData bsdfData;

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Debug/DebugViewTiles.shader


float4 Frag(Varyings input) : SV_Target
{
// positionCS is SV_Position
float depth = LOAD_TEXTURE2D(_MainDepthTexture, input.positionCS.xy).x;
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, input.positionCS.xy).x;
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V, uint2(input.positionCS.xy) / GetTileSize());
int2 pixelCoord = posInput.positionSS.xy;

int maxLights = 32;
if (tileCoord.y < LIGHTCATEGORY_COUNT && tileCoord.x < maxLights + 3)
{
float depthMouse = LOAD_TEXTURE2D(_MainDepthTexture, _MousePixelCoord.xy).x;
float depthMouse = LOAD_TEXTURE2D(_CameraDepthTexture, _MousePixelCoord.xy).x;
PositionInputs mousePosInput = GetPositionInput(_MousePixelCoord.xy, _ScreenSize.zw, depthMouse, UNITY_MATRIX_I_VP, UNITY_MATRIX_V, mouseTileCoord);
uint category = (LIGHTCATEGORY_COUNT - 1) - tileCoord.y;

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


// This need to stay in sync with deferred.compute
// input.positionCS is SV_Position
float depth = LOAD_TEXTURE2D(_MainDepthTexture, input.positionCS.xy).x;
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, input.positionCS.xy).x;
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V, uint2(input.positionCS.xy) / GetTileSize());
float3 V = GetWorldSpaceNormalizeViewDir(posInput.positionWS);

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/DeferredDirectionalShadow.compute


#include "CoreRP/ShaderLibrary/Common.hlsl"
#include "../ShaderVariables.hlsl"
#include "Lighting.hlsl"
#include "Lighting.hlsl"
#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch

float2 startUV = rayStartCS.xy * 0.5f + 0.5f;
startUV.y = 1.0 - startUV.y;
// Pixel to light ray in
// Pixel to light ray in
float2 rayUV = rayCS.xy * 0.5f;
rayUV.y = -rayUV.y;

float raySampleDepth = startDepth + rayDepth * sampleStep;
// Depth buffer depth for this sample
float sampleDepth = SAMPLE_TEXTURE2D_LOD(_MainDepthTexture, sampler_MainDepthTexture, sampleUV, 0.0).x;
float sampleDepth = LOAD_TEXTURE2D(_CameraDepthTexture, sampleUV).x;
bool Hit = false;
float depthDiff = sampleDepth - raySampleDepth;

uint2 pixelCoord = groupId * DEFERRED_SHADOW_TILE_SIZE + groupThreadId;
uint2 tileCoord = groupId;
float depth = LOAD_TEXTURE2D(_MainDepthTexture, pixelCoord.xy).x;
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, pixelCoord.xy).x;
if (depth == UNITY_RAW_FAR_CLIP_VALUE)
return;

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/Deferred.compute


// This need to stay in sync with deferred.shader
float depth = LOAD_TEXTURE2D(_MainDepthTexture, pixelCoord.xy).x;
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, pixelCoord.xy).x;
PositionInputs posInput = GetPositionInput(pixelCoord.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V, tileCoord);
// For indirect case: we can still overlap inside a tile with the sky/background, reject it

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/SubsurfaceScattering/SubsurfaceScattering.shader


// Reconstruct the view-space position.
float2 centerPosSS = posInput.positionNDC;
float2 cornerPosSS = centerPosSS + 0.5 * _ScreenSize.zw;
float centerDepth = LOAD_TEXTURE2D(_MainDepthTexture, centerPosition).r;
float centerDepth = LOAD_TEXTURE2D(_CameraDepthTexture, centerPosition).r;
float3 centerPosVS = ComputeViewSpacePosition(centerPosSS, centerDepth, UNITY_MATRIX_I_P);
float3 cornerPosVS = ComputeViewSpacePosition(cornerPosSS, centerDepth, UNITY_MATRIX_I_P);

// Apply bilateral weighting.
// Ref #1: Skin Rendering by Pseudo–Separable Cross Bilateral Filtering.
// Ref #2: Separable SSS, Supplementary Materials, Section E.
float rawDepth = LOAD_TEXTURE2D(_MainDepthTexture, samplePosition).r;
float rawDepth = LOAD_TEXTURE2D(_CameraDepthTexture, samplePosition).r;
float sampleDepth = LinearEyeDepth(rawDepth, _ZBufferParams);
float zDistance = centimPerUnit * sampleDepth - (centimPerUnit * centerPosVS.z);
sampleWeight *= exp(-zDistance * zDistance * halfRcpVariance);

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


float4 Frag(Varyings input) : SV_Target
{
float depth = LOAD_TEXTURE2D(_MainDepthTexture, input.positionCS.xy).x;
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, input.positionCS.xy).x;
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
float4 worldPos = float4(posInput.positionWS, 1.0);

SubShader
{
Tags{ "RenderPipeline" = "HDRenderPipeline" }
Pass
{
// We will perform camera motion velocity only where there is no object velocity

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderPass/ShaderPassDBuffer.hlsl


{
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
float depth = LOAD_TEXTURE2D(_MainDepthTexture, input.positionSS.xy).x;
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, input.positionSS.xy).x;
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
// Transform from world space to decal space (DS) to clip the decal.

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderVariables.hlsl


// ----------------------------------------------------------------------------
TEXTURE2D(_MainDepthTexture);
SAMPLER(sampler_MainDepthTexture);
TEXTURE2D(_CameraDepthTexture);
// Main lightmap
TEXTURE2D(unity_Lightmap);

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/OpaqueAtmosphericScattering.shader


float4 Frag(Varyings input) : SV_Target
{
float depth = LOAD_TEXTURE2D(_MainDepthTexture, input.positionCS.xy).x;
float depth = LOAD_TEXTURE2D(_CameraDepthTexture, input.positionCS.xy).x;
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
if (depth == UNITY_RAW_FAR_CLIP_VALUE)

正在加载...
取消
保存