In the olden days, producers knew what visual effects were. Now they’ve gotten into this methodology where they’ll hire a middleman – a visual effects supervisor, and this person works for the producing studio.
They’re middle managers. And when you go into a review with one of them, there’s this weird sort of competition that happens.

It’s a game called ‘Find What’s Wrong With This Shot’. And there’s always going to be something wrong, because everything’s subjective. And you can micromanage it down to a pixel, and that happens all the time. We’re doing it digitally, so there’s no pressure to save on film costs or whatever, so it’s not unusual to go through 500 revisions of the same shot, moving pixels around and scrutinizing this or that.

That’s not how you manage artists. You encourage artists, and then you’ll get – you know – art.

If your idea of managing artists is just pointing out what’s wrong and making them fix it over and over again, you end up with artists who just stand around asking “OK lady, where do you want this sofa? You want it over there? No? Fine. You want it over there? I don’t give a fuck. I’ll put it wherever you want it.” It’s creative mismanagement, it’s part of the whole corporate modality. The fish stinks from the head on down. Back on Star Wars, Robocop, we never thought about what was wrong with a shot.

We just thought about how to make it better.

Phil Tippett

Gradient Map Macro

Moderator: Tilt

User avatar
Midgardsormr
Fusioneer
Posts: 152
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 27 times
Contact:

Gradient Map Macro

Post #1 by Midgardsormr » Sun Apr 30, 2017 8:30 pm

Photoshop has a nice feature called a gradient map, which maps a linear gradient to the luminance of an input image. Here's a macro that replicates that feature in Fusion:

Code: Select all

{
   Tools = ordered() {
      GradientMap = MacroOperator {
         Inputs = ordered() {
            Gradient = InstanceInput {
               SourceOp = "Gradient",
               Source = "Gradient",
            },
            InterpolationMethod = InstanceInput {
               SourceOp = "Gradient",
               Source = "GradientInterpolationMethod",
            },
            Offset = InstanceInput {
               SourceOp = "Gradient",
               Source = "Offset",
               Default = 0,
            },
            Repeat = InstanceInput {
               SourceOp = "Gradient",
               Source = "Repeat",
            },
            SubPixel = InstanceInput {
               SourceOp = "Gradient",
               Source = "SubPixel",
            },
            Map = InstanceInput {
               SourceOp = "MapIn",
               Source = "Input",
               Name = "Map",
            },
            Blend = InstanceInput {
               SourceOp = "Blend",
               Source = "Mix",
               Name = "Blend",
               Default = 1,
            },
            EffectMask = InstanceInput {
               SourceOp = "CustomTool1",
               Source = "EffectMask",
            }
         },
         Outputs = {
            Output = InstanceOutput {
               SourceOp = "Blend",
               Source = "Output",
            }
         },
         ViewInfo = GroupInfo { Pos = { 0, 0 } },
         Tools = ordered() {
            Gradient = Background {
               NameSet = true,
               Inputs = {
                  Width = Input {
                     Value = 1920,
                     Expression = "MapIn.Input.Width",
                  },
                  Height = Input {
                     Value = 1080,
                     Expression = "MapIn.Input.Height",
                  },
                  Depth = Input { Value = 4, },
                  ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
                  Type = Input { Value = FuID { "Gradient" }, },
                  Gradient = Input {
                     Value = Gradient {
                        Colors = {
                           [0.204013377926421] = { 0.660606060606061, 0, 0, 1 },
                           [0.672240802675585] = { 1, 1, 0, 1 },
                           [0.862876254180602] = { 1, 1, 0.945025258325098, 1 }
                        }
                     },
                  },
               },
               ViewInfo = OperatorInfo { Pos = { 906, 88 } },
            },
            CustomTool1 = Custom {
               CtrlWZoom = false,
               Inputs = {
                  LUTIn1 = Input {
                     SourceOp = "CustomTool1LUTIn1",
                     Source = "Value",
                  },
                  LUTIn2 = Input {
                     SourceOp = "CustomTool1LUTIn2",
                     Source = "Value",
                  },
                  LUTIn3 = Input {
                     SourceOp = "CustomTool1LUTIn3",
                     Source = "Value",
                  },
                  LUTIn4 = Input {
                     SourceOp = "CustomTool1LUTIn4",
                     Source = "Value",
                  },
                  RedExpression = Input { Value = "getr2d(c1,c1)", },
                  GreenExpression = Input { Value = "getg2d(c1,c1)", },
                  BlueExpression = Input { Value = "getb2d(c1,c1)", },
                  Image1 = Input {
                     SourceOp = "MapIn",
                     Source = "Output",
                  },
                  Image2 = Input {
                     SourceOp = "Gradient",
                     Source = "Output",
                  },
               },
               ViewInfo = OperatorInfo { Pos = { 911, 157 } },
            },
            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 },
            },
            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 },
            },
            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 },
            },
            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 },
            },
            MapIn = BrightnessContrast {
               NameSet = true,
               ViewInfo = OperatorInfo { Pos = { 745, 158 } },
            },
            Blend = Dissolve {
               Transitions = {
                  [0] = "DFTDissolve"
               },
               CtrlWZoom = false,
               NameSet = true,
               Inputs = {
                  Background = Input {
                     SourceOp = "MapIn",
                     Source = "Output",
                  },
                  Foreground = Input {
                     SourceOp = "CustomTool1",
                     Source = "Output",
                  },
               },
               ViewInfo = OperatorInfo { Pos = { 914, 211 } },
            }
         },
      }
   },
   ActiveTool = "GradientMap"
}

Tags:

User avatar
Midgardsormr
Fusioneer
Posts: 152
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 27 times
Contact:

Re: Gradient Map Macro

Post #2 by Midgardsormr » Mon May 01, 2017 3:20 pm

Aaaand, about a day after I made that macro, I realize that it's just doing what the Texture tool does. CopyAux color to UVs, pipe to the Input, and put the Gradient in the Texture input.

User avatar
Chad
Fusionator
Posts: 1100
Joined: Fri Aug 08, 2014 12:11 pm
Been thanked: 18 times

Re: Gradient Map Macro

Post #3 by Chad » Mon May 01, 2017 5:53 pm

Or use FN with gradient.

User avatar
Midgardsormr
Fusioneer
Posts: 152
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 27 times
Contact:

Re: Gradient Map Macro

Post #4 by Midgardsormr » Mon May 01, 2017 6:09 pm

Well sure, if what you need is a fractal noise the tool already exists. But that doesn't help if you have an alpha from another source. Hyposometric tinting for cartographic visualization, for instance. Or you want to fake thermal imaging or something of that sort.

Untitled.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
ShadowMaker SdR
Fusioneer
Posts: 166
Joined: Sun Sep 21, 2014 5:17 am
Been thanked: 21 times

Re: Gradient Map Macro

Post #5 by ShadowMaker SdR » Tue May 02, 2017 1:06 am

It also works with the FN tool if you don't need Fractal noise. This following is from years ago at the Pigsfly Forum from Daniel Koch

Now here's the non-obvious solution, a demented combination of Bitmap Mask and FastNoise tool (you did know that FastNoise did gradient mapping, didn't you?).

Set the Bitmap mask to Luminance, connect it to FN's Noise Brightness Map input, set Noise Detail to 0, turn up Brightness, and have fun.

It's faster than a Custom tool and more flexible too. You can even add perlin noise into the mix as well.

Attached is an example image, and a macro to make it all easy. Don't forget to remove the .txt extension on the macro.
Attached Thumbnails

Van <http://www.pigsfly.com/forums/index.php?showtopic=1614&hl=fastnoise>

User avatar
Midgardsormr
Fusioneer
Posts: 152
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 27 times
Contact:

Re: Gradient Map Macro

Post #6 by Midgardsormr » Tue May 02, 2017 9:48 am

Ahhhh. I never even noticed those extra inputs on FN! So now I've done needless work twice!

User avatar
ShadowMaker SdR
Fusioneer
Posts: 166
Joined: Sun Sep 21, 2014 5:17 am
Been thanked: 21 times

Re: Gradient Map Macro

Post #7 by ShadowMaker SdR » Tue May 02, 2017 9:58 am

Yes, doing needless work twice. Now you're a true VFX-artist! :-)

vivi
Posts: 37
Joined: Tue Dec 02, 2014 6:34 pm
Been thanked: 1 time

Re: Gradient Map Macro

Post #8 by vivi » Fri May 19, 2017 9:32 am

Midgardsormr wrote:Aaaand, about a day after I made that macro, I realize that it's just doing what the Texture tool does. CopyAux color to UVs, pipe to the Input, and put the Gradient in the Texture input.


You mean a Background tool set to gradient?

vivi
Posts: 37
Joined: Tue Dec 02, 2014 6:34 pm
Been thanked: 1 time

Re: Gradient Map Macro

Post #9 by vivi » Fri May 19, 2017 9:36 am

Midgardsormr wrote:Aaaand, about a day after I made that macro, I realize that it's just doing what the Texture tool does. CopyAux color to UVs, pipe to the Input, and put the Gradient in the Texture input.


Also, it seems in the the Texture tool Swap UVs needs to be checked. Well I am not sure but in one image not doing so, causes the very bright spots to actually get the darkest color.

User avatar
Midgardsormr
Fusioneer
Posts: 152
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 27 times
Contact:

Re: Gradient Map Macro

Post #10 by Midgardsormr » Fri May 19, 2017 10:15 am

vivi wrote:You mean a Background tool set to gradient?


It can be a gradient from any source, actually. A Background set to Gradient is the simplest way to set it up, but you could get the ramp from anywhere. In fact, the ramp doesn't even have to be the same size as your brightness map. A 1-pixel high ramp (assuming it's a horizontal ramp) gives the same result as an HD one. The horizontal resolution matters, but apparently not much. I didn't see any banding in a test I just did until the width of my BG tool dropped below 10 pixels.

Also, it seems in the the Texture tool Swap UVs needs to be checked. Well I am not sure but in one image not doing so, causes the very bright spots to actually get the darkest color.


The tool isn't mapping brightness from the gradient. If you put in a grad that's dark on the right and bright on the left, then the gradient map, regardless of the method, will map those dark tones to the brightest pixels in your brightness map. In this situation, the U channel is coming from your source's red, and V is coming from green. If you have a horizontal ramp, only the red channel matters because it doesn't matter which y-location you're sampling from; they all have the same value. If you swap UVs, you're just using the green channel to select the color.

Who is online

Users browsing this forum: No registered users and 1 guest