58

I am modeling a laser pointer in Blender, but I am not sure how to make the laser's light beam.

The Spot light comes the closest to what I am looking for, but its starting diameter is 0, and you cannot set the spread amount to less than 1 degree. I would like to be able to do this in the Cycles rendering engine if possible.



Comparison

Edit: I am not trying to see the actual beam of light, like when you shine a laser beam through fog. Rather, I simply want to have the light beam go straight from the laser. So that if you were to shine it at an object up close, the dot would be the same size as if you were to shine it at a object farther away.

Not this:                              But this:

Seeing the laser beam itself.    The laser's dot on the wall

*Laser images from images.google.com

catlover2
  • 814
  • 1
  • 9
  • 25
Stephen
  • 5,699
  • 6
  • 23
  • 28
  • 2
    Any particular reason why you want to use a lamp? This would be much easier with a material imo. – iKlsR Jun 16 '13 at 02:53
  • @iKlsR Do you mean an emission material? As long as it sends light in a straight line it is fine with me. – Stephen Jun 16 '13 at 02:58
  • What exactly did you mean by using a material? @iKlsR – Stephen Jun 16 '13 at 05:26
  • a realistic light/laser is only visible because of particles in the air reflect the photons into our eyes, how important is realism to you? – zeffii Jun 16 '13 at 07:12
  • Do you want the Tyndall effect? – Luke_0 Jun 16 '13 at 18:14
  • @zeffii I actually was not thinking so much of seeing the beam of light in the air as seeing it at whatever it was pointing at. – Stephen Jun 17 '13 at 04:29
  • @Luke I am not exactly sure what the Tyndall effect is, I will look it up. – Stephen Jun 17 '13 at 04:30
  • @stephen, perhaps you can add a little more detail to the original question as to invite better, more accurate answers . – zeffii Jun 17 '13 at 04:46
  • @zeffii Just what I was doing, just finished. ;) – Stephen Jun 17 '13 at 04:54
  • i've removed my answer accordingly. – zeffii Jun 17 '13 at 06:16
  • @zeffii Oh, could you put it back up? It is not what I was looking for, but it was helpful. I guess I could add another question about seeing the beam itself, but I like the idea of having them both at the same place. You could edit it to say something like, 'If you did want to see the actual laser beam, you could do this...'. – Stephen Jun 17 '13 at 22:14
  • 1
    I am inclined to side with folks that prefer to keep answers only if they directly answer the question, my answer was valid until you explicitly stated you didn't want to see the laser beam. Ask another question, be precise, show examples and you will get better answers and less long-winded comment sections :) – zeffii Jun 18 '13 at 07:53
  • I suspect there's also a constraints solution that would automatically place a point lamp on whatever surface your laser-pointer is pointing at. It'd have to be something like a projection modifier... not sure. I'll have to try it out. – Matt Mar 04 '14 at 17:08
  • thanks! me too! SpamSpamSpamSpamSpamSpamSpamSpam. – Millard Oct 05 '19 at 17:55

3 Answers3

43

First Solution:

I have a line-laser and a plane-laser node setup.

For the line-laser:

Laser Demo Laser Nodes

For the plane-laser:

Plane-Laser Demo Plane-Laser Nodes

Second Solution:

Now that you have asked and I tried to remember,
I got a solution that is easier to understend.

You can get the plane-laser when using
dot-product instead cross-product.
Then higher strength is required.

better line-laser better plane-laser better nodes

Important Edit

Since I answered this, Blender was updated several times, and I had to update my solution also. An important note is that this solution only works with area lights, since the normal is only provided for those. Other light sources are not capable of providing their direction to the node system. I will contact the devs about this, since the normal has no meaning for other lights now, it could contain the direction of the object.

Some artifacts appear near the edge of the area light when using constant strength, therefor a slight adjusment is required. This can also be used with a point light, when the bottom most node is used instead of the geometry normal. For a point light you can actually skip the subtract.

updated nodes

Here is everything nicely organized and nodes grouped:

  • 2
    Thanks! That is exactly what I was looking for. But could you add some more detail on how exactly this works? – Stephen Jun 17 '13 at 22:23
  • 1
    You are welcome! I explain the easier soultion: The cross-product at the start calculates the distance ov the lasers line and the rays hit pint. When it is over the thickness, then it is not lit. So only points near to the lasers line will be lit. When you switch the cross-product to dot-product you get the distance from the lasers plane, and only the points near to the plane will be lit. – Róbert László Páli Jun 18 '13 at 07:04
  • There's one issue here and that is that the laser doesn't stop being drawn if obstructed but basically shines "through" objects infinitely, see this image: http://i.imgur.com/l08vpd4.jpg – riccardolardi Apr 11 '16 at 15:48
  • Dear Alberto: Try checking the "cast shadow" option and setting the "size" of the lamp to 0 or a near 0 number (these settings can be found in the properties panel, under the lamp icon). – Róbert László Páli Apr 23 '16 at 12:49
  • @RóbertLászlóPáli I'm trying to reproduce this and I'm not sure what Color Ramp settings are used in the second node setup (plane laser). Also, what type of lamp is this setup applied to? Could you show us a screenshot of your Lamp Panel? Thanks! – MicroMachine Jun 27 '16 at 04:59
  • I think, the last node setup (with dot product instead cross) should work better. You have to use an area lamp right now, with lets say 1 mm size, because there is an issue with getting the rotation of a point lamp. However I see and isse also with the area lamp I did not see before. I will soon update this and provide a download link for the blend in a comment. – Róbert László Páli Jul 05 '16 at 21:03
  • http://palaes.rudanium.org/Random/Laser.blend – Róbert László Páli Jul 08 '16 at 21:23
  • Use this blend as you like, considere it CC0. I will update the answere later. – Róbert László Páli Jul 08 '16 at 21:25
5

Zeffii's method is best but if you still want to use halo,you can do it like this-

Yeah I used blender internal renderer

You can add plane in front of a spotlight and edit it such that there is a very small hole in it for light to pass.Make following changes in properties of lamp: Set shadow to buffer shadow and buffer type to Classical hallway,and set filter type to gauss. keep angle of spot low(around 10).Turn on Halo and increase steps to higher value and also increase intensity to a very high value(20 or more). Experiment with steps,intensity and hole size to suit yourself. But light is not actually a line but a spot light with very small angle.

atomicbezierslinger
  • 14,279
  • 28
  • 42
Yash Aggarwal
  • 151
  • 1
  • 1
  • 5
4

Render Nodes Approach

This approach depends on which Render Engine you are using.

Blender Internal

You will start with modeling your object. I find that a cylindrical object works well. After you model, animate, ect. Then you will need to add your materials. Go to the shading panel under materials, and select shadeless. Set your Diffuse HSV value to 1. Then go to your passes panel under the render settings and make sure that the ** combined, Z, and Vector** are selected. Render your image.

Now You will need to set up your nodes. Go to the node editor window make sure that you have node render passes selected. Select use nodes and backdrop on the header. Add in a veiwer node. This will enable you to see what you are making. Now add in a Vector Blur node under filter. Connect speed with speed, z to z, and image to image. Do not do any thing with the alpha node connect. Now add in four blur nodes set to fast guassian. connect your vector blur to all of these. Now set the top blur to X:2 Y:2. set the second blur to X:10 Y:10. Set the third to X:20 Y:20. and the fourth to X:40 Y:40. Now what you wan to do is using add nodes add them all together. Then add in a RGB curves node to set the color of your laser.

Cycles The only difference with this is that for your material you will set it to emission and then set your render pass to emit rather than vector. You will use the same node set up except you won't use the vector blur just set the emit to the image input.

Oh by the way make sure that your world is set to BLACK or you will get some interesting results. Here is mine.

enter image description here

Owen Patterson
  • 3,257
  • 7
  • 21
  • 28
  • Hi Owen, the result looks great but I'm getting mixed up in the node setup, do you have a screenshot of the node setup? Thanks – MicroMachine Mar 10 '16 at 11:00