smoothstep
On this page

smoothstep()

Function in Builtins

smoothstep(e0, e1, x): Hermite interpolation from 0 at x = e0 to 1 at x = e1, component-wise.

import { smoothstep } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

function smoothstep<K extends `vec${number}<f32>`>(
e0: ReadonlyNode<K>,
e1: ReadonlyNode<K>,
x: ReadonlyNode<K>,
): Node<K>;
function smoothstep(
e0: ReadonlyNode<'f32'> | number,
e1: ReadonlyNode<'f32'> | number,
x: ReadonlyNode<'f32'> | number,
): Node<'f32'>;

Parameters

e0 ReadonlyNode<K>
e1 ReadonlyNode<K>
x ReadonlyNode<K>

Return value

Node<K>

Description

WGSL requires all three arguments to have the same type, scalar or vector. The vector overload keeps the key of x; the scalar overload takes f32 nodes or JS numbers.

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

smoothstep(e0, e1, x).

GLSL ES 3.00 (WebGL2) Supported

smoothstep(e0, e1, x).

CPU oracle Supported

Evaluated in f64 by the oracle.

In the guide

Source

src/core/ir/node.ts, line 1759, at commit 26de7be8

Edit this page Report a problem