From 8dc28d6e761edd93f5a1d2bbd3defb38bf2b93be Mon Sep 17 00:00:00 2001
From: Alexander Gauggel <agauggel@uni-koblenz.de>
Date: Fri, 18 Jun 2021 21:36:37 +0200
Subject: [PATCH] [#81] Fix voxelization color

---
 projects/voxelization/resources/shaders/voxelization.frag | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/projects/voxelization/resources/shaders/voxelization.frag b/projects/voxelization/resources/shaders/voxelization.frag
index 7ea161ce..e29e0ff1 100644
--- a/projects/voxelization/resources/shaders/voxelization.frag
+++ b/projects/voxelization/resources/shaders/voxelization.frag
@@ -35,6 +35,9 @@ void main()	{
     }
     uint flatIndex = flattenVoxelUVToIndex(UV, voxelImageSize);
     
-    vec3 color = texture(sampler2D(albedoTexture, textureSampler), passUV).rgb;
+    // for some reason the automatic mip level here does not work
+    // biasing does not work either
+    // as a workaround a fixed, high mip level is chosen
+    vec3 color = textureLod(sampler2D(albedoTexture, textureSampler), passUV, 10.f).rgb;
     atomicMax(packedVoxelData[flatIndex], packVoxelInfo(color));
 }
\ No newline at end of file
-- 
GitLab