Polar Coordinate Material Function

Was Looking for this, what code is in the custom node named “atan2” ?

I tried something like this:

// Input: UV (U, V) - standard texture coordinates
// Output: Polar coordinates (Radius, Theta)

float2 UV = In.xy;

// Center the UV coordinates around (0,0)
UV -= 0.5;

// Compute the Radius
float Radius = length(UV);

// Compute the angle Theta
float Theta = atan2(UV.y, UV.x);

// Convert Theta from radians to [0, 1] range if needed
Theta = (Theta + PI) / (2.0 * PI);

// Output the Polar coordinates
return float2(Radius, Theta);

(Name the input “In”)


1 Like