@typegpu/noise
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

@typegpu/noise

🚧 Under Construction 🚧

A set of noise/pseudo-random functions for use in WebGPU/TypeGPU apps.

import { randf } from '@typegpu/noise';

const time = root.createUniform(f32);

const mainFrag = tgpu
  .fragmentFn({
    in: { pos: builtin.position },
    out: vec4f,
  })((input) => {
    randf.seed2(add(input.pos.xy, vec2f(time.$)));

    const val = randf.sample(); // => number
    const normal = randf.onUnitSphere(); // => v3f
    const dir = randf.inUnitCircle(); // => v2f
  });

Readme

Keywords

none

Package Sidebar

Install

npm i @typegpu/noise

Weekly Downloads

309

Version

0.1.0

License

MIT

Unpacked Size

123 kB

Total Files

8

Last publish

Collaborators

  • iwoplaza
  • mhawryluk
  • reczkok
  • oloiwojo