File: StorageTextureNode.md | Updated: 11/15/2025
This special version of a texture node can be used to write data into a storage texture with a compute shader.
This node can only be used with a WebGPU backend.
const storageTexture = new THREE.StorageTexture( width, height );
const computeTexture = Fn( ( { storageTexture } ) => {
const posX = instanceIndex.mod( width );
const posY = instanceIndex.div( width );
const indexUV = uvec2( posX, posY );
// generate RGB values
const r = 1;
const g = 1;
const b = 1;
textureStore( storageTexture, indexUV, vec4( r, g, b, 1 ) ).toWriteOnly();
} );
const computeNode = computeTexture( { storageTexture } ).compute( width * height );
renderer.computeAsync( computeNode );
Constructs a new storage texture node.
value | The storage texture.
---|---
uvNode | The uv node.
storeNode | The value node that should be stored in the texture. Default is null.
The access type of the texture node.
Default is 'writeOnly'.
This flag can be used for type testing.
Default is true.
The mip level to write to for storage textures.
Default is 0.
The value node that should be stored in the texture.
Default is null.
Generates the code snippet of the storage node. If no storeNode is defined, the texture node is generated as normal texture.
builder | The current node builder.
---|---
output | The current output.
Overrides: TextureNode#generate
Returns: The generated code snippet.
Generates the code snippet of the storage texture node.
builder | The current node builder.
---|---
Overwrites the default implementation to return a fixed value 'storageTexture'.
builder | The current node builder.
---|---
Overrides: TextureNode#getInputType
Returns: The input type.
Defines the node access.
value | The node access.
---|---
Returns: A reference to this node.
Sets the mip level to write to.
level | The mip level.
---|---
Returns: A reference to this node.
Convenience method for configuring a read-only node access.
Returns: A reference to this node.
Convenience method for configuring a read/write node access.
Returns: A reference to this node.
Convenience method for configuring a write-only node access.
Returns: A reference to this node.