Parameters used to create a RenderMaterial.

interface RenderMaterialParams {
    uniforms?: ReadOnlyInputBindings;
    storages?: ReadWriteInputBindings;
    bindings?: BindGroupBindingElement[];
    label?: string;
    shaders?: MaterialShaders;
    useAsyncPipeline?: boolean;
    bindGroups?: BindGroup[];
    samplers?: Sampler[];
    textures?: MaterialTexture[];
    useProjection?: boolean;
    transparent?: boolean;
    depth?: boolean;
    depthWriteEnabled?: boolean;
    depthCompare?: GPUCompareFunction;
    depthFormat?: GPUTextureFormat;
    cullMode?: GPUCullMode;
    sampleCount?: number;
    verticesOrder?: GPUFrontFace;
    topology?: GPUPrimitiveTopology;
    targets?: Partial<GPUColorTargetState>[];
}

Hierarchy (View Summary)

Properties

Uniforms input to pass to a BindGroup.

Read only or read/write storages input to pass to a BindGroup.

Array of already created bindings (buffers, texture, etc.) to pass to this BindGroup.

label?: string

The label of the Material, sent to various GPU objects for debugging purpose.

shaders?: MaterialShaders

Shaders to use with this Material.

useAsyncPipeline?: boolean

Whether to compile the Material GPURenderPipeline or GPUComputePipeline asynchronously or not.

bindGroups?: BindGroup[]

Array of already created bind groups to be used by this Material.

samplers?: Sampler[]

Array of already created samplers to be used by this Material.

textures?: MaterialTexture[]

Array of already created Texture or MediaTexture to be used by this Material.

useProjection?: boolean

Whether this RenderMaterial should implicitly use the renderer camera and lights bind group.

transparent?: boolean

Whether this RenderMaterial should be treated as transparent. Impacts the render pipeline blend property.

depth?: boolean

Whether this RenderMaterial should write to the depth buffer.

depthWriteEnabled?: boolean

Whether this RenderMaterial should enable depth write.

depthCompare?: GPUCompareFunction

Depth function to use with this RenderMaterial.

depthFormat?: GPUTextureFormat

Format of the depth texture to use with this RenderMateria.l

cullMode?: GPUCullMode

Cull mode to use with this RenderMaterial.

sampleCount?: number

The sampleCount of the RenderPass onto which we'll be drawing. Set internally.

verticesOrder?: GPUFrontFace

Vertices order to be used by the render pipeline.

topology?: GPUPrimitiveTopology

Topology to use with this RenderMaterial, i.e. whether to draw triangles or points (see https://www.w3.org/TR/webgpu/#enumdef-gpuprimitivetopology).

targets?: Partial<GPUColorTargetState>[]

Optional array of one or multiple targets properties. Format property will be patched internally.