I have a function, it takes a linear gradient and rounds it, you can see it here on Desmos. (btw if anyone has a more efficient way to do this I’m all ears, I only need the 0-1 part)
Problem is, when I use Unreal’s built in Power node (specifically using this math) it produces different results than just multiplying or using a custom node: return pow(x,2);
Am I just not understanding how Power works or is something wrong here? Does anyone know where I can find the HLSL that’s being generated so I can see wtf it is doing? The generated HLSL is 3k lines of code and I’m not sure where I should be looking.
The problem is you’re putting a negative value into X, which returns NAN for HLSL & undefined results for GLSL. Putting an Abs() before the power fixes this: