Function InvertTextureAsync
-
InvertTextureAsync(
name: string,
input: ITextureProcessOperand,
scene: Scene,
channels?: ChannelMask,
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 invert
- scene: Scene
Scene to create the texture in (used only when a GPU pass is needed)
- channels: ChannelMask = ChannelMask.RGBA
Bitmask of channels to invert. Defaults to
ChannelMask.RGBA. 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
Invert selected channels of a texture operand:
result[ch] = 1 - input[ch].The
channelsbitmask selects which channels are inverted; unselected channels pass through unchanged. UseChannelMask.RGBfor the common roughness↔smoothness conversion, orChannelMask.RGBA(the default) to invert the entire texture.This is a unary operation — only operand A is used. Any
colorSpaceorchannelproperties on the input operand are honoured (sRGB linearization and channel swizzle applied before the invert).If the input is constant (no texture), the invert is performed on the CPU.
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.