-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
viewport texture using transparency is darker colour (or brighter with premult on) #88603
Comments
Hi, I went into the test project and made sure the camera3D and SubViewport both have an environment with clear colour of black w/ alpha 0, but it still looks the same- here's the updated file |
Just to add some context here I'm working on a paint app, (which I realise is niche, but this affects anyone working with transparent render textures that need accuracy) and I am currently having to use almost twice the necessary (precious) gpu memory because I'm rendering everything twice to get colour and alpha separately, where in most cases I could be processing them together in a shader and using the results. If only viewporttextures could have pre-multiplied alpha disabled (as I think was an option in 3) or I could accurately get the colour from pre-multiplied viewporttextures. please let me know if I'm making an error in my usage and it does work edit: I don't mean to come across as entitled I'm just passionate about this project and using godot! thanks to all Godot contributors I'm very grateful to have come this far |
EDIT: discovered this is an issue in forward+ but apparently not in compatibility mode
Tested versions
v4.2.stable.official [46dc277]
System information
Godot v4.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1650 (NVIDIA; 31.0.15.4633) - Intel(R) Core(TM) i3-10100 CPU @ 3.60GHz (8 Threads)
Issue description
I'm rendering a quad with 50% grey material, 50% opacity to a viewport texture with transparent background
placing the viewport texture on a TextureRect over a ColorRect of 50% grey, the texture is a different darker grey
I believe the rendered texture should blend in seamlessly to the grey background? I have tried giving the TextureRect a material with Premultiplied Alpha, which results in a lighter grey
Note: when the quad material is at 0 or 100 opacity the render texture does indeed blend in, so I don't think it's a linear colour space issue?
I did see another issue relating to viewport transparency but it was stated the premuliply setting fixed it and it does NOT in this case
thanks!
Steps to reproduce
(simple version):
open the example project and observe the partially transparent render texture is visible when placed over a solid color rect of exactly the same value. the upper grey square on the left is set to mix and the lower set to premultiply, both are visible against the color rect
create 2 sets of subviewport container with subviewport children, in the upper one add camera3d and position in front a meshinstance with quad, with material 50% grey, unshaded, alpha mix on, 50% transparent. make sure viewport transparency is on
in the lower subviewport add a colorrect at 50% grey, and beneath a texturerect displaying the above viewport texture.
toggle the texturerect and notice a difference in value (darker) adding a material and setting it to premultiplied alpha will make it appear lighter than 50% grey instead
Minimal reproduction project (MRP)
premult_issue.zip
The text was updated successfully, but these errors were encountered: