Skip to content

Instantly share code, notes, and snippets.

View caburet's full-sized avatar

Joel Partida caburet

View GitHub Profile
@t-karcher
t-karcher / curved_fragment.shader
Last active August 24, 2023 15:08
Godot shader bending a flat 2d world (e.g. a platformer) to a tiny planet.
shader_type canvas_item;
uniform sampler2D screen_texture : hint_screen_texture, filter_nearest;
uniform float radius = 3.0;
void fragment() {
vec2 uv = SCREEN_UV;
uv.y = 1.0 - uv.y; // seems like the origin changed in Godot 4.
vec2 surface = vec2(0.5, 0.2);
vec2 center = surface - vec2(0, radius);