[Submission] GradientMapper  [SUBMITTED]

Moderator: SecondMan

User avatar
AndrewHazelden
Fusionator
Posts: 1292
Joined: Fri Apr 03, 2015 3:20 pm
Answers: 2
Location: West Dover, Nova Scotia, Canada
Been thanked: 35 times
Contact:

[Submission] GradientMapper  [SUBMITTED]

#1

Post by AndrewHazelden » Sun Jun 10, 2018 3:50 pm

This macro gives Fusion the useful ability to map colours from a gradient to an image, based on the luminance of that image. Other channels may be used, and optionally, Perlin noise can be used to perturb the gradient being applied.

It is based on a Bitmap Mask to extract the luminance of the image. This can be softened, or its levels can be tweaked, or a different source channel can be used (e.g. RGB, hue or saturation). The resulting mask is then given to a FastNoise tool and used to modify the brightness of the Perlin noise it creates. By default, Noise Detail is set to 0 (flat) so no noise is generated, and the image's mask is used directly. FastNoise's various colour gradient controls can then be used to map colours to the mask.

Tip: In some cases, you might want to preserve the luminance of the original image while just replacing the colours. This can be easily done by using bright colours, then using a Channel Booleans tool to multiply the result of the GradientMapper with the Luminance of its source.

VFXPedia Page - Settings and Macros > GradientMapper Description:
https://www.steakunderwater.com/VFXPedi ... escription


Screenshot

GradientMapper Macro.png

Changelog
v1 2006-12-19
Initial version of macro listed on VFXPedia

Atom File Contents
Code: [Select all] [Expand/Collapse] [Download] (com.wesuckless.GradientMapper.atom)
  1. Atom {
  2.     Name = "GradientMapper",
  3.     Category = "Tools/Color",
  4.     Author = "VFXPedia GradientMapper",
  5.     Version = 1,
  6.     Date = {2006, 12, 19},
  7.     Description = [[<p>This macro gives Fusion the useful ability to map colours from a gradient to an image, based on the luminance of that image. Other channels may be used, and optionally, Perlin noise can be used to perturb the gradient being applied.</p>
  8.  
  9. <p>It is based on a Bitmap Mask to extract the luminance of the image. This can be softened, or its levels can be tweaked, or a different source channel can be used (e.g. RGB, hue or saturation). The resulting mask is then given to a FastNoise tool and used to modify the brightness of the Perlin noise it creates. By default, Noise Detail is set to 0 (flat) so no noise is generated, and the image's mask is used directly. FastNoise's various colour gradient controls can then be used to map colours to the mask.</p>
  10.  
  11. <p>Tip: In some cases, you might want to preserve the luminance of the original image while just replacing the colours. This can be easily done by using bright colours, then using a Channel Booleans tool to multiply the result of the GradientMapper with the Luminance of its source.</p>
  12.  
  13. <p>VFXPedia Page - Settings and Macros > GradientMapper Description:<br>
  14. https://www.steakunderwater.com/VFXPedia/96.0.243.189/index0127.html?title=Settings_and_Macros/GradientMapper_Description</p>]],
  15.     Deploy = {
  16.         "Macros/Color/GradientMapper.setting",
  17.     },
  18. }
  19.  
Zipped Atom Package

com.wesuckless.GradientMapper.zip
(2.43 KiB) Downloaded 9 times

User avatar
SecondMan
Site Admin
Posts: 3415
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 3
Location: Vancouver, Canada
Been thanked: 78 times
Contact:

Re: [Submission] GradientMapper

#2

Post by SecondMan » Wed Jun 13, 2018 6:09 pm

And submitted (with matched author and package name) :cheer:

User avatar
ShadowMaker SdR
Fusionista
Posts: 619
Joined: Sun Sep 21, 2014 6:17 am
Answers: 3
Been thanked: 13 times

Re: [Submission] GradientMapper

#3

Post by ShadowMaker SdR » Thu Jun 14, 2018 1:35 pm

I didn't know about this old macro, so I created something similar a while ago based on the 'tint' tool you see all over all kinds of AE tutorials.
It does partly the same as this one (it can work with a gradient) but it also has the option - like the tint in AE to just map to black and map to white, with a slider to control the amount.

Even though it overlaps partially, I think it might be a useful addition to Reactor as well. Especially if we're trying to help out AE converts as well.
I'll try to create an atom for it, but I'm not quite sure how to do that yet.
(I know where to find the documentation, Andrew and Pieter :D )

Cheers!
Code: [Select all] [Expand/Collapse] [Download] (AEStyleTint_SdR)
  1. {
  2.     Tools = ordered() {
  3.         AEStyleTint = MacroOperator{
  4.             CtrlWZoom = false,
  5.             Inputs = ordered() {
  6.                 MainInput1 = InstanceInput {
  7.                     SourceOp = "MapInput",
  8.                     Source = "Input",
  9.                 },
  10.                 TwoToneOrGradientSelector = InstanceInput {
  11.                     SourceOp = "FastNoise1_1_1",
  12.                     Source = "Type",
  13.                     Default = 0,
  14.                 },
  15.                 MapToBlackRed = InstanceInput {
  16.                     SourceOp = "FastNoise1_1_1",
  17.                     Source = "Color1Red",
  18.                     Name = "Map To Black",
  19.                     ControlGroup = 4,
  20.                     Default = 0,
  21.                 },
  22.                 MapToBlackGreen = InstanceInput {
  23.                     SourceOp = "FastNoise1_1_1",
  24.                     Source = "Color1Green",
  25.                     ControlGroup = 4,
  26.                     Default = 0,
  27.                 },
  28.                 MapToBlackBlue = InstanceInput {
  29.                     SourceOp = "FastNoise1_1_1",
  30.                     Source = "Color1Blue",
  31.                     ControlGroup = 4,
  32.                     Default = 0,
  33.                 },
  34.                 MapToBlackAlpha = InstanceInput {
  35.                     SourceOp = "FastNoise1_1_1",
  36.                     Source = "Color1Alpha",
  37.                     ControlGroup = 4,
  38.                     Default = 1,
  39.                 },
  40.                 MapToWhiteRed = InstanceInput {
  41.                     SourceOp = "FastNoise1_1_1",
  42.                     Source = "Color2Red",
  43.                     Name = "Map to White",
  44.                     ControlGroup = 5,
  45.                     Default = 1,
  46.                 },
  47.                 MapToWhiteGreen = InstanceInput {
  48.                     SourceOp = "FastNoise1_1_1",
  49.                     Source = "Color2Green",
  50.                     ControlGroup = 5,
  51.                     Default = 1,
  52.                 },
  53.                 MapToWhiteBlue = InstanceInput {
  54.                     SourceOp = "FastNoise1_1_1",
  55.                     Source = "Color2Blue",
  56.                     ControlGroup = 5,
  57.                     Default = 1,
  58.                 },
  59.                 MapToWhiteAlpha = InstanceInput {
  60.                     SourceOp = "FastNoise1_1_1",
  61.                     Source = "Color2Alpha",
  62.                     ControlGroup = 5,
  63.                     Default = 1,
  64.                 },
  65.                 GradientType = InstanceInput {
  66.                     SourceOp = "FastNoise1_1_1",
  67.                     Source = "GradientType",
  68.                 },
  69.                 GradMapToBlack = InstanceInput {
  70.                     SourceOp = "FastNoise1_1_1",
  71.                     Source = "Start",
  72.                     Name = "Map To Black",
  73.                     DefaultX = 0,
  74.                     DefaultY = 0.5,
  75.                 },
  76.                 GradMapToWhite = InstanceInput {
  77.                     SourceOp = "FastNoise1_1_1",
  78.                     Source = "End",
  79.                     Name = "Map To White",
  80.                     DefaultX = 1,
  81.                     DefaultY = 0.5,
  82.                 },
  83.                 Gradient = InstanceInput {
  84.                     SourceOp = "FastNoise1_1_1",
  85.                     Source = "Gradient",
  86.                 },
  87.                 GradientInterpolationMethod = InstanceInput {
  88.                     SourceOp = "FastNoise1_1_1",
  89.                     Source = "GradientInterpolationMethod",
  90.                 },
  91.                 GradientOffset = InstanceInput {
  92.                     SourceOp = "FastNoise1_1_1",
  93.                     Source = "Offset",
  94.                     Default = 0,
  95.                 },
  96.                 GradientRepeat = InstanceInput {
  97.                     SourceOp = "FastNoise1_1_1",
  98.                     Source = "Repeat",
  99.                     Default = 0,
  100.                 },
  101.                 GradientSubPixel = InstanceInput {
  102.                     SourceOp = "FastNoise1_1_1",
  103.                     Source = "SubPixel",
  104.                     Default = 0,
  105.                 },
  106.                 ApplyModeDropdown = InstanceInput {
  107.                     SourceOp = "Merge1_1",
  108.                     Source = "ApplyMode",
  109.                 },
  110.                 OperatorDropdown = InstanceInput {
  111.                     SourceOp = "Merge1_1",
  112.                     Source = "Operator",
  113.                 },
  114.                 SubtractiveAdditiveSlider = InstanceInput {
  115.                     SourceOp = "Merge1_1",
  116.                     Source = "SubtractiveAdditive",
  117.                     Name = "Subtractive",
  118.                     Default = 1,
  119.                 },
  120.                 AlphaGain = InstanceInput {
  121.                     SourceOp = "Merge1_1",
  122.                     Source = "Gain",
  123.                     Default = 1,
  124.                 },
  125.                 BurnIn = InstanceInput {
  126.                     SourceOp = "Merge1_1",
  127.                     Source = "BurnIn",
  128.                     Default = 0,
  129.                 },
  130.                 AmountToTint = InstanceInput {
  131.                     SourceOp = "Merge1_1",
  132.                     Source = "BlendClone",
  133.                     Name = "Amount to Tint",
  134.                     Default = 1,
  135.                 },
  136.                 EffectMask = InstanceInput {
  137.                     SourceOp = "FastNoise1_1_1",
  138.                     Source = "EffectMask",
  139.                 }
  140.             },
  141.             Outputs = {
  142.                 MainOutput1 = InstanceOutput {
  143.                     SourceOp = "AlphaMultiply1",
  144.                     Source = "Output",
  145.                 }
  146.             },
  147.             ViewInfo = GroupInfo {
  148.                 Pos = { 385, 49.5 },
  149.                 Flags = {
  150.                     Expanded = true,
  151.                     AllowPan = false,
  152.                     GridSnap = true,
  153.                     ShowGrid = false,
  154.                     AutoSnap = true,
  155.                     RemoveRouters = true
  156.                 },
  157.                 Size = { 1085, 243.3, 298.5, 22 },
  158.                 Direction = "Horizontal",
  159.                 PipeStyle = "Direct",
  160.                 Scale = 1,
  161.                 Offset = { -20, -3 }
  162.             },
  163.             Tools = ordered() {
  164.                 MapInput = BrightnessContrast {
  165.                     CtrlWShown = false,
  166.                     NameSet = true,
  167.                     Inputs = {
  168.                         Blend = Input { Value = 0, },
  169.                         Red = Input { Value = 0, },
  170.                         Green = Input { Value = 0, },
  171.                         Blue = Input { Value = 0, },
  172.                     },
  173.                     ViewInfo = OperatorInfo { Pos = { -165, 82.5 } },
  174.                 },
  175.                 Bitmap1_1 = BitmapMask {
  176.                     CtrlWShown = false,
  177.                     Inputs = {
  178.                         MaskWidth = Input { Value = 1920, },
  179.                         MaskHeight = Input { Value = 1080, },
  180.                         PixelAspect = Input { Value = { 1, 1 }, },
  181.                         ClippingMode = Input { Value = FuID { "None" }, },
  182.                         Image = Input {
  183.                             SourceOp = "AlphaDivide1",
  184.                             Source = "Output",
  185.                         },
  186.                         Channel = Input { Value = FuID { "Luminance" }, },
  187.                     },
  188.                     ViewInfo = OperatorInfo { Pos = { 55, 181.5 } },
  189.                 },
  190.                 FastNoise1_1_1 = FastNoise {
  191.                     CtrlWZoom = false,
  192.                     CtrlWShown = false,
  193.                     Inputs = {
  194.                         GlobalOut = Input { Value = 500, },
  195.                         Width = Input {
  196.                             Value = 1920,
  197.                             Expression = "MapInput.Input.Width",
  198.                         },
  199.                         Height = Input {
  200.                             Value = 1080,
  201.                             Expression = "MapInput.Input.Height",
  202.                         },
  203.                         Depth = Input { Value = 4, },
  204.                         ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
  205.                         Detail = Input { Value = 0, },
  206.                         Brightness = Input { Value = 1, },
  207.                         XScale = Input { Value = 1, },
  208.                         Color1Alpha = Input { Value = 1, },
  209.                         Offset = Input { Value = 0.5, },
  210.                         NoiseBrightnessMap = Input {
  211.                             SourceOp = "Bitmap1_1",
  212.                             Source = "Mask",
  213.                         },
  214.                     },
  215.                     ViewInfo = OperatorInfo { Pos = { 220, 181.5 } },
  216.                 },
  217.                 Merge1_1 = Merge {
  218.                     CtrlWShown = false,
  219.                     Inputs = {
  220.                         Background = Input {
  221.                             SourceOp = "AlphaDivide1",
  222.                             Source = "Output",
  223.                         },
  224.                         Foreground = Input {
  225.                             SourceOp = "FastNoise1_1_1",
  226.                             Source = "Output",
  227.                         },
  228.                         PerformDepthMerge = Input { Value = 0, },
  229.                     },
  230.                     ViewInfo = OperatorInfo { Pos = { 385, 181.5 } },
  231.                 },
  232.                 AlphaDivide1 = AlphaDivide {
  233.                     CtrlWShown = false,
  234.                     Inputs = {
  235.                         Input = Input {
  236.                             SourceOp = "MapInput",
  237.                             Source = "Output",
  238.                         },
  239.                     },
  240.                     ViewInfo = OperatorInfo { Pos = { -55, 82.5 } },
  241.                 },
  242.                 AlphaMultiply1 = AlphaMultiply {
  243.                     CtrlWShown = false,
  244.                     Inputs = {
  245.                         Input = Input {
  246.                             SourceOp = "ChannelBooleans1",
  247.                             Source = "Output",
  248.                         },
  249.                     },
  250.                     ViewInfo = OperatorInfo { Pos = { 605, 181.5 } },
  251.                 },
  252.                 ChannelBooleans1 = ChannelBoolean {
  253.                     CtrlWShown = false,
  254.                     Inputs = {
  255.                         ToRed = Input { Value = 4, },
  256.                         ToGreen = Input { Value = 4, },
  257.                         ToBlue = Input { Value = 4, },
  258.                         Background = Input {
  259.                             SourceOp = "Merge1_1",
  260.                             Source = "Output",
  261.                         },
  262.                         Foreground = Input {
  263.                             SourceOp = "AlphaDivide1",
  264.                             Source = "Output",
  265.                         },
  266.                     },
  267.                     ViewInfo = OperatorInfo { Pos = { 495, 181.5 } },
  268.                 }
  269.             },
  270.         }
  271.     },
  272.     ActiveTool = "AEStyleTint"
  273. }

User avatar
SecondMan
Site Admin
Posts: 3415
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 3
Location: Vancouver, Canada
Been thanked: 78 times
Contact:

Re: [Submission] GradientMapper

#4

Post by SecondMan » Thu Jun 14, 2018 1:56 pm

Looking forward to your future flawless submissions, @ShadowMaker SdR! :)

User avatar
thibaud
Fusioneer
Posts: 135
Joined: Thu Sep 04, 2014 1:23 am
Been thanked: 2 times
Contact:

Re: [Submission] GradientMapper

#5

Post by thibaud » Fri Jun 15, 2018 3:08 am

ShadowMaker SdR wrote:
Thu Jun 14, 2018 1:35 pm
I didn't know about this old macro, so I created something similar a while ago based on the 'tint' tool you see all over all kinds of AE tutorials.
It does partly the same as this one (it can work with a gradient) but it also has the option - like the tint in AE to just map to black and map to white, with a slider to control the amount.

Even though it overlaps partially, I think it might be a useful addition to Reactor as well. Especially if we're trying to help out AE converts as well.
I'll try to create an atom for it, but I'm not quite sure how to do that yet.
(I know where to find the documentation, Andrew and Pieter :D )

Cheers!
For some reason when picking color with the first color wheel (map to black) it doesn't update the associated rgba sliders (and doesn't work).
adjusting any of the rgb sliders seems to restore the connectivity.
The second color wheel (map to white) does works though.

User avatar
ShadowMaker SdR
Fusionista
Posts: 619
Joined: Sun Sep 21, 2014 6:17 am
Answers: 3
Been thanked: 13 times

Re: [Submission] GradientMapper

#6

Post by ShadowMaker SdR » Fri Jun 15, 2018 3:18 am

thibaud wrote:
Fri Jun 15, 2018 3:08 am
For some reason when picking color with the first color wheel (map to black) it doesn't update the associated rgba sliders (and doesn't work).
adjusting any of the rgb sliders seems to restore the connectivity.
The second color wheel (map to white) does works though.
Are we talking about my version? Because - as expected - those do work on my system. I have no idea what could be different on your system.
But I'll open a seperate topic soon as to not to pollute this topic.

User avatar
thibaud
Fusioneer
Posts: 135
Joined: Thu Sep 04, 2014 1:23 am
Been thanked: 2 times
Contact:

Re: [Submission] GradientMapper

#7

Post by thibaud » Fri Jun 15, 2018 4:12 am

Both version actually
clicking anywhere on the first color wheel (mapped to black) doesn't update the color itself until I click on the vertical gradient bar next to it or one of the rbg sliders

edit: just disregard this whole thing it's just me being dumb. (the color wheel update the hue and saturation not the value).
to be honest, the black knob (bar) on the vertical value gradient slider isn't helping a lot (it's invisible -black on black- when on the bottom of the bar)