Start working on Cluster;
This commit is contained in:
31
Runtime/Shader/Includes/Common.hlsl
Normal file
31
Runtime/Shader/Includes/Common.hlsl
Normal 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
|
||||
Reference in New Issue
Block a user