Start working on Cluster;

This commit is contained in:
2025-03-01 16:58:26 +09:00
parent 2f79df128e
commit 5f24e4c27d
6 changed files with 90 additions and 98 deletions

View File

@@ -4,6 +4,7 @@
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
#include "Packages/com.misaki.ao-volume/Runtime/Shader/Includes/GeometryData.cs.hlsl"
#include "Packages/com.misaki.ao-volume/Runtime/Shader/Includes/Common.hlsl"
#define _FLT_MIN 1.175494351e-38 // Minimum representable positive floating-point number
#define _FLT_MAX 3.402823466e+38 // Maximum representable floating-point number
@@ -19,16 +20,6 @@ StructuredBuffer<int2> _DepthPyramidMipLevelOffsets;
RWByteAddressBuffer _VisibleVolumeCount : register(u0);
RWByteAddressBuffer _VisibleVolumeIndices : register(u1);
RW_TEXTURE2D_X(float, _DebugTexture);
float4 ComputeScreenPos(float4 pos, float projectionSign)
{
float4 o = pos * 0.5f;
o.xy = float2(o.x, o.y * projectionSign) + o.w;
o.zw = pos.zw;
return o;
}
float SampleDepthLod(int2 uv, int lod)
{
int2 mipCoord = uv >> lod;
@@ -80,13 +71,13 @@ void CSMain(uint3 dispatchThreadId : SV_DispatchThreadID)
float4 positionCS = TransformWorldToHClip(cornerRWS);
positionCS /= positionCS.w;
float2 screenPos = ComputeScreenPos(positionCS, _ProjectionParams.x).xy;
float2 positionNDC = ComputePositionNDC(positionCS, _ProjectionParams.x).xy;
screenMin = min(screenMin, screenPos);
screenMax = max(screenMax, screenPos);
screenMin = min(screenMin, positionNDC);
screenMax = max(screenMax, positionNDC);
boxMaxDepth = max(boxMaxDepth, positionCS.z);
cornerPositionSS[i] = screenPos * _ScreenSize.xy;
cornerPositionSS[i] = positionNDC * _ScreenSize.xy;
}
float rectWidth = (screenMax.x - screenMin.x);