smoothstep
Function
Applies Hermite interpolation between edge0 and edge1, clamped to [0, 1].
The signature and the sentence under each name are the compiler's own text at commit 26de7be8.
Syntax
declare function smoothstep<V extends vec2 | vec3 | vec4>(a0: V, a1: V, a2: V): Vdeclare function smoothstep<P0 extends number, P1 extends number, P2 extends number>(a0: P0, a1: P1, a2: P2): ([P0] extends [boolean] ? bool : typeof f32Tag extends keyof P0 ? f32 : typeof i32Tag extends keyof P0 ? i32 : typeof u32Tag extends keyof P0 ? u32 : typeof f64Tag extends keyof P0 ? f64 : ([P1] extends [boolean] ? bool : typeof f32Tag extends keyof P1 ? f32 : typeof i32Tag extends keyof P1 ? i32 : typeof u32Tag extends keyof P1 ? u32 : typeof f64Tag extends keyof P1 ? f64 : ([P2] extends [boolean] ? bool : typeof f32Tag extends keyof P2 ? f32 : typeof i32Tag extends keyof P2 ? i32 : typeof u32Tag extends keyof P2 ? u32 : typeof f64Tag extends keyof P2 ? f64 : number)))declare function smoothstep<T extends Numeric>(a0: T, a1: T, a2: T): TA number in a parameter or a return position is the scalar slot. The ambient file declares a GPU scalar as a branded number whose brand is optional, so a literal and any branded scalar both fill it.
type f32 = number & { readonly [f32Tag]?: true }
A declaration you write still needs a width, and a bare number on a field or a parameter is refused; the TypeScript constructs page carries that row with the compiler's own message.
A signature may name a type the ambient file declares for its own use. These are those declarations.
Numerictype Numeric = number | vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u
Parameters
A parameter named by position (a0, a1) carries a name the ambient file generates. A call passes its arguments in order and names none of them.
-
a0VP0T -
a1VP1T -
a2VP2T
Return value
V([P0] extends [boolean] ? bool : typeof f32Tag extends keyof P0 ? f32 : typeof i32Tag extends keyof P0 ? i32 : typeof u32Tag extends keyof P0 ? u32 : typeof f64Tag extends keyof P0 ? f64 : ([P1] extends [boolean] ? bool : typeof f32Tag extends keyof P1 ? f32 : typeof i32Tag extends keyof P1 ? i32 : typeof u32Tag extends keyof P1 ? u32 : typeof f64Tag extends keyof P1 ? f64 : ([P2] extends [boolean] ? bool : typeof f32Tag extends keyof P2 ? f32 : typeof i32Tag extends keyof P2 ? i32 : typeof u32Tag extends keyof P2 ? u32 : typeof f64Tag extends keyof P2 ? f64 : number)))T
Description
Returns 0 when x is less than or equal to edge0, 1 when greater than or equal to edge1, and interpolates smoothly between. Componentwise over vectors.
Targets
- WGSL
-
smoothstep(a, b, c) - GLSL ES 3.00
-
smoothstep(a, b, c)
Examples
graticule.tshillshade.tsfp64-checker-plane.tsfp64-loran.tsfp64-mercator-tiles.tsfp64-rtc.tscolor-ramp.tsdomain-warp.tstunnel.tsmetaballs.tsocean.tsstarfield.tstruchet.tskaleidoscope.tsheart.tsfp64-clock.tsfp64-cancellation.tsfp64-sine-sweep.tsstorage-texture.shade.tspick-composite.shade.tsdefault-args.shade.tsclosures.shade.tshigher-order.shade.tsinferred-returns.shade.tsarray-methods.shade.tscapsule-corp-namek-class.shade.tsorbit-inout.shade.tsshape-inheritance.shade.tsmixin-surface.shade.tsgeneric-class.shade.tsclass-syntax.shade.tsclass-builder.shade.tsclass-parts.shade.tsimported-noise.shade.tshillshade-twin.shade.tsdomain-warp-twin.shade.tstunnel-twin.shade.tsocean-twin.shade.tsstarfield-twin.shade.tskaleidoscope-twin.shade.tsfp64-checker-plane-twin.shade.tsfp64-loran-twin.shade.tsfp64-rtc-twin.shade.tsfp64-clock-twin.shade.tsfp64-cancellation-twin.shade.tsfp64-sine-sweep-twin.shade.ts