From 001be2f8da2c28e0396e6a6421c6f4a7ffd646a3 Mon Sep 17 00:00:00 2001 From: Onek8 Date: Mon, 7 Apr 2025 15:35:22 +0000 Subject: [PATCH] Update leenkx/Sources/leenkx/renderpath/Inc.hx --- leenkx/Sources/leenkx/renderpath/Inc.hx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/leenkx/Sources/leenkx/renderpath/Inc.hx b/leenkx/Sources/leenkx/renderpath/Inc.hx index 345a25b..69087f3 100644 --- a/leenkx/Sources/leenkx/renderpath/Inc.hx +++ b/leenkx/Sources/leenkx/renderpath/Inc.hx @@ -77,6 +77,9 @@ class Inc { #if (rp_voxels == "Voxel GI") static var voxel_sh5:kha.compute.Shader = null; static var voxel_ta5:kha.compute.TextureUnit; + static var voxel_te5:kha.compute.TextureUnit; + static var voxel_tf5:kha.compute.TextureUnit; + static var voxel_tg5:kha.compute.TextureUnit; static var voxel_ca5:kha.compute.ConstantLocation; static var voxel_cb5:kha.compute.ConstantLocation; static var voxel_cc5:kha.compute.ConstantLocation; @@ -677,7 +680,7 @@ class Inc { } else { if (t.name == "voxelsSDF" || t.name == "voxelsSDFtmp") { - t.format = "R16"; + t.format = "R8"; t.width = res; t.height = res * Main.voxelgiClipmapCount; t.depth = res; @@ -686,7 +689,7 @@ class Inc { #if (rp_voxels == "Voxel AO") { if (t.name == "voxelsOut" || t.name == "voxelsOutB") { - t.format = "R16"; + t.format = "R8"; t.width = res * (6 + 16); t.height = res * Main.voxelgiClipmapCount; t.depth = res; @@ -892,7 +895,9 @@ class Inc { { voxel_sh5 = path.getComputeShader("voxel_light"); voxel_ta5 = voxel_sh5.getTextureUnit("voxelsLight"); - + voxel_te5 = voxel_sh5.getTextureUnit("voxels"); + voxel_tf5 = voxel_sh5.getTextureUnit("voxelsSampler"); + voxel_tg5 = voxel_sh5.getTextureUnit("voxelsSDFSampler"); voxel_ca5 = voxel_sh5.getConstantLocation("clipmaps"); voxel_cb5 = voxel_sh5.getConstantLocation("clipmapLevel"); @@ -1213,7 +1218,7 @@ class Inc { kha.compute.Compute.setSampledTexture(voxel_td4, rts.get("voxelsSDF").image); kha.compute.Compute.setTexture(voxel_te4, rts.get("voxels_specular").image, kha.compute.Access.Write); - //kha.compute.Compute.setSampledTexture(voxel_tf4, rts.get("gbuffer2").image); + kha.compute.Compute.setSampledTexture(voxel_tf4, rts.get("gbuffer2").image); var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10); for (i in 0...Main.voxelgiClipmapCount) { @@ -1288,7 +1293,9 @@ class Inc { kha.compute.Compute.setShader(voxel_sh5); kha.compute.Compute.setTexture(voxel_ta5, rts.get("voxelsLight").image, kha.compute.Access.Write); - + kha.compute.Compute.setTexture(voxel_te5, rts.get("voxels").image, kha.compute.Access.Read); + kha.compute.Compute.setSampledTexture(voxel_tf5, rts.get("voxelsOut").image); + kha.compute.Compute.setSampledTexture(voxel_tg5, rts.get("voxelsSDF").image); var fa:Float32Array = new Float32Array(Main.voxelgiClipmapCount * 10); for (i in 0...Main.voxelgiClipmapCount) { fa[i * 10] = clipmaps[i].voxelSize;