Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Any tips/best practices for trying to apply a shader to the TextureRect (say if I want to apply visual filters like a CRT effect)? I tried a test with this shader (VHS and CRT monitor effect - Godot Shaders) and it doesn't seem to play nice.

Godot 4 came out in 2023. This shader is from 2021. I wouldn’t expect it to run out of the box, but you might be able to fix the 3.x->4.x changes.

(+1)

It actually works fine with some minor tweaks. 

  1. First create a second TextureRect node.
  2. change its texture to "CanvasTexture".
  3. under "Ordering" increase it's Z index to 1.
  4. change it's material to your shader and drop the shader code onto it. 
  5. Then near the top of the shader code add this line:
    1. uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;

and viola:

 

(+1)

Sorry I forgot to respond, but yes! I actually ended up coming to this solution on my own previously. I basically ran into the issue I described with almost any shader (4.x or not) I used unless I applied it to a texture-rect sitting over the one with the actual GB rom.