Help with emission object

Hi everyone

My first post since joining up hope someone can help
Having trouble with creating an emission object with a colour ramp in it. What I have is a cylinder say 1/2mtr long and 20mm Dia at one end I have an object red in colour at the other end I have an object blue in colour. The objects at this stage are not important only as reference. At the end of the cylinder where it touches the red object I want it to emit red light and at the other end emit blue light where the blue object is and then ramp to a that purplish colour in the middle of the cylinder. basically the whole cylinder to emit light but have that light colour colour change from red to blue along its length.
Have been unable to find any tutes on achieving this and everything I have tried so far has failed badly. Any help much appreciated.
Incantrix

If your cylinder is still aligned straight along one of it’s axes, this is fairly easy to do.


Basically, you’re using the generated texture coordinates, taking the direction that the cylinder is aligned to (My cylinder is aligned along it’s local Z axis, so I used the Z component) and using that to control a mix between red and blue.

If you’ve moved the cylinder around in edit mode, this gets a bit trickier as it’s no longer aligned to any of its local axes. If the geometry is simple enough, you could get away with using vertex paint to color one end black and the other white, then using that attribute to control a mix-rgb as such:


If none of those options work, you might just have to unwrap the cylinder and manually paint in the colors.

Thanks Tuxedo
I did try what you had there which worked quite well when I had it flat to y or x (had already been in the editor)
But objects that that I had on an angle became very difficult to do.
In the end I made some maps in PS that were just colour ramps as I was using red-blue red-green green-black and black-blue. Which gave me a good control of the colour and the strength of the emission also can adjust how the colour looks.

Incantrix