Anti-Aliased Fractional Part Function
Digital Pattern Revolution
Traditional fractional functions create harsh digital artifacts when creating repeating patterns. The aafract
function eliminates these jagged edges by intelligently applying anti-aliasing based on screen pixel density, producing silk-smooth visual patterns that adapt perfectly to any zoom level or viewing distance.
Mathematical Foundation
The anti-aliased fractional function analyzes pixel derivatives to determine optimal smoothing:
The fractional computation with conditional smoothing:
The result is processed through Nyquist filtering:
Where represents the fractional part, enabling seamless pattern repetition without aliasing artifacts.
ライブエディター
const fragment = () => { const pattern = aafract(uv.x.mul(20)) const color = pattern.toVec3() return vec4(color, 1) }
Technical Specifications
Parameter | Type | Description | Range |
---|---|---|---|
x | float | vec2 | Input value for fractional computation | Any real number |
Return Value: Same type as input, containing smoothly anti-aliased fractional part