Jump to: Board index » General » Fusion

Fixing a NaN in Fusion

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline
User avatar

Thomas Didier

  • Posts: 3
  • Joined: Wed May 27, 2015 8:47 pm
  • Location: Montreal

Fixing a NaN in Fusion

PostWed May 27, 2015 8:55 pm

Hello !

I'm searching for a way to fix a black NaN (Not a Number) in an EXR file in Fusion. I've found a 2011 post with a script on another forum (I can't post an URL, new account limitation I guess), but it doesn't seem to work, maybe I'm doing something wrong or maybe the script is outdated? I've been able to easily fix white NaNs in Photoshop with the clone tool, but I'm stuck with the black ones.

Many thanks !
Offline
User avatar

Chad Capeland

  • Posts: 3025
  • Joined: Mon Nov 10, 2014 9:40 pm

Re: Fixing a NaN in Fusion

PostWed May 27, 2015 9:39 pm

I don't have it on me now, but I have a ViewLUT that highlights NaN's in the viewer so you can ID them, and a Fuse that "patches" single pixel NaN's by averaging surrounding pixels. I'll see if I can get that posted for you. But if you need something real quick and you know which pixels the are already, you should be able to paint/clone over them with the Paint tool.
Chad Capeland
Indicated, LLC
www.floweffects.com
Offline
User avatar

Blazej Floch

  • Posts: 191
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: Fixing a NaN in Fusion

PostWed May 27, 2015 10:58 pm

Check if this works for you.
Should clamp only the QNAN pixels to 0.

The way it works: divide all channels by itself results in 1, infinity (clamps to 1) or nan (clamps to 0).
Clamped this makes black or white.
Now you can use this as a mask to clamp original to zero.

Code: Select all
{
   Tools = ordered() {
      INPUT = BrightnessContrast {
         NameSet = true,
         ViewInfo = OperatorInfo { Pos = { 176.206, 274.766, }, },
      },
      Detect_Gremlins = Custom {
         NameSet = true,
         Inputs = {
            LUTIn1 = Input {
               SourceOp = "Detect_GremlinsLUTIn1",
               Source = "Value",
            },
            LUTIn2 = Input {
               SourceOp = "Detect_GremlinsLUTIn2",
               Source = "Value",
            },
            LUTIn3 = Input {
               SourceOp = "Detect_GremlinsLUTIn3",
               Source = "Value",
            },
            LUTIn4 = Input {
               SourceOp = "Detect_GremlinsLUTIn4",
               Source = "Value",
            },
            Intermediate1 = Input { Value = "min(min(min(r1/r1, g1/g1), b1/b1), a1/a1)", },
            RedExpression = Input { Value = "i1", },
            GreenExpression = Input { Value = "i1", },
            BlueExpression = Input { Value = "i1", },
            AlphaExpression = Input { Value = "i1", },
            ShowNumber1 = Input { Value = 0, },
            ShowNumber2 = Input { Value = 0, },
            ShowNumber3 = Input { Value = 0, },
            ShowNumber4 = Input { Value = 0, },
            ShowNumber5 = Input { Value = 0, },
            ShowNumber6 = Input { Value = 0, },
            ShowNumber7 = Input { Value = 0, },
            ShowNumber8 = Input { Value = 0, },
            ShowPoint1 = Input { Value = 0, },
            ShowPoint2 = Input { Value = 0, },
            ShowPoint3 = Input { Value = 0, },
            ShowPoint4 = Input { Value = 0, },
            Image1 = Input {
               SourceOp = "INPUT",
               Source = "Output",
            },
            Comments = Input { Value = "Detects render errors (pixels with \"infinite\" float values). They are tinted red for debugging and the alpha channel is an error mask.", },
         },
         ViewInfo = OperatorInfo { Pos = { 301.735, 273, }, },
      },
      Detect_GremlinsLUTIn1 = 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,
      },
      Detect_GremlinsLUTIn2 = 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,
      },
      Detect_GremlinsLUTIn3 = 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,
      },
      Detect_GremlinsLUTIn4 = 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,
      },
      BrightnessContrast1 = BrightnessContrast {
         Inputs = {
            Alpha = Input { Value = 1, },
            ClipBlack = Input { Value = 1, },
            ClipWhite = Input { Value = 1, },
            Input = Input {
               SourceOp = "Detect_Gremlins",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 411.735, 271, }, },
      },
      OUTPUT = BrightnessContrast {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            Alpha = Input { Value = 1, },
            ClipBlack = Input { Value = 1, },
            ClipWhite = Input { Value = 1, },
            Input = Input {
               SourceOp = "INPUT",
               Source = "Output",
            },
            EffectMask = Input {
               SourceOp = "Bitmap1",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 415.353, 350.34, }, },
      },
      Bitmap1 = BitmapMask {
         Inputs = {
            Invert = Input { Value = 1, },
            MaskWidth = Input { Value = 2048, },
            MaskHeight = Input { Value = 1556, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Image = Input {
               SourceOp = "BrightnessContrast1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 415.353, 317.34, }, },
      },
   },
}
Offline
User avatar

Thomas Didier

  • Posts: 3
  • Joined: Wed May 27, 2015 8:47 pm
  • Location: Montreal

Re: Fixing a NaN in Fusion

PostThu May 28, 2015 2:25 pm

Hey !

Thanks for your answers. I'm not sure how to use the script, I've pasted the code in a new script but I keep getting this error : " unexpected symbol near '{' " I'm not familiar with scripting so I probably did it wrong.

One of our programmers managed to find a trick to fix the black NaN manually by opening the EXR file in an hex editor. He replaced the strings for the black NaN ff,ff,bf,ff by ff,ff,ff,ff. The NaN were still there but they were white instead of black, making them easy to correct in Photoshop. Of course a solution in Fusion would be better :)

Many thanks for your advices & your time !
Offline

Toulouse LeTrack

  • Posts: 58
  • Joined: Mon Nov 03, 2014 2:04 pm

Re: Fixing a NaN in Fusion

PostThu May 28, 2015 6:11 pm

The Script is actually a *tool*...:-)

Just copy the entire code and paste it directly onto the flow in Fusion....Magic....:-)
Offline
User avatar

Thomas Didier

  • Posts: 3
  • Joined: Wed May 27, 2015 8:47 pm
  • Location: Montreal

Re: Fixing a NaN in Fusion

PostThu May 28, 2015 6:41 pm

Ah thanks !

And it works ! You guys rock :)
Offline

Ashwin

  • Posts: 1
  • Joined: Fri Nov 13, 2020 11:41 pm
  • Real Name: Ashwin Karthik

Re: Fixing a NaN in Fusion

PostFri Nov 13, 2020 11:44 pm

Hey Guys,

Its been a while since i used fusion. Just came back to fusion from nuke. Do we have any latest way to fix Nan pixels?

I tried the nodes from above and it doesnt kill it.

I am looking for something which would use the surrounding pixels to fix em

Return to Fusion

Who is online

Users browsing this forum: Yahoo [Bot] and 63 guests