Making a Laser in Cycles - Straight Beam of Light?

47

23

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

Stephen

Posted 2013-06-16T02:30:53.063

Reputation: 2 529

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 – 2014-03-04T17:08:43.700

2Any particular reason why you want to use a lamp? This would be much easier with a material imo. – iKlsR – 2013-06-16T02:53:47.200

@iKlsR Do you mean an emission material? As long as it sends light in a straight line it is fine with me. – Stephen – 2013-06-16T02:58:19.903

What exactly did you mean by using a material? @iKlsR – Stephen – 2013-06-16T05:26:11.867

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 – 2013-06-16T07:12:32.893

Do you want the Tyndall effect? – American Luke – 2013-06-16T18:14:48.300

@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 – 2013-06-17T04:29:11.993

@Luke I am not exactly sure what the Tyndall effect is, I will look it up. – Stephen – 2013-06-17T04:30:59.577

@stephen, perhaps you can add a little more detail to the original question as to invite better, more accurate answers . – zeffii – 2013-06-17T04:46:34.670

@zeffii Just what I was doing, just finished. ;) – Stephen – 2013-06-17T04:54:30.770

i've removed my answer accordingly. – zeffii – 2013-06-17T06:16:16.960

@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 – 2013-06-17T22:14:05.577

1I 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 – 2013-06-18T07:53:12.507

Answers

35

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:

Róbert László Páli

Posted 2013-06-16T02:30:53.063

Reputation: 3 254

2Thanks! That is exactly what I was looking for. But could you add some more detail on how exactly this works? – Stephen – 2013-06-17T22:23:26.953

1You 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 – 2013-06-18T07:04:23.510

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 – 2016-04-11T15:48:14.883

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 – 2016-04-23T12:49:13.193

@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 – 2016-06-27T04:59:32.577

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 – 2016-07-05T21:03:03.503

http://palaes.rudanium.org/Random/Laser.blend – Róbert László Páli – 2016-07-08T21:23:04.417

Use this blend as you like, considere it CC0. I will update the answere later. – Róbert László Páli – 2016-07-08T21:25:43.823

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.

Yash Aggarwal

Posted 2013-06-16T02:30:53.063

Reputation: 108

could you upload a demo file of this? I tried a physical based approach with cycles but didn't get very far. – zeffii – 2013-06-16T17:52:29.557

1He seems to use Blender Internal renderer... Because there is no way (at the moment - 2.67, as far as I know) to use halo on spotlight within cycles. (No volumetric for now) – Polosson – 2013-06-16T19:25:41.760

Yeah I used blender internal renderer – Yash Aggarwal – 2013-06-20T09:21:26.060

volumetric rendering in cycles is expected in later releases – Yash Aggarwal – 2013-06-20T09:31:37.027

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

Posted 2013-06-16T02:30:53.063

Reputation: 1 491

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 – 2016-03-10T11:00:35.477