メインコンテンツまでスキップ

Fractional Universe Generator

Mathematical Foundation​

The fractional function extracts the decimal portion of numbers, transforming continuous mathematical space into repeating, crystalline structures. This fundamental operation enables the creation of infinite tiling patterns, geometric repetitions, and mathematical harmonies that extend beyond the boundaries of conventional space.

Fractional Function Formula: frac(x)=x−⌊x⌋\text{frac}(x) = x - \lfloor x \rfloor

Where:

  • xx is the input value
  • ⌊x⌋\lfloor x \rfloor is the floor function (greatest integer less than or equal to xx)
  • The result is always in the range [0,1)[0, 1)

This can also be expressed as: frac(x)=x mod 1\text{frac}(x) = x \bmod 1

The function creates a sawtooth wave pattern that repeats every unit interval:

frac(x)={xif 0≤x<1x−1if 1≤x<2x−2if 2≤x<3⋮\text{frac}(x) = \begin{cases} x & \text{if } 0 \leq x < 1 \\ x - 1 & \text{if } 1 \leq x < 2 \\ x - 2 & \text{if } 2 \leq x < 3 \\ \vdots \end{cases}

By capturing only the fractional remainder, complex coordinate systems collapse into elegant, repeating units that form the foundation for procedural textures, architectural patterns, and natural crystalline formations.

ライブエディター

const fragment = () => {
      const tiled = frac(uv.mul(8))
      const pattern = smoothstep(0.1, 0.2, tiled.x).mul(float(0.1).smoothstep(0.2, tiled.y))
      const gradient = tiled.sub(0.5).length().mul(2)
      return vec4(vec3(pattern.mul(gradient)), 1)
}
結果
Loading...