View Full Version : Linear gradient following null position + heading?

01-16-2010, 05:20 AM
I'm having a little problem working this one out.

I have a flat plane with a simple linear gradient applied to it. I want the gradient to follow the movement of a null around but also want the gradient to match the Heading of the null (ie so when the null rotates 30degs the gradients Heading also follows at the pivot of the null).

I'm not sure of the maths here and how to combine it all into an end result. Can someone help?

01-16-2010, 08:10 AM
Hmmm, sounds pretty easy doesn't it: move/rotate gradient based on position/rotation null. But it seems to be not easy at all, even with nodes.

Can't you bake the gradient to an image (or paint one) and use an image map? That should be easy to move/rotate with the null.

01-18-2010, 04:15 AM
Hi Serge

many thanks for your response. Yes your right, I'll try that approach. I was kind of using this as a little experiment on keeping everything generated in LW rather than go back and fourth to a 3rd party.

01-19-2010, 06:22 AM
Turns out it can be done....

One null controls the rotation and limit of the gradient's blue key, the other one controls the limit of the gradient's red key.

Not completely native LW, as it uses dpont's rotate node - still it does what you were looking for... And the cool thing is, because it's nodal, you can feed other images or textures into each key of the gradient.



01-19-2010, 06:53 AM
Kyuzo, that's a bit special, massive thanks! I'll enjoy picking that one apart!


01-19-2010, 07:04 AM
Then you'll love this one...

Same idea, but uses the scale of the null in the x direction to determine the size of the blend area, with the middle of the blend centred on the null.

A bit more user-friendly, and only uses a single null.

As Han Solo famously said, "Y'know sometimes I amaze even myself..."


01-19-2010, 07:17 AM
humm, just getting a blue screen on that one. I'm a bit confused, should I be looking at the "Gradient" surface or the surface labeled "___"?

01-19-2010, 07:20 AM
Ah, I think the nodes lost it's link with the null when I saved it.
The surface is the one called gradient, and make sure that the node for NULL_CENTER is referencing NULL_GRADIENT.


01-19-2010, 07:29 AM
Ha! Got it... nearly there - the scale part isn't working and I can't see any ref to scaling in the setup?

01-19-2010, 07:38 AM
Ohhh.. just realised... I resaved the scene, but not the object... which obviously has all the surfacing info in it. What a numptie.
Try this updated file!


01-19-2010, 07:43 AM
Don't hate me, it looks identical to the last one! Can you re-attach?

01-19-2010, 08:01 AM
Don't worry, I don't hate you... :D

try these...

01-19-2010, 08:09 AM
This is so appreciated, better than what I was after! Many thanks kyuzo

01-19-2010, 08:32 AM
No worries, glad I could help.
I love a good puzzle, and I'm just chuffed that I managed to crack it...
Like Serge, at first I thought it was gong to involve some silly mathematics, so three cheers for dpont and his great nodes!


01-19-2010, 10:29 AM
hipPip... and that they work on a mac!