How to access pixels color values outside of the screen from a shader ?

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

Hi, I’m making a screen shader that needs to read the color of each pixel in order to cast the shadow of that pixel depending on its height (each sprite has a heightmap associated).

The problem is that I’m currently reading the SCREEN_TEXTURE so I can’t access pixels outside of the screen. This means that sprites slightly outside of the player’s field of view don’t get their shadow drawn properly.

good

bad

Is there a way I can render pixels a bit outside of the screen to be able to read their color values from my screen shader ?