-
-
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
OpenGL: textureLod()
is blocky due to using linear mipmaps instead of Gaussian
#72823
Comments
This is because the mipmap roughness generator is not used in the OpenGL renderer (most likely for performance reasons). Instead, basic bilinear downsampling is performed. I suppose an option to use a roughness mipmap generator can be added like in 3.x, but it will surely be disabled by default. You can work this around by performing bicubic sampling on the downsampled texture, which will effectively make it look blurry. See godotengine/godot-proposals#3231 where a similar issue popped up back when the Vulkan renderer didn't use a roughness mipmap generator. Example code for bicubic sampling on the screen texture: Calinou@2d9d52f |
textureLod()
is blocky due to missing roughness mipmap generator
An option for Gaussian blurred mipmaps seems like a good idea. The reason they weren't used in the OpenGL renderer is that they are super slow to generate on mobile and integrated GPUs. That being said, now that generating mipmaps for SCREEN_TEXTURE is entirely optional, users get to choose whether to take that performance hit. And there probably aren't many uses for non-Gaussian mipmaps in 2D. |
I think this would be a good idea as a very common use of this will be to blur the background when pausing a game or opening a menu of some sort. In these cases performance will not be critical, but getting the nicer blur appearance would be very good. |
This can be done by setting the Environment background mode to Canvas, enabling Glow then configuring it to act as a blur shader: godotengine/godot-proposals#3485 (comment) That said, glow isn't implemented in the Compatibility rendering method yet. |
Yes, this is a great technique! I used it (based on your linked tip) for my game to get a nice background blur on the mobile renderer since that supports Glow (but not textureLod I think?). However, as you noted Environment Glow isn't supported on Compatibility yet and there are cases where you might not want to do a full screen blur like the Environment Glow technique entails. |
Agree that having the option for gaussian mipmaps would be nice. We were forced back to compatibility mode for performance reasons (not entirely sure what exactly). But it's a bit of a bummer losing the nice blur, we're using it in several places and finding a performant workaround is tricky. |
textureLod()
is blocky due to missing roughness mipmap generatortextureLod()
is blocky due to using linear mipmaps instead of Gaussian
Godot version
v4.0.beta17.official [c400205]
System information
Windows 11, OpenGL (Compatibility), RTX 2060 (31.0.15.2824)
Issue description
I tried to make a blurred panel for a ui element with texturelod via shader:
but what I got instead is this:
vulkan renderer does not exhibit this issue:
Steps to reproduce
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: