Skip to content

Commit 3c018ba

Browse files
correct the AoV to output viewspace normals
1 parent 11a4944 commit 3c018ba

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

examples_tests/22.RaytracedAO/Renderer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,7 @@ bool Renderer::render(nbl::ITimer* timer, const bool beauty)
15941594
{
15951595
m_driver->bindDescriptorSets(EPBP_COMPUTE,m_resolvePipeline->getLayout(),0u,1u,&m_resolveDS.get(),nullptr);
15961596
m_driver->bindComputePipeline(m_resolvePipeline.get());
1597+
m_driver->pushConstants(m_resolvePipeline->getLayout(),ICPUSpecializedShader::ESS_COMPUTE,0u,sizeof(m_prevView),&m_prevView);
15971598
m_driver->dispatch(m_raygenWorkGroups[0],m_raygenWorkGroups[1],1);
15981599
COpenGLExtensionHandler::pGlMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT|GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
15991600
// because of direct to screen resolve

examples_tests/22.RaytracedAO/resolve.comp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ layout(set = 0, binding = 4, rgba16f) restrict uniform image2D framebuffer;
1313
layout(set = 0, binding = 5, r32ui) restrict uniform uimage2D albedo;
1414
layout(set = 0, binding = 6, rgba16f) restrict uniform image2D normals;
1515

16+
layout(push_constant, row_major) uniform PushConstants
17+
{
18+
mat4x3 viewMatrix;
19+
} pc;
20+
1621
#include <nbl/builtin/glsl/format/decode.glsl>
1722
#include <nbl/builtin/glsl/format/encode.glsl>
1823
vec3 fetchAccumulation(in uvec2 coord, in uint subsample)
@@ -42,6 +47,7 @@ void main()
4247
nml /= float(samplesPerPixelPerDispatch);
4348

4449
// transform normal
50+
nml = mat3(pc.viewMatrix)*nml;
4551

4652
imageStore(framebuffer,pixelCoord,vec4(acc,1.f));
4753
imageStore(albedo,pixelCoord,uvec4(nbl_glsl_encodeRGB10A2_UNORM(vec4(alb,1.0)),0u,0u,0u));

0 commit comments

Comments
 (0)