home/ atoms/ inverse-function-glow

The 1/x function creates neon glow effects in shaders by producing extreme brightness near zero and a slow falloff

The function f(x) = 1/x approaches infinity as x approaches zero, producing extremely bright output for pixels close to a shape’s edge. In a shader, if d is the signed distance from a shape, 1.0/d yields near-infinite brightness at d≈0 (the edge) and a smooth falloff away from the edge. To make this visually useful, a scaling factor (e.g., 0.02/d) keeps the output within a meaningful range. This creates a characteristic neon-glow or bloom aesthetic: bright core at the edge, smooth luminous falloff. The tradeoff is numerical instability at d=0 (division by zero), which must be guarded against or accepted as white (clamped output). It produces a different shape of falloff than smoothstep — more dramatic close to the edge, slower farther away.

Examples

float d = length(uv) - 0.5; // SDF of circle
d = abs(d); // distance to edge from both sides
float glow = 0.02 / d; // neon glow
fragColor = vec4(vec3(glow), 1.0);

Assessment

Compare the falloff shape of 1/x with smoothstep(0.0, 0.1, x) plotted over x=[0,1]. At x=0.5, which function gives a higher output? At x=0.01, which gives a higher output? Explain what this means visually in a shader.

“the inverse function 1 over X is perfect for achieving that aesthetic instead of calculating the final color using the smooth step function on the D value I will take the inverse of d”
corpus · kishimisu-an-introduction-to-shader-art-coding-video · chunk 2