-
Notifications
You must be signed in to change notification settings - Fork 63
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
Proposal: Choosing the background color or export transparency #4
Comments
Thank you for the quick response! Indeed, I did not see the control to change the background color. So, the way to go would be to save the alpha information into the PNG file. Selecting a color for transparency is not the correct approach. E.g. black background and black shadows would be treated equally as transparent, although they should not. Also it would not allow for semi-transparency, but only act as a binary indicator, leading to really ugly borders, for example with glow. I did not look too much into your implementation, but since you're blending, I assume you have a framebuffer with RGBA components. Since you have post-processing shaders which basically remove the transparency information (e.g. the FXAA shader returns 1.0 as alpha component), you have two options:
Personally, I would go with the first one. While saving the PNG file you can then use the currently displayed RGB color information as usual and add the alpha information from after the blending stage as the PNG's alpha channel. If your PNG exporter does not support writing alpha channel values, you can save it as an extra grayscale file. It can easily be manually combined afterwards in e.g. Photoshop. |
And instead I have already published a beta to test it: FXAA now is not a simply pass-through (I don't copy simply the alpha value of central pixel), but I still need to test/investigate on glow filters (blur and deNoise) |
Interesting. So, I did have a look at the beta version. I don't think that using the alpha value of the central pixel is the way to go.
So the first image (normal) should be the same as exporting with per-pixel alpha values and choosing a black background in Photoshop (alpha + black). That cannot be achieved with using only one transparency value for the whole picture.
I do have a counter proposal. Instead of introducing a distinction between saving with/without alpha, the user can actually control the export behavior by choosing the background color:
If "no background" is chosen, the PNG export would be with transparency, otherwise the result is a normal blending with opaque background. At the moment, the program behaves a bit unexpected with transparent background color values. If one chooses the background as RGBA = (255,0,0,0) (i.e. transparent red) - it is still drawn as solid red, although it shouldn't be visible at all. That's probably because of the post-processing steps, at some point the alpha channel is ignored and everything is set to opaque. The question is though, is that correct behavior? Two different RGBA values in the final framebuffer:
would be converted to full red (RGB = (255, 0, 0)) if the alpha value is just ignored. But should they? Probably not, since they are different colors. Without changing too much of your program, the easiest and safest bet is to introduce the new key bindings as you already proposed. But you should think about what the use cases are for a semi-transparent background and why the user would ever want that in the first place. |
It would be useful to be able to choose the background color (e.g. white) for documents/publications.
Alternatively, since the screenshot tool saves PNG files, one could use transparency information from the frame buffer.
The text was updated successfully, but these errors were encountered: