Converting shaders

From GLSL to Godot shaders

Godot 3.5 documentation about shaders

iResolution

SCREEN_PIXEL_SIZE is the inverse of iResolution

UV

Usually on shader toy you will see UV from fragcoord

But in Godot if you want to make shader draw things in object coordinates, then just use

mat2

If you have an error message like

then replace the way 2D matrix is created. It must be 2 vectors of floats, but not 4 floats

Helper functions

For example, SCREEN_PIZEL_SIZE only defined in main fragment() function, pass it as argument to other functions.

Last updated