Applying 'Bilinear filter' to a 2d scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Reginhowl

Is it possible to apply a bilinear filter effect to the 2d scene or what the camera displays?
Reimport filter doesn’t seem to be a solution because at 100% zoom or 1.0 scale, it shows a sharp clear pixel and also it looks a bit more than trilinear(too blurry) at different zoom.

Is there a way to implement this bilinear filter, just to smooth /blur all 2d pixels displayed on the camera?

:bust_in_silhouette: Reply From: Zylann

Just import your textures with filter on. I think that’s even the default, so not sure why you would get sharp pixels instead. If you see any sprite being pixelated when you zoom, it must be due to its texture not having the filter on (also I think Godot’s filter is bilinear).

If what you want is actual blur, then you could have a look at screen-reading shaders to code a post-process shader that applies to the whole screen: Screen-reading shaders — Godot Engine (3.0) documentation in English

Thank you for the response, It is very helpful and i learn many new things!
Is it possible to handle the reimport textures with filter on/off during runtime via script?

For example, i have an in-game option with a boolean bilinear filter… or perhaps if is it inefficient, is taking the route of screen reading shader more logical?

Sprite pixel at zoom 100% or 50% looks great, but at 75% is when the issue of distorted pixel shows. Bilinear resolves that although at the cost of blurriness, which i am okay with.
Problem with Bilinear filter is, it works at all zoom level except 100% so i can either hack it by setting zoom at 99% or 101% to apply the blur effect.

Looking forward to your thoughts. Thanks again!

Reginhowl | 2018-07-19 01:28