Compare
Compares two textures pixel by pixel and shows where one is brighter, equal or different.
Outputs
| Name | Type | Description |
|---|---|---|
| Output | Texture | White where the comparison holds and black where it does not, or the difference between the two inputs. |
Inputs
Parameters
| Name | Type | Description |
|---|---|---|
| Size | Enum | Where the size of the output comes from. Largest and Smallest take it from both inputs, A and B from that input, and Custom from Resolution.Choices: Largest, Smallest, A, B, Custom |
| Resolution | Vector 2 Int | The width and height of the output in pixels. Only present when Size is Custom. |
| Operation | Enum | How the two inputs are compared, read from A to B.Choices: Greater, Greater or Equal, Less, Less or Equal, Equal, Not Equal, Difference |
| Source | Enum | Which value of a pixel is compared. Luminance weighs the channels the way the eye sees them, and Per Channel compares red, green and blue each on their own.Choices: Luminance, Average, Red, Green, Blue, Alpha, Per Channel |
| Tolerance | Float | How far apart two values may be and still count as equal, between 0 and 1. |
| Softness | Float | How wide the transition from black to white is, in the same units as the values. 0 gives a hard cut. Not used by Difference. |
| Filteradvanced | Enum | How a stretched input is read between its pixels. Nearest keeps hard pixels, and Linear Nice keeps edges next to transparency clean.Choices: Nearest, Linear Fast, Linear Nice |
| Formatadvanced | Enum | The pixel format of the output. Auto is one channel of gray, or the channels of the wider input when Source is Per Channel. |
The Compare operator holds two textures against each other, pixel by pixel, and is white where the comparison holds and black where it does not. Use it to find where two pictures differ, such as what moved between two video frames.
In Greater mode, the output is white where A is brighter than B by more than the tolerance. In Greater or Equal mode, it is also white where the two are within the tolerance of each other. Less and Less or Equal mode do the same with B brighter than A. In Equal mode, the output is white where the two are within the tolerance, and in Not Equal mode where they are further apart. In Difference mode, the output is how far apart the two are, less the tolerance, instead of black or white.
Pictures rarely match exactly, and a camera adds noise. A little tolerance makes Equal and Not Equal usable, and a little softness stops edges from flickering. To compare a picture against one color, connect a small Color as B. To compare it against a fixed brightness, use Threshold.
Keywords: greater, less, equal, difference, mask, motion detection, change, diff