juliaSDF: Julia Set Fractal Distance Field
Complex Number Iteration for Fractal Boundary Detection
The juliaSDF
function generates a Julia set fractal pattern through iterative complex number calculations. This function evaluates the escape time of points under the iteration , where is a complex constant.
Mathematical Foundation
The Julia set is defined by the iterative formula:
where:
- represents the initial complex coordinate (transformed input position)
- is a complex constant that determines the fractal shape
- The iteration continues until or maximum iterations are reached
The escape time normalization:
produces a continuous field value representing the fractal boundary distance.
Function Variants
Function | Parameters | Description |
---|---|---|
juliaSDF | st , center , c , r | Full parameterization with center and radius |
juliaSDFSimple | st , c , r | Simplified version with default center at (0.5, 0.5) |
Implementation Demonstrations
Live Editor
const fragment = () => { const pos = uv.sub(0.5) const c = vec2(-0.7, 0.27015) const fractal = juliaSDF(pos.add(0.5), vec2(0.5), c, 1.2) const color = fractal.mul(vec3(1, 0.8, 0.3)) return vec4(color, 1) }