Build-in effects - Subtract

Last edited 2026-02-27


This effect decreases the brightness of the image by subtracting the color values of the top layer to the base layer.



Input data:

  • Self (Main texture of the object/layer, depending on where you apply the effect; contains information about Red, Green, Blue, Alpha)
  • Background (Second texture that contains information about Red, Green, Blue, Alpha* pixels that are underneath Self)


Output data:

  • Render (Red, Green, Blue, Alpha colors that will be displayed on the screen)


Example written in pseudocode:
load float4 Self;                                        // LOAD Self texture
load float4 Background;                                // LOAD texture underneath Self texture

float4 Render;                                        // Create an empty variable


Render.rgb = Self.rgb - Background.rgb;                // Assign the result of subtracted Self and Background to the colors R, G, B
Render.a = Self.a;                                        // Assign the Alpha color from Self to Alpha

return Render;                                        // Return the Render


Examples of recreation effects created by the community:

  1. Subtraction (Background) by Foxioo; It does the same shader but has more options for modifying the color output and has a port for more Runtime.
  2. Subtract (Photoshop) by NaitorStudios; It does the similar shader.




The meaning of colors in the Type column:

Color

Description

Green

This effect works in this runtime.

Yellow

It is unknown whether it works (requires confirmation)

Red

This effect does not work in this runtime.


Effect

Description

Windows 

(Software / DirectDraw)

Windows (Direct3D 8)

Windows (Direct3D 9)

Windows (Direct3D 11)

Android (OpenGL ES)

iOS

(OpenGL ES)

macOS (OpenGL ES)

HTML5

Haxe

(Linux)

Haxe

(WebGL)

Subtract

Self and Background colors are subtracted

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Unknown

Unknown

Unknown

Created with the Personal Edition of HelpNDoc: Make Help Documentation a Breeze with a Help Authoring Tool