Skip to content

Commit

Permalink
fix SSAO
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed Dec 24, 2024
1 parent ed75c73 commit a2288b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion GLMakie/src/glwindow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions GLMakie/src/postprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand All @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit a2288b9

Please sign in to comment.