Hey,

I'm trying to enable mipmap on the texture of a Viewport Node (in order to do a blur pass in a post process like this: http://kidscancode.org/godot_recipes/shaders/blur/). I'm using a Viewport as a "RenderTexture".

I've tried setting the Texture.FLAG_MIPMAPS on the viewport texture ... but this is not working.

I DON'T want to create a copy of the data in a new Image (and using generate_mipmaps) because it costs a lot !!!

Any help would be much appreciated :)

Thanks !

Why do you need mipmaps? Does textureLod() require them?

Unfortunately as of now (might change in the future), Viewport textures cannot have mipmaps. A workaround you could try would be to use multiple viewports; each twice as small as the other. You'd then have to cleverly sample them in your shader.

Do note however that ScreenTexture can have mips, as per the 2D shaders demo IIRC, which has a blur demo in it.

I've also recreated that demo for someone else in the past here, don't recall what issue they had with the demo project, perhaps that it was packed into the scene itself rather than being a externally saved shader..?

Hum okay that's sad :( However it seems to work using a screen reading shader, sampling the SCREEN_TEXTURE using textureLod works. I wonder why mipmap are activated on the main viewport texutre and not the other...

PS: I forgot to mention that I already tested the viewport resizing approach, the result wasn't good enough.

Anyway, thanks I'll find a workaround.

3 years later