Cube and 3D textures, bias and gradients
An environment map as a texture_cube<f32> looked up by direction, a colour-grading table as a texture_3d<f32> the shaded colour indexes, textureSampleBias and textureSampleGrad, and a point light’s shadow as a texture_depth_cube compared by the direction from the light.
If VS Code did not open, the TypeShade extension may be missing. How to install it.
Compile a module with a vertex entry and a fragment entry to see it drawn.
host.ts is running in a sandboxed frame over the canvas. Its console lines are in the Console tab.
Run the fragment entry once per pixel, with no GPU.
Call console.log in a shader to see its lines here. A compute module logs every invocation. In a module that draws, click a pixel of the canvas, or record the whole frame on WebGPU.
The editor holds this example's own file, and the program is that file and any file it imports. An edit recompiles it in your browser, and the tabs beside the editor follow.