Jump to content

The Wonderful World of Gradient Mapping!


david.atwell

Recommended Posts

This tutorial is available as a PDF. Click here to view or download it

 

This tutorial is all about the marvelous Gradient Mapping plugin, by Pyrochild (available here). Download it first.

So, there's been some confusion as to how this plugin works, as expressed on the PdN chat on dA. Now, I don't claim to be an expert, but I do have a couple days' experience on all of you, so... 🙂 Here we go, an explanation of Gradient Mapping.

Now, you all know (if you've downloaded this plugin) that the dialog consists of a gradient bar, a drop-down box, and a little bit more that I won't go into here.

Let's start with the drop-down marked "Source." As you may have gleaned from the title, it selects which bits in the color code from each pixel are used as the "source." Got it? No? Well, let's go more in-depth, then.

How about a pretty picture? We might call this "Before." We might. But we won't. 😉

1

As you can see, it's a rather understated little .PNG with a white-to-black gradient stretching from left to right. Now, the default in the "Source" box says "Luminosity," no? So maybe we can understand Gradient Mapping better if we examine the luminosity of the gradient.

Well, obviously, the Luminosity of the pixels at the far left is very high. In fact, it's 255. White has the most luminosity possible. On the other hand, Black has very little Luminosity. None, in fact. In numeric form, white's luminosity is 255, while black's is zero. Somewhere in the middle, assuming you have a gradient that spans 256 pixels or more, each value of luminosity is shown at least once. And that means that in the very middle, there's one that equals 126.

Are we clear? (Actually, we'll get to transparency in a second. 🙂 Okay, bad pun...)

All right, if you follow, let's open Gradient Mapping. It's in the Adjustments menu, which I can't remind you of quite enough.

 

Beautiful defaults, no? Okay, enough sightseeing. Take a look at that gradient across the top of the dialog. At the far left is a black color, in the center is a red color, and on the right is a white color. Conveniently, that's the same pattern (in reverse) on the live preview behind it! Now, what do we know about the original gradient? And why is it in reverse?

That's right. The luminosity decreases successively from 255 on the left to zero on the right. Somewhere in the middle, it's about 126.

Hmm. Coincidence! The new gradient has a completely white color on the left, a red color in the middle, and a completely black color on the right!

Are the wheels chugging?

That's right! The value of luminosity is "mapped" across that gradient in the dialog box. And wherever in that photo that particular value of luminosity appears, it is replaced with the color that is on the gradient in the dialog!

So the far left of the gradient in the dialog is mapped to the lowest value of luminosity in the picture; that means that the pixels with the lowest luminosity in the image (the black ones) will be changed to the color at the far left of the gradient in the dialog, and the pixels with the highest luminosity in the image (the white ones) will be changed to the color at the far right of the gradient in the dialog.

3

See what I mean? It takes the values of the selected channel (Luminosity), and "maps" it across the dialog's gradient (0 on the left, 255 on the right). Then it finds each value of that selected channel in the image, and recolors it to the color that's mapped to that number.

Let's look at a couple of other Sources to see more. How about Alpha?

4

See, the Alpha value of the entire image is 255; it's perfectly opaque. So it recolors every single pixel to the color on the far right, which just happens to be white.

Let's try Key / Black as the source now.

5

Notice that, in the original image, black was on the far right; but, since we're measuring the amount of Black as the source now, and black is on the left of the dialog gradient, the pixels in the original image that had the least black (Black = 0) get recolored to the color on the far left of the dialog gradient, which happens to be black.

(If you still don't understand, try the image with just white and see what color it turns; then with just black, and then with a shade of gray. You'll see that the white [lowest amount of black] comes out black, the black [highest amount of black] comes out white, and the gray [middle amount of black] comes out red.)

Head still spinning? Try some other Source channels. You'll see that the pixels with the highest value of whatever channel you've selected in the drop-down box will be recolored to whichever color is on the far right of the dialog gradient, and vice versa. Clear?

Let's see a photograph!

6

Stunning, no? But we're not here to lollygag. Let's mess it up! 🙂

Gradient Mapping, with defaults:

7

Notice that the part with the highest luminosity (the part where the light hits the floor) is recolored to the color on the far right of the dialog gradient. White!

Alpha is completely blank. Nothing to see there. Again, it's entirely opaque, so it turns it completely black.

How about "Key / Black"? This one's fun! 🙂

8

Oooh! See, where the light hits the floor had the lowest amount of black in it (zero), so it recolored it with the color from the Zero end of the dialog gradient!

Ah, we're working up to something here! Let's try different colors. Right click on the left and right sliders and click "Change Color."

Here's what I changed them to, and the result:

9

See, the parts of the image with the lowest luminosity became the color at the left of the dialog gradient (blue), while the parts of the image with the highest luminosity became the color at the right of the dialog gradient (radioactive green)!

So, how can this work for you (besides cheap parlor tricks with images)?

Multicolor gradients! Let's say you wanted a seven-color gradient; Red, Orange, Yellow, Green, Blue, Indigo, and Violet. Sure, you could use BB and Ilnab's plugin, but why? Just create a black-to-white gradient, like in the first image, and:

10

(right-click and hit "Spread Colors" to evenly space them)

And theirs can't do this:

11

(Though that might be a point of pride) Eastertime, anyone?

Anyway, play around with your Gradient Mapping plugin. And share what you do below! (If you like, you can right click and save the .XML file, and post it below with the code tag)

Hope this helped!

For more gradient mapping fun, check out Natjo's tut: viewtopic.php?f=15&t=20738

(And BarkBark's comment is a good one)

  • Upvote 1

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

pyro has made some killer plug ins; good chance to appreciate the people that make the plug ins and have made this awesome program. All of you deserve praise and compensation. IMHO.

retired from PDN forums. Later dewds

Link to comment
Share on other sites

Thank you, everyone! Especially nice to hear from the creator himself...

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

This is great. I love the light tone of your words - it's nice to see some personality in a tutorial. I even liked the pun (and I usually abhor all punnery :P).

(If you still don't understand, try the image with just white and see what color it turns; then with just black, and then with a shade of gray. You'll see that the white [lowest amount of black] comes out black, the black [highest amount of white] comes out black, and the gray [middle amount of black] comes out red.)

Shouldn't that be switched to "the black [highest amount of black] comes out white"?

time-smaller.png
Link to comment
Share on other sites

This is great. I love the light tone of your words - it's nice to see some personality in a tutorial. I even liked the pun (and I usually abhor all punnery :P).

I'm glad you enjoyed it! That's exactly what I was going for: knowledge with fun, just like Bill Nye. :-)

Shouldn't that be switched to "the black [highest amount of black] comes out white"?

You're absolutely right! That's an artifact of an earlier draft, when I was still on Luminosity (before I decided to switch to Key/Black in that example). Thanks for pointing it out! Good catch,...and it's fixed!

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

  • 1 month later...

Have you read this tutorial? I tell you how to do it above. :-)

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

  • 1 month later...
this look oddly familiar to Gimp's gradient maker

ohmaigawdrly?

eat this post.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

*eats that post*

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

eat, this post -> ingest, this post -> in jest, this post.

yay for really bad puns... :D

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

*eats the bad puns*

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...
  • 1 year later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...