Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theming Makie plots lead to visual artefacts #148

Open
steffenhaug opened this issue Sep 13, 2024 · 1 comment
Open

Theming Makie plots lead to visual artefacts #148

steffenhaug opened this issue Sep 13, 2024 · 1 comment

Comments

@steffenhaug
Copy link

Currently plots look pretty good with the built-in Makie theme that is designed to fit imgui, but not having antialiasing is a little sad. If you want to use custom Makie themes, a number of werid things happen:

1: If you are using a plot theme with a large contrast against WindowBg, it is very apparent that there is a gradient in transparency of the rendered image from top to bottom, for example with Makies built-in theme to render a plot with white background onto a green WindowBg:

2: As you know, if you don't disable antialiasing there are artefacts where ImGuis WindowBg bleeds through the antialiased parts.

3: If you make Makies background transparent, i. e. something like

Makie.set_theme!(backgroundcolor=:transparent)

Not only is the background not actually transparent, but for some reason all the plot elements become transparent:

From what I can tell, the call to AddImage to draw the framebuffer looks sensible, so this seems like very strange behavior. As far as I know, there is no postprocessing of images drawn with the draw list, so I'm wondering:

  1. Is this actually what the Makie :color framebuffer looks like?

In particular, I find it very odd that there is a gradient in alpha from top to bottom, as it doesn't really make sense to me that Makie would output something with a global alpha gradient.

  1. If so, what kind of post-processing does Makie do when it actually draws it "for real"?

I can see that the framebuffer abstraction in Makie contains some textures for what seems to be order-independent transparency, which we currently ignore, which seems quite suspect given that all these problems are at least somewhat related to transparency. While I have a fair bit of experience with graphics programming, this algorithm is new to me, so I'm not sure if that's a red herring.

I don't really have any good tools for debugging this stuff on macOS, so I can't investigate further right now while at work, but I want to have a poke around with renderdoc or nsight this weekend. I'm not sure how easy it is to get that set up with a Julia process, but at the end of the day its just GL calls so I'm assuming it is possible. I'm basically making this issue to hear if you have some input on what might be causing this, and whether you think it is feasible to fix it so the embedded plot looks "exactly right", or at the very least can support theming a little bit better.

@JamesWrigley
Copy link
Member

Those are good questions, but I'm afraid I don't have any answers off the top of my head :) I would recommend comparing what we're doing to what GLMakie does, for example the renderloop functions here: https://github.com/MakieOrg/Makie.jl/blob/master/GLMakie/src/screen.jl

One thing I noticed is that GLMakie sets quite a few GLFW window hints, perhaps we need to set them too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants