View Full Version : Colour based on motion path position

12 December 2010, 04:55 PM

I would like to colour geometry based on it's position along a motion path.

I initially thought that it would be possible to use the motion path's U value to sample the colour at any position along a ramp. This way I would also obtain a decent visual (the ramp node's output in the attribute editor) of the geometry's colour across its journey.

It doesn't appear that sampling ramp textures in this way is possible and I'm now struggling for an alternative solution. I've considered a few things but all come with limitations. At the moment my best bet appears to be simply keyframing the colour adjustment over time, but this doesn't feel like a particularly robust solution for multiple pieces of geometry.

I've attached a rough example of what I'm driving at.

Any ideas?

Thanks in advance,

12 December 2010, 07:29 PM
unfortunately you'll have to create one shader per ball, then drive U to the ramp or whatever

another solution is to create spheres using particles, which you can then shade using rgbPP and the particle life/ uvPosition

01 January 2011, 08:01 PM
Hello again,

Thanks very much or the response.

I've now found the crucial piece of the puzzle, the MEL function colorAtPoint.

So my problem can be solved using a triple switch to adjust a shader's colour per model, an expression featuring the above function, and the uValues of a lot of motionpaths, which is fine by me.

I do like the idea of using particles and the rgbPP attribute; though I've had problems in the past when using instanced geometry and rgbPP... that's probably a bit vague, sorry. Memories fade.

Anyway, problem solved.

CGTalk Moderation
01 January 2011, 08:01 PM
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.