Interface RenderMaterialRenderingOptions

Rendering options to send to the render pipeline.

interface RenderMaterialRenderingOptions {
    useProjection: boolean;
    transparent: boolean;
    depth: boolean;
    depthWriteEnabled: boolean;
    depthCompare: GPUCompareFunction;
    depthFormat: GPUTextureFormat;
    depthBias: number;
    depthBiasClamp: number;
    depthBiasSlopeScale: number;
    stencil?: {
        front: GPUStencilFaceState;
        back?: GPUStencilFaceState;
        stencilReference?: number;
        stencilReadMask?: number;
        stencilWriteMask?: number;
    };
    sampleCount: number;
    alphaToCoverageEnabled: boolean;
    mask: number;
    targets: GPUColorTargetState[];
    cullMode: GPUCullMode;
    unclippedDepth?: boolean;
    verticesOrder: GPUFrontFace;
    topology: GPUPrimitiveTopology;
    stripIndexFormat?: GPUIndexFormat;
}

Hierarchy (View Summary)

Properties

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

depthBias: number

A number representing a constant depth bias that is added to each fragment. Default to 0.

depthBiasClamp: number

A number representing the maximum depth bias of a fragment. Default to 0.

depthBiasSlopeScale: number

A number representing a depth bias that scales with the fragment's slope. Default to 0.

stencil?: {
    front: GPUStencilFaceState;
    back?: GPUStencilFaceState;
    stencilReference?: number;
    stencilReadMask?: number;
    stencilWriteMask?: number;
}

Define the stencil operations to use if any.

Type declaration

  • front: GPUStencilFaceState

    Defines how stencil comparisons and operations are performed for front-facing primitives.

  • Optionalback?: GPUStencilFaceState

    Defines how stencil comparisons and operations are performed for back-facing primitives. If undefined, will fall back to front values.

  • OptionalstencilReference?: number

    Set the GPURenderPassEncoder stencil reference value used during stencil tests if any. Default to 0x000000 if a stencil is used.

  • OptionalstencilReadMask?: number

    A bitmask controlling which stencil value bits are read when performing stencil comparison tests. Default to 0xFFFFFF.

  • OptionalstencilWriteMask?: number

    A bitmask controlling which stencil value bits are written to when performing stencil comparison tests. Default to 0xFFFFFF.

sampleCount: number

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

alphaToCoverageEnabled: boolean

When true indicates that a fragment's alpha channel should be used to generate a sample coverage mask. Default to false.

mask: number

Mask determining which samples are written to. Default to 0xFFFFFFFF.

targets: GPUColorTargetState[]

Array of one or multiple targets properties.

Each target should be an object with the optional format, blend and writeMask properties.

The format property will be internally patched to match the output RenderPass target (default to the renderer preferred format).

If defined, the blend property can override the default transparent blending if set.

cullMode: GPUCullMode

Cull mode to use with this RenderMaterial.

unclippedDepth?: boolean

If true, indicates that depth clipping is disabled. Requires the depth-clip-control feature to be enabled. Default to false.

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).

stripIndexFormat?: GPUIndexFormat

Define the index buffer format for strip topologies. Set internally.