-
-
Notifications
You must be signed in to change notification settings - Fork 36.3k
Description
Description
Right now it's possible to set a 3D Texture or Array Texture on the Renderer using arguments in the "setRenderTarget" using the second argument in addition reading pixels back from a specific layer in the "readRenderTargetPixelsAsync". However there's no way to bind a single layer as a 2d texture and render with it as a texture map, which I understand is possible in both WebGL and WebGPU.
Solution
I haven't thought extensively through how the API should look but to give an impression of how it could work:
// ArrayTexture or 3D Texture
const arrayTex = new DataArrayTexture( 64, 64, 3 );
// Create a texture bound to layer 1
const texLayer = new TextureLayer( arrayTex.source, 1 );
//
// Can be used as texture map
material.map = texLayer;
// for rendering to if it's a render target variation
renderer.setRenderTarget( texLayer );
// or reading data back, copying, etcAlternatives
Limit path tracer functionality to platforms with higher limits
Additional context
At some point I would like to enable a denoiser for the path tracer which will require outputting both a normal and albedo texture in addition to the final beauty pass. This would require more storage texture bindings than are typically allowed in a compute shader (4) so I would like to use an array texture and render each of those to a separate layer and then access them as 2d textures in the denoising pass.