bvle-voxels/shaders/voxelAOApplyCS.hlsl

33 lines
918 B
HLSL
Raw Normal View History

// BVLE Voxels - AO Apply Compute Shader (Phase 6.3)
// Multiplies the blurred AO factor onto the color buffer.
#include "voxelCommon.hlsli"
Texture2D<float> aoBlurred : register(t0);
RWTexture2D<float4> colorOutput : register(u0);
struct ApplyPush {
uint width;
uint height;
uint debugMode; // 0=normal, 2=debug AO (show AO as grayscale)
uint pad[9];
};
[[vk::push_constant]] ConstantBuffer<ApplyPush> push : register(b999);
[RootSignature(VOXEL_ROOTSIG)]
[numthreads(8, 8, 1)]
void main(uint3 DTid : SV_DispatchThreadID) {
if (DTid.x >= push.width || DTid.y >= push.height) return;
float ao = aoBlurred[DTid.xy];
if (push.debugMode == 2) {
// Debug AO: grayscale visualization of blurred AO
colorOutput[DTid.xy] = float4(ao, ao, ao, 1);
} else {
float4 color = colorOutput[DTid.xy];
color.rgb *= ao;
colorOutput[DTid.xy] = color;
}
}