Inverting 1 to 0 and back with nodes

In order to make an inversion of the boolean value: invert 1 to 0 and 0 back to 1, we only need to use two Math nodes in the Blender node editor.

To invert the boolean value, let’s add two Math nodes to the node tree (shift + a – Utilities – Math).

Switch the first node to the “Subtract” mode. Its upper Value input, we will link with the value that needs to be inverted. Set the value in the second Value input to 1.0.

Switch the second node to the “Absolute” mode.

Link nodes:

By feeding a value of 0 or 1 to the top input of the Subtract node, the output of the Absolute node will give us the opposite value.

This combination of nodes works both in the Geometry Nodes and in the Shader node editor.

0 0 votes
Article Rating
Subscribe
Notify of
guest

4 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Ben
Ben
1 year ago

Another option to do this in one node is using map range to map from 0-1 to 1-0.

Rob
Rob
2 years ago

You only need one node: you make the 1st value 1 (in the subtract node), and feed the input to the 2nd value. That way, for an input of 0 you get 1 out, and for input of 1 you get 0 out. The absolute value node is not needed.
f(x) = x – 1
f(0) : 1
f(1) : 0