Function ExtractChannelAsync
-
ExtractChannelAsync(
name: string,
input: ITextureProcessOperand,
channel: TextureChannel,
scene: Scene,
outputColorSpace?: TextureColorSpace,
outputChannelMask?: ChannelMask,
outputOptions?: ITextureProcessorOutputOptions,
): Promise<ITextureProcessOperand>Parameters
- name: string
Name for the resulting procedural texture (used only when a GPU pass is needed)
- input: ITextureProcessOperand
Operand to extract the channel from
- channel: TextureChannel
The channel to extract and broadcast
- scene: Scene
Scene to create the texture in (used only when a GPU pass is needed)
OptionaloutputColorSpace: TextureColorSpaceOptional output color space. When
TextureColorSpace.SRGB, the linear result is converted to sRGB (IEC 61966-2-1) before being written. Defaults toTextureColorSpace.Linear.OptionaloutputChannelMask: ChannelMaskOptional bitmask of channels to write. Excluded color channels are set to
0.0; excluded alpha is set to1.0. Defaults toChannelMask.RGBA(all channels written).OptionaloutputOptions: ITextureProcessorOutputOptionsOptional render-target type, sampling, and mipmap settings.
Returns Promise<ITextureProcessOperand>
An operand whose
textureholds the GPU result, or whosefactorholds the CPU-folded constant - name: string
Extract a single channel from a texture and broadcast it to RGB (or all four components for
TextureChannel.A), producing a new texture. This is a convenience wrapper overMultiplyTexturesAsyncwith a(1,1,1,1)factor and the requested channel swizzle applied to the input.Swizzle results per channel:
TextureChannel.R→ (r, r, r, a)TextureChannel.G→ (g, g, g, a)TextureChannel.B→ (b, b, b, a)TextureChannel.A→ (a, a, a, a)If the input is constant (no texture), the swizzle is applied on the CPU.
Any
colorSpaceproperty on the input operand is honoured (sRGB linearization applied before the swizzle). Any existingchannelon the input is replaced by thechannelargument.When the input is the result of a previous operation (i.e. it carries a
disposefunction), its intermediate texture is automatically released after the GPU pass completes.