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

@@ -0,0 +1,31 @@
#ifndef VOLUME_COMMON
#define VOLUME_COMMON
#define _MAX_CLUSTER_COUNT 16
#define _DEPTH_STEP (1.0 / _MAX_CLUSTER_COUNT)
float4 ComputePositionNDC(float4 positionCS, float projectionSign)
{
float4 positionNDC = positionCS * 0.5f;
positionNDC.xy = float2(positionNDC.x, positionNDC.y * projectionSign) + positionNDC.w;
positionNDC.zw = positionCS.zw;
return positionNDC;
}
uint GetClusterIndex(float linearDepth)
{
return (uint)clamp(floor(linearDepth / _DEPTH_STEP), 0.0, (float)_MAX_CLUSTER_COUNT - 1.0);
}
void GetClusterVolumeCount(uint clusterIndex, out uint count)
{
// TODO
}
uint FetchVolumeIndex(uint clusterIndex, uint offset)
{
// TODO
return 0;
}
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9733756ad1176ce4983ca1a172f79e15
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: