58
$\begingroup$

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

$\endgroup$
14
  • 2
    $\begingroup$ Any particular reason why you want to use a lamp? This would be much easier with a material imo. $\endgroup$
    – iKlsR
    Jun 16, 2013 at 2:53
  • $\begingroup$ @iKlsR Do you mean an emission material? As long as it sends light in a straight line it is fine with me. $\endgroup$
    – Stephen
    Jun 16, 2013 at 2:58
  • $\begingroup$ What exactly did you mean by using a material? @iKlsR $\endgroup$
    – Stephen
    Jun 16, 2013 at 5:26
  • $\begingroup$ 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? $\endgroup$
    – zeffii
    Jun 16, 2013 at 7:12
  • 1
    $\begingroup$ 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 :) $\endgroup$
    – zeffii
    Jun 18, 2013 at 7:53

3 Answers 3

43
$\begingroup$

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:

$\endgroup$
8
  • 2
    $\begingroup$ Thanks! That is exactly what I was looking for. But could you add some more detail on how exactly this works? $\endgroup$
    – Stephen
    Jun 17, 2013 at 22:23
  • 1
    $\begingroup$ 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. $\endgroup$ Jun 18, 2013 at 7:04
  • $\begingroup$ 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: i.imgur.com/l08vpd4.jpg $\endgroup$ Apr 11, 2016 at 15:48
  • $\begingroup$ 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). $\endgroup$ Apr 23, 2016 at 12:49
  • $\begingroup$ @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! $\endgroup$ Jun 27, 2016 at 4:59
5
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ could you upload a demo file of this? I tried a physical based approach with cycles but didn't get very far. $\endgroup$
    – zeffii
    Jun 16, 2013 at 17:52
  • 1
    $\begingroup$ He 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) $\endgroup$
    – Polosson
    Jun 16, 2013 at 19:25
  • $\begingroup$ Yeah I used blender internal renderer $\endgroup$ Jun 20, 2013 at 9:21
  • $\begingroup$ volumetric rendering in cycles is expected in later releases $\endgroup$ Jun 20, 2013 at 9:31
4
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ 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 $\endgroup$ Mar 10, 2016 at 11:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .