Page 1 of 1

iff expression aberation?

PostPosted: Sun Jun 13, 2021 9:03 am
by brodiem
Heyy trying to use center point to drive aberation, i couldnt figure out how to x/sin so i thought using iff < 0.5? id like to increase hs aberation based on the center pos?

still new to Fusion any tips would be huge thanks.

Screenshot 2021-06-13 190208.png
Screenshot 2021-06-13 190208.png (27.55 KiB) Viewed 923 times


Screenshot 2021-06-13 185237.png
Screenshot 2021-06-13 185237.png (12.84 KiB) Viewed 923 times

Re: iff expression aberation?

PostPosted: Sun Jun 13, 2021 9:06 am
by brodiem
im not sure how to debug values so i tried == p2x my math is basic i need a visual representation

Re: iff expression aberation?

PostPosted: Sun Jun 13, 2021 6:08 pm
by Bryan Ray
In a normal simple expression, it's iif(), not iff(). "iff" appears only in logic to mean "if and only if", but the "and only if" part is superfluous in an algorithm, so you'll very seldom see it. "iif" is "immediate if," as described here: https://en.wikipedia.org/wiki/IIf

However, if you're in the expression modifier, you just need if(). Confusing, I know.

The == operator is a comparison operator, not an assignment. You can't use it like the way you've shown. The proper syntax in that second image should be: if(p1x < 0.5, 0, 1) That is, "If p1x is less than 0.5, then return 0, else return 1."

Also, you can't assign the result of Point Out to any of the Point In numbers of the modifier because that would enable a feedback loop. The result of the expression can be read on the Point Out

You only need Point() if your output needs to be a vector. It doesn't work in the Point Expression X field because that is expecting to only output a scalar (one number instead of two).

Maybe start a little more slowly. Just put a constant in the Point Out boxes and see how that affects whatever you're driving with them. In this example, I'm setting the CustomTool's Point In 2 controls with an Expression Modifier that simply sets it to (0.1, 0.7)

Code: Select all
{
   Tools = ordered() {
      CustomTool1 = Custom {
         CtrlWZoom = false,
         Inputs = {
            PointIn2 = Input {
               SourceOp = "Expression1",
               Source = "PointResult",
            },
            LUTIn1 = Input {
               SourceOp = "CustomTool1LUTIn1",
               Source = "Value",
            },
            LUTIn2 = Input {
               SourceOp = "CustomTool1LUTIn2",
               Source = "Value",
            },
            LUTIn3 = Input {
               SourceOp = "CustomTool1LUTIn3",
               Source = "Value",
            },
            LUTIn4 = Input {
               SourceOp = "CustomTool1LUTIn4",
               Source = "Value",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 275, 16.5 } },
      },
      Expression1 = Expression {
         Inputs = {
            PointExpressionX = Input { Value = "0.1", },
            PointExpressionY = Input { Value = "0.7", },
         },
      },
      CustomTool1LUTIn1 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 0, Blue = 0 },
         NameSet = true,
      },
      CustomTool1LUTIn2 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 204, Blue = 0 },
         NameSet = true,
      },
      CustomTool1LUTIn3 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 0, Green = 0, Blue = 204 },
         NameSet = true,
      },
      CustomTool1LUTIn4 = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
               [1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 204, Green = 204, Blue = 204 },
         NameSet = true,
      }
   },
   ActiveTool = "CustomTool1"
}


Simply copy the above code and paste it into the node graph in Fusion. The tool will appear. You can copy tools out of Fusion and paste them as plain text, which often makes it easier to demonstrate what you're trying to do than making screenshots.