godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 68 forks source link

Allow importing textures with gaussian blurred mipmaps #9998

Open djrain opened 1 week ago

djrain commented 1 week ago

Describe the project you are working on

games

Describe the problem or limitation you are having in your project

For various effects it can be useful to blur a single sprite/texture using textureLod(), for instance a 2D motion blur shader I'm working on. But since the mipmaps are not gaussian blurred when generated, the result looks blocky and ugly:

blurred screen texture

Screenshot 2024-06-18 at 12 57 35 PM

"blurred" sprite

Screenshot 2024-06-18 at 12 57 12 PM

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a toggle to the Texture2D import settings to allow gaussian blurred mipmaps. This would allow blurring either the screen texture or an arbitrary texture with the same nice results.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

N/A

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, not efficiently

Is there a reason why this should be core and not an add-on in the asset library?

Not sure if possible through addon, also it kinda just exposes an existing feature to more use cases.

Calinou commented 1 week ago

Thanks for the report! Consolidating in https://github.com/godotengine/godot-proposals/issues/2450.

djrain commented 1 week ago

@Calinou I had seen that proposal and it seemed related at most - it sounds like the opposite of intentional blurring. Could you explain how that would allow to achieve a heavy gaussian blur?

clayjohn commented 1 week ago

I agree. The use case is different. Kaiser filtering is a blur + sharpen whereas Guassian is a very soft blur. Kaiser is used to increase contrast for smaller mipmaps while the proposal here is about having a cheap way of blurring textures in 2D