laser beam and cycles nodes

I have a bunch of planes with a laser beam texture applied, from the CGCookie tutorial.

I want the beam to fade along the length of the beam. Unfortunately fiddling around with the color gradient node has the fading action along the wrong axis (side to side instead of end to end).

How can I fix this?

  • 3
    $\begingroup$ if you have UV unwraped it just rotate the UVmap 90° , or use the mapping node to do that $\endgroup$ – Chebhou Mar 28 '15 at 14:49
  • $\begingroup$ Use a Mapping node otherwise $\endgroup$ – VRM Mar 28 '15 at 15:14
  • $\begingroup$ Rotating the UV map causes the original laser to rotate. Take a look: imgur.com/S0kxaj7 $\endgroup$ – meed96 Mar 28 '15 at 18:35

This can be done quite a number of different ways, I have listed three.

You could make a new UV map, and rotate the uvs 90° (like chebhou said). Then use that uv map just for the length fade.
cycles material nodes, multiple UV maps

You could add a Gradient Texture node (or a image of a gradient) and use a mapping node to control which way the gradient is going.
cycles material nodes, mapping node

(my favorite) You could add a Texture Coordinate node and then a Separate XYZ node. That will give you a gradient running along the axis specified. In this picture it would be black at the left edge, and running along the X axis white at the right edge.
cycles material nodes, texture coordinates

So your whole setup could look something like this. The X axis from the separate node is used for the "length fade." The Y axis is how I'm creating the beam fading out top to bottom. Then the Multiply node combines the two gradients. cycles material nodes for laser beam

| improve this answer | |
  • $\begingroup$ Amazing, I had not thought of that first one, but since I've never used the Separate XYZ node I believe I shall try that one first :D $\endgroup$ – meed96 Mar 28 '15 at 20:08
  • $\begingroup$ @meed96 glad I could help, and that you learned something new. Do note that you will have to plug the Separate node in to the UV map, not the generated coordinates. (the last image should be close to what you need.) $\endgroup$ – David Mar 28 '15 at 20:11
  • $\begingroup$ I actually don't see any difference between the two, but it has succeeded in fading off toward one end. $\endgroup$ – meed96 Mar 28 '15 at 20:17
  • $\begingroup$ @meed96 you would only see the difference if you were using it to make the laser beam, like I did. But where you are using the UV map and image, there would be no difference. $\endgroup$ – David Mar 28 '15 at 20:18
  • $\begingroup$ I'm using it for some spaceship engines, so I needed it to fade-off. Quick question, how would I control the fade of the z axis? I realized it needed a two-way fade. I plugged another color ramp with the Z axis, but I can't add it correctly to the first two. $\endgroup$ – meed96 Mar 28 '15 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.