Screen space equirectangular shader

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

I am currently trying to make use of a equirectangular images in a prototype I’m making. It’s set up in a way where i have a single ColorRect with the shader applied to it.
The purpose of the shader is to modify the UVs of the screen texture in order to “undistort” what’s under the ColorRect from equirectangular into rectlinear/perspective.

I tried to look for resources but what i found implemented moving/rotating around inside the shader itself, which completely misses the point of what I’m trying to achieve. The 2D camera itself with the ColorRect attached to it is supposed to move, while the images stay static.

I need to implement it with min and max Longitude and Latitude (a single range value instead of two min and max values would work too), as most images aren’t fully 360 degrees. Control over the field of view is also something I’ll might need.

Also I’m sorry if this came out as “do this for me” kind of post, but i am genuinely at a loss of options right now.

Not quite sure I understand what you’re tring to achieve but if you have to move the Camera2D, the only vay to do it is via it’s position property.

Then you’re going to have to either move the Canvas Node’s position to counteract it, or possibly apply “position” uniforms into the shader if you posibly need some transformation that can be done inside of the shader.

All this said, you need to rephrase the question as I am not yet sure I understand what you’re trying to achieve.

Griefchief | 2023-07-06 13:47

You (probably) need to use GDScript (not GDScript shader code) to achieve the camera movement that you want. As for UV perspective changes, that one will obviously need to be done in shader.

We are not going to be able to help more without a better explanation.

Griefchief | 2023-07-06 13:51