UNPKG

@thi.ng/shader-ast-stdlib

Version:

Function collection for modular GPGPU / shader programming with @thi.ng/shader-ast

44 lines 1.33 kB
/** * Higher order function to compute 3D texture-based FBM noise for given number * of octaves and decay factor (default: 1/octaves). Returns a 2-arg shader * function, taking a sampler3D and vec3 position and which returns summed noise * value as vec4. * * @remarks * Not compatible with WebGL 1.0 (texture type not natively supported). * * The texture should be configured to use linear filtering and texture repeat * mode. * * Using thi.ng/webgl (for example), the 3D noise texture can be initialized as * follows: * * @example * ```ts * import { repeatedly } from "@thi.ng/transducers"; * import { * defTexture, * TextureFilter, TextureFormat, TextureRepeat, TextureTarget * } from "@thi.ng/webgl"; * * // (GL context creation omitted here) * * const noiseTex = defTexture(gl, { * width: 32, * height: 32, * depth: 32, * target: TextureTarget.TEXTURE_3D, * format: TextureFormat.RGB, * filter: TextureFilter.LINEAR, * wrap: TextureRepeat.REPEAT, * image: new Uint8Array( * repeatedly(() => Math.random() * 255.5, 32 * 32 * 32 * 3) * ) * }); * ``` * * @param octaves * @param decay */ export declare const fbmNoiseVec34: (octaves: number, decay?: number) => import("@thi.ng/shader-ast").TaggedFn2<"sampler3D", "vec3", "vec4">; //# sourceMappingURL=fbm.d.ts.map