10

Laser beams are usually not cylinders of light, but instead they have a smooth beam profile, where they are brighter in the center of the beam and dimmer towards the sides. The cross section typically looks like a Gaussian function, do they are often called "gaussian beams".

Consequently, in illustrations, the lasers are often rendered such that they are most intense in the center and fade out towards the sides. I have achieved this using a blur effect in the compositor, but since Blender can handle most of the other physics in the world, I would like to include realistic laser beams directly.

Here is what I have come up with so far, but I am not quite happy with the results:

enter image description here

The blue beam was created using the node layout described in this post, except that I swapped the order of the colors in the color ramp. This still displays very sharp edges and they do not match the natural background color.

enter image description here

For the green beam, I tried to do the most realistic thing possible: I combined a volume emitter with a volume scatterer object. In reality, it is the scattering of the laser beam by particles in the air that allows us to see the beam, so I thought that this was the most appropriate. I added a set of nodes (yellow) to control the longitudinal intensity of the emitter in order to make the beam brighter near the focus (right side). Then, I included a set of nodes (red) to control the radial intensity of the beam in order to give it a nice soft edge. However, I just scaled the intensity along the radial coordinate, but did not take into account the fact that the beam is getting smaller. So, there is a nice gradient of intensity near the left side of the beam, but it's still very sharp towards the right side.

So, I suppose the question is how do I scale the intensity of the emitter while taking into account the width of the beam?

DanHickstein
  • 543
  • 5
  • 17

1 Answers1

7

Here is a node setup that approximates the Gaussian beam.

  • normalize the coordinates of the object by division on the dimensions
  • subdivide the radial dimensions "in this case Y and Z" on the beam length "X"
  • feed Y Z into a Gaussian function to create the redial gradient
  • the longitude gradient is simple (beam length-X)

cycles node setup for Gaussian laser beam

Coordinates node group
Coordinates node group

Gaussian function node group
Gaussian function node group
The A input in the Gaussian function group controls the amplitude of the Gaussian function.
S_y and S_z control the Y and Z spread.

simple render :example render

another render :

enter image description here .blend file
YA render

Chebhou
  • 19,533
  • 51
  • 98
  • Wow! i'm going to try and (i hope) understand this! thx! – Bithur Feb 13 '15 at 15:58
  • changing the object's origin allows to define where is the thinest point. (can be one side or in the middle giving 2 cones of light) – Bithur Feb 13 '15 at 16:35
  • @Bithur yes if download the file you can see that i have moved the origin to the end of the object , and it won't give two cones unless you take the absolute value of X – Chebhou Feb 13 '15 at 16:37
  • 1
    really fun!! now, question coming :) – Bithur Feb 13 '15 at 16:41
  • Thanks for demonstrating how to implement the gaussian function - that is awesome. But are you taking into account that the width of the object is changing with x? It seems that you have the same problem that I did, where you are defining a width of the gaussian that stays constant regardless of how the object changes in x. – DanHickstein Feb 15 '15 at 22:20
  • @DanHickstein YES i took in account the change of the width you can see that it fades on the sides from the origin to the end , the dimensions i defined are to normalize the dimension, also take a look at the additional render it is more clear than this , and check the blend file for more experiments – Chebhou Feb 15 '15 at 22:24
  • Hmmm, well, at the end of the day, I want it to look more like a nice blurry-edged laser beam and not like a cone with dark regions near the edges. – DanHickstein Feb 15 '15 at 22:35
  • @DanHickstein an image for illustration would be apretiated – Chebhou Feb 15 '15 at 22:39
  • Maybe something closer to this image, where the lasers are just blurry light against the background. https://www.google.com/search?q=laser+beam+illustration&espv=2&biw=1401&bih=805&source=lnms&tbm=isch&sa=X&ei=OCLhVKaWH5etyAT9xYHYDA&ved=0CAYQ_AUoAQ&dpr=2#imgdii=_&imgrc=yp3y-yWJFkEKrM%253A%3ByZtL9sQiFK5T4M%3Bhttp%253A%252F%252Fthumb9.shutterstock.com%252Fdisplay_pic_with_logo%252F1895957%252F173410466%252Fstock-photo-the-beam-of-light-on-a-black-background-laser-illustration-173410466.jpg%3Bhttp%253A%252F%252Fwww.shutterstock.com%252Fs%252Flaser-beam%252Fsearch.html%3B450%3B320 – DanHickstein Feb 15 '15 at 22:52
  • @DanHickstein but those look cylindrical, is that what you need? – Chebhou Feb 15 '15 at 22:57
  • Well, I wanted them to be conical, but this is just an example of how I would like them to look against the background. I don't want them to look like sharp cones, they should be blurry like in the above image. – DanHickstein Feb 15 '15 at 23:00
  • the dark sharp edges are caused by the density of the scatter which is added gust to demonstrate the brightness of the light beam; i will try to do another render – Chebhou Feb 15 '15 at 23:02
  • @DanHickstein check the additional render – Chebhou Feb 17 '15 at 17:17
  • Oh, that is exactly what I wanted! But I don't understand which step is normalizing the coordinates to the object's radial dimension. Can you indicate where that is in your answer? – DanHickstein Feb 17 '15 at 21:49
  • @DanHickstein the second image "coordinates node group" , glade you liked it ! – Chebhou Feb 17 '15 at 21:58
  • Does someone still have the original blender file of the proposed solution by Chebhu? – fschiffers Oct 23 '22 at 16:55