Calculating distance so I can blend CD on an object?

   1127   2   0
User Avatar
Member
34 posts
Joined: Aug. 2015
Offline
Im trying to measure the distance from origin outward on an object so I can blend two colours onto it. So for example the middle is green but towards a certain point from expanding it blends into red.

I asked somewher else and was told this:

“So you could just calculate length(@P) for the distance of each point from origin
And then shape those values however you want, maybe normalize them and punch them through a color ramp
Or you could choose a point on your geo, pipe that into the edge transport node and calculate surface-distance from that point”

But I have no idea what this means or how to do it, I tried an edge transport node, not sure what to do with it after connecting it and selecting a point.

I just need a colour ramp so I can control at what point it starts changing colour. Any help is appreciated thanks.
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Here's something what you might be looking for.

You also might be interested in knowing that this example is only using the length function that is giving vector magnitudes,

and because @P is being used as a source, it equates with the distance from the world origin.

You could also use the distance function which will return a distance between two given vectors.

Just a note to give you some flexibility in what you finally want to achieve.
Edited by BabaJ - April 22, 2019 09:45:20

Attachments:
ColorBased Length.hiplc (80.6 KB)

User Avatar
Member
34 posts
Joined: Aug. 2015
Offline
Thank you! This is what I'm looking for!
  • Quick Links