Renderer · interface
GpuDrivenMaterial
What a material tints and emits.
Explained in Hello world.
interface GpuDrivenMaterialimport type { GpuDrivenMaterial } from '@driftengine/core';Properties
| Name | Type | Description |
|---|---|---|
tintreadonly | readonly [number, number, number] | |
emissivereadonly | number | Added to the lit colour as albedo * emissive. Zero for an ordinary surface. |
roughnessreadonlyoptional | number | 0 is a mirror and 1 is fully rough. Defaults to 1, which is the matte this pipeline had.MoreBelow 0.1 the highlight gets dimmer as the surface gets smoother, which is the forward
path's own lobe and is recorded in |
specularreadonlyoptional | number | How much of the light the surface returns as a highlight. Defaults to 0.MoreZero is what keeps this from moving anything: a material that says nothing about shininess renders exactly the frame it rendered when the lit expression was four lines. |
reflectivityreadonlyoptional | number | How much of the environment the surface returns, before angle and roughness. Defaults to 0.MoreWith no probe bound this reflects the same two-colour gradient the ambient comes from, which
is what the forward path reflects in the same situation — see |
metalnessreadonlyoptional | number | 0 is a dielectric and 1 is a metal. Defaults to 0.MoreOne number a material, where A metal reflects whether or not |
texturesreadonlyoptional | GpuDrivenTextures | The material's maps, as DriftTexture decode programs, decoded per shaded pixel on the device.MoreA material with none uploads exactly the entry it uploaded before textures existed, so the
frame it draws is unchanged — the promise every term in this pipeline makes. See
|
alphaCutoffreadonlyoptional | number | Discard a fragment whose base-colour alpha is below this. Zero means no test.MoreThe test happens in the raster rather than in the shading pass, because that is where a
pixel learns which triangle owns it: a discard in Zero is the default and it skips the fetch outright, so a material that says nothing about cutout draws exactly the frame it drew before — the promise every term in this pipeline has made since it was four lines. A cluster carries one material, so the branch is coherent across every fragment of a draw rather than divergent within one. It needs a |
blendreadonlyoptional | boolean | Draw this material's clusters blended instead of into the visibility buffer. Defaults to false.MoreA visibility buffer stores one surface a pixel, so it cannot hold a blend at all — that is architecture rather than an omission. What a blended material asks for is that its clusters skip the opaque half entirely and be drawn again by a second raster that shades in its own fragment stage and writes the two weighted-transparency targets. The cut runs a second time to find them, and a scene with no blended material runs neither stage. The opacity is |
opacityreadonlyoptional | number | How much of a blended surface is its own colour rather than what is behind it. Defaults to 1.MoreRead only where |
glassreadonlyoptional | GlassOptions | Glass: how much light passes, how milky it is, and the colour it takes — GlassOptions, as the
forward path's drawTranslucentMesh takes it. Absent, or letting nothing through, is not glass.MoreA glass material is drawn in the blended half whatever |