View Full Version : Need pointlight to get color from a point on a ramp, not project whole ramp (Maya)

04 April 2009, 04:27 PM
Hi there, I've come up against a brick wall in MAYA (2008)

I want a light to read in a colour from a ramp (or 3D proj texture map of a ramp) so that the light emits the colour of the ramp at the point that the ramp and the light intersect.

Sounds simple, right? Just connect the ramp to the light?
Not so, the 3d projection works like an image projector - projecting the whole range of the ramp - in this case a multicoloured gradient.

This is probably because the light gets the projection information well before it looks at its position in space. I need a way around this.

Basically the real-world problem is:

I have lightbulb geometry running up the outside of a fairground attraction, the nurbs 'lightbulbs' get their colour from a standard 3d projection of a ramp node, the 3Dproj node is animated so the colours of the lights seem to roll up the ride over time.

I want them to emit light without using Global Illumination - so conneted the ramp to the point lights - but the point lights don't pick up the colour properly, they just project the whole ramp and each light emits a stripey gradient.
Really I want the red 'lightbulb' and its point light to emit red, the blue ones blue and green = green.

So I want something which samples the colour of the nurbs bulb or the point on the gradient where the light crosses it and push that through the light.

I can't EASILY do it via animation curves in the lights' colour attribute because there are a lot of them and + all their animCurves would need offsetting by 1 or 2 frames to match the ramp gradient (I probably can do it manually that way, but it will take ages). That wouldn't match the nurbs bulbs either, and getting the output of the light colour into every bulb at that point would probably be just as messy.

Any ideas?
How would you do it?

I believe there's a way to do it in Max called 'RayEx'. You define a point in space (the light) and a vector (usually down). It then returns a point on a poly surface, and from that you can derive the UV cords, and then from that the pixel colour in a bitmap.

Something like that, or a nifty hypershade trick would be ideal.


CGTalk Moderation
04 April 2009, 04:27 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.