diff --git a/shaders/bilateral_cleanup_pass.comp b/shaders/bilateral_cleanup_pass.comp index 3e2002b..d373122 100644 --- a/shaders/bilateral_cleanup_pass.comp +++ b/shaders/bilateral_cleanup_pass.comp @@ -48,13 +48,13 @@ void main() vec3 result = vec3(0.0,0.0,0.0); float weightSum = 0.0; - if(length(centerColor) < 0.0001 || sqrt(variance) < 2.0){ + if(length(centerColor) < 0.0001 || variance < 2.0){ imageStore(bilateralCleanupColor, imageCoords, vec4(0.0)); return; } // Define sigma values - float sigmaS = clamp (sqrt(variance) , 2.0, 4.0); + float sigmaS = clamp (variance , 2.0, 4.0); float sigmaR = 0.5; // Define a kernel radius for the spatial domain int kernelRadius = int(0.5 * sigmaS); @@ -67,7 +67,7 @@ void main() neighborCoords.x >= imageRes.x || neighborCoords.y >= imageRes.y) continue; vec4 neighborColor = imageLoad(filteredReflectionColor, neighborCoords); - if(length (neighborColor.rgb) < 0.001) continue; + if(length (neighborColor.rgb) < 0.1) continue; // Spatial weight float dist2 = float(x * x + y * y); float spatialWeight = exp(-dist2 / (2.0 * sigmaS * sigmaS)); diff --git a/shaders/lightPass.frag b/shaders/lightPass.frag index feb2cef..308f12b 100644 --- a/shaders/lightPass.frag +++ b/shaders/lightPass.frag @@ -152,7 +152,7 @@ void main() vec3 diffuseAlbedo = state.mat.albedo * (1.0 - F_SchlickRoughness(state.mat.f0, max(0.0, dot(-camRay.direction, state.normal)), state.mat.roughness) * (1.0 - state.mat.metallic)); vec3 directLighting = hit ? vec3(0) : directLight.radiance; - vec3 reflectionColor = texelFetch(filteredReflectionColor, ivec2(gl_FragCoord.xy), 0).rgb; + vec3 reflectionColor = texelFetch(bilateralCleanupColor, ivec2(gl_FragCoord.xy), 0).rgb; Light randLight = selectRandomLight(114514); float dist = distance(randLight.position, worldPos); diff --git a/src/main.cpp b/src/main.cpp index 64a812d..6c4ada0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -65,7 +65,7 @@ int main(int argc, char** argv) std::string sceneFile = parser.getString("-f", "Sponza/Sponza.gltf"); //std::string sceneFile = parser.getString("-f", "Street/scene.gltf"); //std::string sceneFile = parser.getString("-f", "apocal/apocal.gltf"); - //std::string sceneFile = parser.getString("-f", "station/station.gltf"); + std::string sceneFile = parser.getString("-f", "station/station.gltf"); std::string hdrFilename = parser.getString("-e", "std_env.hdr"); // Setup GLFW window diff --git a/src/sample_example.cpp b/src/sample_example.cpp index ca2c528..b673e0f 100644 --- a/src/sample_example.cpp +++ b/src/sample_example.cpp @@ -892,9 +892,7 @@ void SampleExample::computeReflection(const VkCommandBuffer& cmdBuf, nvvk::Profi m_temporalSpatialPass.run(cmdBuf, render_size, profiler, { m_reflectionComputePass.getSamplerDescSet() }); - - vkCmdPipelineBarrier(cmdBuf, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,