Parameters
Name | Type | Description |
---|---|---|
r | vec4<f32> | Input 4D vector. |
Returns
vec4<f32>square root approximation.
WGSL Code
fn taylorInvSqrt4(r: vec4f) -> vec4f {return 1.79284291400159 - 0.85373472095314 * r;}
series inverse square root approximation for Perlin noise.
Name | Type | Description |
---|---|---|
r | vec4<f32> | Input 4D vector. |
fn taylorInvSqrt4(r: vec4f) -> vec4f {return 1.79284291400159 - 0.85373472095314 * r;}
an elastic wave with exponential decay and sinusoidal oscillation.
interpolation between two values with smooth acceleration and deceleration.
interpolation between two vectors with smooth acceleration and deceleration.
a 2D vector by a given angle.
an exponential ramp function with derivative.
a logistic (S-curve) function with derivative.
a stepped sequence with optional smoothing between steps.
A JavaScript library providing WGSL utility functions as strings for WebGPU shader development. Includes mathematical utilities, noise generation, signed distance fields, and color manipulation functions.
npm install wgsl-fns
import { taylorInvSqrt4, getFns } from 'wgsl-fns'
getFns(['taylorInvSqrt4'])