From a2288b9ba3af9cf95f85a85d30e32e1c20caee12 Mon Sep 17 00:00:00 2001 From: ffreyer Date: Tue, 24 Dec 2024 15:24:10 +0100 Subject: [PATCH] fix SSAO --- GLMakie/src/glwindow.jl | 2 +- GLMakie/src/postprocessing.jl | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GLMakie/src/glwindow.jl b/GLMakie/src/glwindow.jl index 8e4d49b29da..b7e580b7b59 100644 --- a/GLMakie/src/glwindow.jl +++ b/GLMakie/src/glwindow.jl @@ -22,7 +22,7 @@ Base.haskey(fb::Framebuffer, key::Symbol) = haskey(fb.fb, key) GLAbstraction.get_attachment(fb::Framebuffer, key::Symbol) = get_attachment(fb.fb, key) GLAbstraction.get_buffer(fb::Framebuffer, key::Symbol) = get_buffer(fb.fb, key) GLAbstraction.bind(fb::Framebuffer) = GLAbstraction.bind(fb.fb) - +GLAbstraction.attach_colorbuffer(fb::Framebuffer, key, val) = GLAbstraction.attach_colorbuffer(fb.fb, key, val) function getfallback_attachment(fb::Framebuffer, key::Symbol, fallback_key::Symbol) haskey(fb, key) ? get_attachment(fb, key) : get_attachment(fb, fallback_key) end diff --git a/GLMakie/src/postprocessing.jl b/GLMakie/src/postprocessing.jl index 24b3b3f9f16..a01bbeb8c37 100644 --- a/GLMakie/src/postprocessing.jl +++ b/GLMakie/src/postprocessing.jl @@ -288,7 +288,7 @@ function RenderPass{:SSAO}(screen) ) data2 = Dict{Symbol, Any}( :normal_occlusion => getfallback_buffer(framebuffer, :normal_occlusion, :HDR_color), - :color_texture => get_output(framebuffer, :color), + :color_texture => get_buffer(framebuffer, :color), :ids => get_buffer(framebuffer, :objectid), :inv_texel_size => rcpframe(size(framebuffer)), :blur_range => Int32(2) @@ -303,7 +303,7 @@ function run_step(screen, glscene, step::RenderPass{:SSAO}) wh = size(screen.framebuffer) glViewport(0, 0, wh[1], wh[2]) - glDrawBuffer(get_attachment(step.framebuffer, step.renames[:normal_occ_id])) # occlusion buffer + glDrawBuffer(get_attachment(step.framebuffer, step.renames[:normal_occlusion])) # occlusion buffer glEnable(GL_SCISSOR_TEST) ppu = (x) -> round.(Int, screen.px_per_unit[] .* x) @@ -317,10 +317,10 @@ function run_step(screen, glscene, step::RenderPass{:SSAO}) a = viewport(scene)[] glScissor(ppu(minimum(a))..., ppu(widths(a))...) # update uniforms - data1[:projection] = scene.camera.projection[] + data1[:projection] = Mat4f(scene.camera.projection[]) data1[:bias] = scene.ssao.bias[] data1[:radius] = scene.ssao.radius[] - datas1[:noise_scale] = Vec2f(0.25f0 .* size(step.framebuffer)) + data1[:noise_scale] = Vec2f(0.25f0 .* size(step.framebuffer)) GLAbstraction.render(step.passes[1]) end @@ -334,7 +334,7 @@ function run_step(screen, glscene, step::RenderPass{:SSAO}) glScissor(ppu(minimum(a))..., ppu(widths(a))...) # update uniforms data2[:blur_range] = scene.ssao.blur - data2[:inv_texel_size] = rcpframe(size(framebuffer)) + data2[:inv_texel_size] = rcpframe(size(step.framebuffer)) GLAbstraction.render(step.passes[2]) end glDisable(GL_SCISSOR_TEST)