Math Boolean*

Preview
Performance Cost 🟢 Low
Signal Type Vector → Vector
Implementation Native Compiled C++
Devices (Cyles) CPU / GPU (1:1)

Math Boolean implements Ken Perlin's "soft" or "fuzzy" boolean operators. Unlike standard logical nodes that return a binary 0 or 1 (False/True), this node treats input values as continuous probabilities or degrees of membership in the [0, 1] range. This allows you to perform logical operations like Intersection, Union, and Difference on smooth gradients and textures without losing their softness or anti-aliasing.

Usage & Behavior

Intersection (Masking, Alligator with Billows noise)
Union (Merging)
Difference (Subtraction)
Complement (Invert)

This node is essential for procedurally combining masks. Because it works on Vectors, it can handle three separate masks (X, Y, Z) simultaneously. It is mathematically superior to simply multiplying or adding textures because it preserves the correct probability volume (e.g., Union avoids "over-bright" artifacts that occur when simply adding two overlapping gradients).

Best Used For: combining soft masks, constructive solid geometry (CSG) with SDFs, inverting textures, and cleaning up noise mattes.

Key Features

  • Fuzzy Logic: Handles smooth gradients gracefully without hard clipping.
  • Vector Support: Processes RGB/XYZ channels in parallel.
  • 4 Modes: Covers all essential set theory operations.

Deep Dive: Fuzzy vs. Hard Logic

In standard boolean logic, 0.5 AND 0.5 often rounds to 1 AND 1 = 1. In Fuzzy logic, it represents probability.

  • Intersection (A * B): Probability that both A and B are true.
  • Union (A + B - A*B): Probability that either A or B is true. Unlike a simple "Add", this prevents values from exceeding 1.0 if both inputs are valid.
  • Difference (A * (1 - B)): Probability that A is true AND B is false.
  • Complement (1 - A): Probability that A is false.

Parameters

Mode Enum
Selects the boolean operation:
  • INTERSECTION: Returns elements common to both inputs (AND). Visually, this keeps only the overlapping area.
  • UNION: Returns elements present in either input (OR). Visually, this merges shapes together.
  • DIFFERENCE: Returns elements from Input 1 that are NOT in Input 2 (SUBTRACT). Visually, this cuts Input 2 out of Input 1.
  • COMPLEMENT: Returns the inverse of Input 1 (NOT). Input 2 is ignored.
Input 1 Vector
The primary input vector/color.
Input 2 Vector
The secondary input vector/color. Not used in Complement mode.

Quick Recipes

Common logic setups.

Mask Cutout

  • Mode DIFFERENCE
  • Input 1 Base Shape
  • Input 2 Cutout Shape
Uses Input 2 to punch a hole in Input 1.

Merge Maps

  • Mode UNION
  • Input 1 Dirt Mask
  • Input 2 Scratch Mask
Combines two masks without "blowing out" the whites where they overlap (unlike Add).

Smart Invert

  • Mode COMPLEMENT
  • Input 1 Texture
A simple, optimized inversion (1.0 - Value) for vectors.
↑ Back to Top

Leave a Reply