Skip to content

Home

Unity.mathx — extension library for Unity.Mathematics

Fluent, shader-like extensions for Unity.Mathematics — noise, SDFs, fast math, and Burst job helpers in one using static.

com.ltmx.mathematics.mathx

Quick start

using static Unity.Mathematics.mathx;

float3 v = new float3(1, 2, 3);
return v.length().clamp(0, 10).normalize();

Every method lives on the single mathx partial class — one import and you're done.

Fluent chains

return anyVector
    .length().clamp(0, 10).cos().sq()
    .rotate(anyQuaternion).div(3.2f).rcp().mul(3.2f).sum();
anyVector = math.clamp(math.length(anyVector), 0, 10);
anyVector = math.cos(anyVector);
anyVector = anyVector * anyVector;
anyVector = math.mul(math.rotate(anyQuaternion, anyVector), 1f / 3.2f);

See the Fluent chains guide for .set(out x) and when to break a chain.

Feature overview

  • Interpolation


    smoothstep, easing, smin / smax

  • Noise


    Simplex, Perlin, FBM, Worley, Voronoi

  • SDF


    Primitives and CSG-style combinations

  • Fast math


    fsqrt, fastsine, approximations vs math.*

  • Jobify


    Function pointers, parallel jobs, noise fill

  • Hashing


    xxhash32, hash01, gradient hashes

  • Structs


    bounds, ray, color, byte*

Install

Available on OpenUPM and via Git URL — see Getting started.

Roadmap

  • ✅ Fast functions, constants, Mathf translations
  • ✅ Random, component logic, interpolation, matrices
  • ✅ Noise, SDF, Jobify, hashing, vector builders
  • ✅ Generic jobs and function iterators