PDA

View Full Version : Radial gradient based on UV

mummyman
11-21-2013, 10:28 AM
Is there a way with nodes or possibly DP kit to make a radial gradient based on UV map, instead of using the basic inputs of object / x / y / z / slope / incidence, etc?

Thanks, Brett

JoePoe
11-21-2013, 11:18 AM
Can you use a radial gradient image (b&w) that's using the UV for placement as the input for what you want? Use the Luma or Alpha (if you have one) output of that image as input for the gradient.

mummyman
11-21-2013, 11:49 AM
I could use an image, but I'm looking for an interactive way to blend the gradient over the UV to soften or push the levels on it interactively without using a preset image map

Sensei
11-21-2013, 01:02 PM
Vertex Maps > UV Map has outputs U and V

Distance between vectors is sqrt(x^2+y^2+z^2), but you can use built-in Math > Vector > Distance.

One of them is 0, in your case.

Do you understand now how to do it?

mummyman
11-21-2013, 01:33 PM
Nope...I sure don't understand it... but I will give it a shot! LOL. Thank you Sensei!

mummyman
11-21-2013, 01:43 PM
Not sure if you can show me a sample / example of the setup

JoePoe
11-21-2013, 01:43 PM
Ha! Me neither, but I'm trying to be more nodal (so I think I'll tag along... and try not to confuse :))

The center of a radial gradient based on U and V would be .5,.5 yes?

Sensei
11-21-2013, 01:47 PM
UV Map -> Make Vector -> Distance 1st input
Const > Vector is 2nd Distance input (center of radial)
Then output from Distance is in UV coord space, 0 is the closest to center.

pinkmouse
11-21-2013, 01:47 PM
Let me get this right, you want to have a nodally generated alpha channel to set the opacity of a UV, correct?

mummyman
11-21-2013, 01:57 PM
Let me get this right, you want to have a nodally generated alpha channel to set the opacity of a UV, correct?

I don't think so... I'm trying to take a preset UV map (cellular) and have a gradient control it so it comes out looking like a gradual radial falloff for each based on the uv. So I can have soft or harsh falloffs. There are options for this in MAX based on gradients. LW has only linear or incidence for gradients, so I'll try the node setup Sensei mentioned

mummyman
11-21-2013, 02:01 PM
UV Map -> Make Vector -> Distance 1st input
Const > Vector is 2nd Distance input (center of radial)
Then output from Distance is in UV coord space, 0 is the closest to center.

Thank you!!!! This worked.. Man... I'll never understand this stuff. Thanks!

Sensei
11-21-2013, 02:06 PM
Instead of Const > Vector plug Item Info with custom Null, and take World Position.
Moving item in viewport will update stuff.

pinkmouse
11-21-2013, 02:09 PM
Hmm, not sure I still quite understand. Now you have it, could you post it here for our elucidation? :)

Here's what I thought you meant:

118322

Scene is below.

Sensei
11-21-2013, 02:11 PM
We were talking about using UV map as source not Spot Info, but this could work too if you are thinking about world coord space blending.

mummyman
11-21-2013, 02:17 PM
118324

Here's what I was trying to accomplish. I know there are procedurals for this...but needed to do uv for a test

JoePoe
11-21-2013, 02:52 PM
118324

Here's what I was trying to accomplish. I know there are procedurals for this...but needed to do uv for a test

Great!! But can we see your final nodes, gradient etc?
I'm doing as Sensei says and still not getting it. I am getting it doing what I was thinking, but I'm guessing that even though it looks good.... it's wrong.

First image:
My initial thought. .5,.5 is the "middle" of the UV. The gradient is doing what I want.

Second image:
Again what I was thinking...... 0,0 is the corner (origin) of the UV space.

In both the scalar > vector is the same value as each gradient start point.

What am I not understanding? Seems to work. :question:

edit: ... that black line is just the surface border to show what was UVed.

Sensei
11-21-2013, 03:10 PM
You should use one axis 0.
Set Y=0 in your case.

JoePoe
11-21-2013, 03:26 PM
Okay, I'll try that Sensei. Thank you.
At the moment, though, I was trying my setup with a displacement as well the color. Wanted to smooth it out a bunch..... render subD 3 to 20.
But in my haste I typed in 230 :foreheads. So I'm waiting for that to sort itself out :D.

mummyman
11-25-2013, 10:27 AM
118386

Here is the node setup that worked. Thank you guys for all the help!

- - - Updated - - -

118387

And here's the wireframe. Uv's were generated previously, and this works perfectly. I can adjust the gradient to make the center of each cell harsher if I want.

JoePoe
11-25-2013, 10:32 AM
Ah ha!! :D (thanks for posting)

So, I wasn't so far off. AND indeed .5 does come into play.
It's a little like stealing from Peter to pay Paul from "my" setup.
Instead of starting the gradient at .5 going to 1, it starts at zero and ends at .5. :)

Edit: (....8~ yes?)

Sensei
11-25-2013, 10:51 AM
Instead of 0.5 can be anything between 0.0...1.0
It's simply location in UV coord space.
Animate/envelope this param, and you will have moving "hill" on the box (2nd screen-shot from #19 post).

JoePoe
11-25-2013, 11:14 AM
Hey Sensei,

A) man I am sorry for being so dense, but I'd really like to wrap my head around this.
B) my images.
First: my set up which is basically the same as Mummyman's. I also show my gradient which (for all intents and purposes) stops at .5. Everything is good.
Obviously changing the keys to fill the gradient to i won't work as I have it in this example.
Second: changing the values in the Vector node to 1. Pushes the center to top right corner of uv (which, seems to make sense to me).

So, to me (;D) changing those two values in the vector node are just moving the center point around in the uv space.
Any combination of numbers from 0-1 for those values will put the center at that particular spot in the uv.

Could you kindly show the setup where the gradient spans 0-1 so I can stop obsessing over this. :D:D

Edit: Okay, on re-reading your last post edit I think I understand.... and I think we are saying the same thing.
The values can, of course, be anything between 0 and 1. And those numbers are simply the co-ords of the uv space (as was my conclusion above). So the gradient will have to be whatever range it has to be in order to get the effect you want. Too big a range and the effect will hit the side of the UV and you'll get a hard edge.