Linking 'Distance' value to a ramp color position

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  07 July 2013
Linking 'Distance' value to a ramp color position

What I want to do is have the ramp.colorEntryList[1].position determined by my distanceDimensionShape1.distance value, the output from the .distance needs to be multiplied with 0.08 before connected to the ramp.

This is so frustrating because I know what values I need and where to get them I just don't know where and how to connect them. Please help me out I'm going crazy here
  07 July 2013
Apparantly theres an expression editor for this sort of thing.
object:ramp2.colorEntryList[0].position = distanceDimensionShape1.distance*x seem to work. Now I just need to figure out whats wrong with my ramp, I get the right conversion from the distance input to the ramp but the actual rendered lenght is really weird, like this.

Distance: 50, 40, 30, 20, 10
Ramp: 1, 0.8, 0.6, 0.4, 0.2 so far so good, but:
Actual 10.2, 10.2, 8.5, 5.7, 2.9

I don't understand this
  07 July 2013
I have no idea what went wrong with the first try but I remade everything and now it works as I intended. The expression editor is awesome, I should probably start using it more often.
  07 July 2013
....or then you can get _really_ wacky and use the multiplyDivide - node between your distance and ramp.

Expressions are more flexible but nodes are ( tenths or even hundreds times ) faster .

- Oh no, it's me -
  07 July 2013
Hey, thanks for the reply! I did try that actually, but I couldn't figure out how to set it up, or maybe *where* to set it up. If you, or someone else, could talk me through in simple terms how to set that up that would be very helpful and appreciated .
  07 July 2013
What exactly is not working right ?
If you prefer expressions - ok , although i'm not sure if "performance" is something you really need to think about while doing stuff like that , i mean...unless you've got hundreads cycles of a job...

Here's what i can suggest ( node based though ):

- Go to Create-->Measure Tools --> Distance tool

- Open up Hypershade ( Window --> Rendering Editos-->Hypershade ) , navigate to it's Graph menu tab and click "Input and Output Connections" , this way your view will center on it.

-While in Hypershade , create "Multiply Divide" and "Ramp" node.

- With a middle mouse button pressed , drag your distance node on Multiply Divide node , release button and select "Other" option ( at the bottom)

- Connection editor will show up , on the left side select "distance" (at the very bottom) , on the right side select Input1-->Input1X. Now your distance is connected to the multiply/divide X input.

-Since you wanted to multiply your distance value by 0.08 , click on Multiply Divide node and type 0.08 in the Input2X.

- Middle drag your Multiply Divide node on the ramp , select "Other" again , and connect it's (M D node ) outputX to the uvCoord-->vCoord (or U depending on what ramp is used...) now your color will run through the ramp as the distance change...

Since ramp repeats itself , you may want to clamp your MD node output within [0,1].
  07 July 2013
Hey Alex! Whats not working right is my knowledge of Maya; I'm entirely self-taught and so while I'm advanced in some aspects there are many obvious things I am entirely clueless about. I followed your walkthrough and I now understand alot more than I did before.

What I did not know was that you could load the distancetool entity into the hypershade by selecting Graph<Input and Output connections. Silly, right?

Huge thanks to you and ristopuukko for taking the time to write a respons and help me understand this tool Maya. I, really, appreciate it
  07 July 2013
No problems^^, since Maya is all about nodes - grab whatever you want and look at what's going on "behind the scenes" - it'll teach you a lot.
  07 July 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 09:25 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.