API

Function InvertTextureAsync

  • Invert selected channels of a texture operand: result[ch] = 1 - input[ch].

    The channels bitmask selects which channels are inverted; unselected channels pass through unchanged. Use ChannelMask.RGB for the common roughness↔smoothness conversion, or ChannelMask.RGBA (the default) to invert the entire texture.

    This is a unary operation — only operand A is used. Any colorSpace or channel properties 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 dispose function), its intermediate texture is automatically released after the GPU pass completes.

    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: TextureColorSpace

      Optional output color space. When TextureColorSpace.SRGB, the linear result is converted to sRGB (IEC 61966-2-1) before being written. Defaults to TextureColorSpace.Linear.

    • OptionaloutputChannelMask: ChannelMask

      Optional bitmask of channels to write. Excluded color channels are set to 0.0; excluded alpha is set to 1.0. Defaults to ChannelMask.RGBA (all channels written).

    • OptionaloutputOptions: ITextureProcessorOutputOptions

      Optional render-target type, sampling, and mipmap settings.

    Returns Promise<ITextureProcessOperand>

    An operand whose texture holds the GPU result, or whose factor holds the CPU-folded constant