Medium EffectsAnimated

Radar sweep

A green radar screen: rings, crosshair and a fading sweep arm.

The target picture for the shader challenge "Radar sweep"
Recreate this picture. You pass at a 99% match, then try to write it in fewer characters than the par.

How this challenge works

You write a fragment shader that draws the picture above, live in your browser. A match bar shows how close you are, and the score combines accuracy, code size (the par is 482 characters in Unity (Built-in)) and GPU speed. Work in HLSL, GLSL, WGSL, Metal or Godot and export the result when you are done.

The numbers you need

Polar
r = length(p), a = atan2(p.y, p.x)
Sweep
pow(frac(-a / 6.28318 - time * 0.3), 3.0)
Rings
smoothstep(0.47, 0.5, abs(frac(r * 10.0) - 0.5))
Cross
1.0 - smoothstep(0.0, 0.004, min(abs(p.x), abs(p.y)))
Color
float3(0.02,0.08,0.04) + float3(0.1,0.9,0.4) * (sweep * 0.8 + rings * 0.25 + cross * 0.2)
Screen
multiply by 1.0 - smoothstep(0.44, 0.45, r)

Solve it in your language

Unity (Built-in), Unity (URP), Unreal, Shadertoy / WebGL, OpenGL (LWJGL, raylib), three.js, GameMaker, LÖVE (Lua), Godot, Apple (iOS, macOS), WebGPU / Bevy.

Start coding