Moderator: AndrewHazelden

Midgardsormr
Fusionista
Posts: 375
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 14 times
Contact:

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() {
Inputs = ordered() {
},
InterpolationMethod = InstanceInput {
},
Offset = InstanceInput {
Source = "Offset",
Default = 0,
},
Repeat = InstanceInput {
Source = "Repeat",
},
SubPixel = InstanceInput {
Source = "SubPixel",
},
Map = InstanceInput {
SourceOp = "MapIn",
Source = "Input",
Name = "Map",
},
Blend = InstanceInput {
SourceOp = "Blend",
Source = "Mix",
Name = "Blend",
Default = 1,
},
SourceOp = "CustomTool1",
}
},
Outputs = {
Output = InstanceOutput {
SourceOp = "Blend",
Source = "Output",
}
},
ViewInfo = GroupInfo { Pos = { 0, 0 } },
Tools = ordered() {
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" }, },
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 {
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 } },
}
},
}
},
}


Tags:

Midgardsormr
Fusionista
Posts: 375
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 14 times
Contact:

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.

Fusionator
Posts: 1164
Joined: Fri Aug 08, 2014 1:11 pm
Been thanked: 2 times

Midgardsormr
Fusionista
Posts: 375
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 14 times
Contact:

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.

Fusionista
Posts: 285
Joined: Sun Sep 21, 2014 6:17 am
Been thanked: 6 times

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 ... =fastnoise>

Midgardsormr
Fusionista
Posts: 375
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 14 times
Contact:

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

Fusionista
Posts: 285
Joined: Sun Sep 21, 2014 6:17 am
Been thanked: 6 times

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

vivi
Posts: 44
Joined: Tue Dec 02, 2014 6:34 pm

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: 44
Joined: Tue Dec 02, 2014 6:34 pm

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.

Midgardsormr
Fusionista
Posts: 375
Joined: Wed Nov 26, 2014 8:04 pm
Location: Los Angeles, CA, USA
Been thanked: 14 times
Contact: