Shader Smoothness

Godot Version

Godot 4

Question

I’m working on a shader that simulates the “Iris Shot,” but when I use a tween to transition the values, the generated circle doesn’t look right; it appears to have too few vertices. I’m not sure if that’s really the issue, but the circle doesn’t look smooth. I want it to look fluid. Does anyone know how to fix this or if there’s a better method?`

shader_type canvas_item;

uniform float radius : hint_range(0.0, 1.5) = 1.5;
uniform vec2 center = vec2(0.5, 0.5);
uniform float aspect; 

void fragment() {
    vec2 uv = SCREEN_UV - center;

    uv.x *= aspect;
    float dist = length(uv);

    float edge = fwidth(dist);

    float mask = smoothstep(radius, radius + edge, dist);
    COLOR = vec4(0.0, 0.0, 0.0, mask);
}

use an image?

I’m not yet familiar with these cinematic effects, is this just a circle around the screen? is there any effect that needs to happen?

can you post a picture?

I think fwidth would create a diamond. if what you want is a circle, you need to use some form of sin() or cos() or both.