Skip to content

TSL: Add support for rendering to integer-format render targets #33283

@gkjohnson

Description

@gkjohnson

Description

Currently it seems to not be possible to render to an integer-buffer render target, which can be useful for all kinds of utilities like picking, occlusion culling, etc. Note this is supported with shader materials and is used in this example, already. This issue is about adding support outputting a uint value:

const target = new RenderTarget( width, height, {
	format: RedFormat,
	type: UnsignedIntType,
} );

const material = new NodeMaterial();
material.outputNode = uint( 10 );

const mesh = new Mesh( geometry, material );

renderer.render( mesh, camera );

Solution

Allow for setting the outputNode to be a uint-type of vector 2, 3, 4, or scalar value, as above. Or a function that returns one of the same types. If outputs can only be of type vec4 in WebGPU then we can require it be

This also implies support for signed & unsigned integer clear colors.

Alternatives

None

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    TSLThree.js Shading Language

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions