I have worked on plenty of Math operations within Cycles without the need to use GLSL. The only operation/function so far that I Can't figure out however, is Sign.
Basically, this operation will take in a value x, and return:
if (x < 0): x = -1
if (x > 0): x = 1
if (x = 0): x = 0
I want to do this using existing cycles Nodes from 2.8 without having to download extensions/add-ons. Any help would be Greatly Appreciated!
This is the closest I can come up with, but I need the math worked out.
I'm a little unsure how Blender handles a Vec3 to a Scalar. The idea behind this is that the top to values of the Greater/Less Than's are inputs, Using the 2 Middle Mixes as booleans, the final Mix will hold the values needed.
Please correct me if I am wrong or if there is a better way.