Trying to curve platforms and the shader code Im using is not working. Can someone explain to me why and/or give me steps on how to fix it.
shader_type canvas_item;
uniform float curve_strength : hint_range(0.0, 1.0);
void fragment() {
vec2 uv = FRAGCOORD.xy / SCREEN_PIXEL_SIZE; // Normalize coordinates
vec2 center = vec2(0.5, 0.5); // Center of the texture
// Calculate the distance from the center
float dist = distance(uv, center);
// Apply the curvature effect
if (dist < 0.5) {
float angle = acos(dist); // Get the angle
float curve = sin(angle * 2.0) * curve_strength; // Curve effect
uv.y += curve; // Adjust the UV based on the curve
}
// Set the final color
COLOR = texture(TEXTURE, uv);
}
okay so it looks like the shader is working in the material preview, are you actually putting this material onto anything though? like a canvas rectangle for example
this shader you’ve posted above is a postprocessing shader, it needs to put put onto a canvas texture. or maybe what you really want here is a vertex shader if you just want to add curvature to this one platform