It looks like you're using an ad blocker! I really need the income to keep this site running.
If you enjoy BlenderNation and you think it’s a valuable resource to the Blender community, please take a moment to read how you can support BlenderNation.

Laser Sheet OSL Shader

OSL (Open Shading Language) shader nodes for Cycles are becoming more and more popular (and powerful). Here's a laser sheet implementation by renatogsousa.

renatogsousa writes:

I've been following the different examples of the new OSL shaders and I have decided to write my own shader, in order to show another possible application. In this case is to simulate a laser sheet illuminating the objects in a scene.

The script allows the definition of the laser sheet by imputing its origin and the vector normal to the laser plane. It then illuminates the objects where they intersect the laser sheet only if there are no obstacles between their surface and the laser origin. You just have to connect the output of the script node to an emmission shader and then add it to the base original material.

You can input the origin and normal vector values by hand but in order to create an easier and more visible way of where the plane will be, I've introduced 3 empties in layer 2 which define the origin and the orientation of the laser plane. After placing these as we want, just run the python script "LaserUpdate" and the input values of the OSL script will be updated accordingly. You should de-activate layer 2 when rendering since the auxiliary plane will act as an obstacle interfere with the script.



  • JulianHzg

    Very cool example of the power of OSL, and might actually be useful for animation. Great stuff.

  • Charon about mixing with smoke??

    • rickisen

      My thoughts exactly! Imagine this plus volumetrics in cycles...

  • renatogsousa

    Thank you guys. I'm glad to contribute to the Blender community with all the pleasure I have using Blender.

  • renatogsousa

    Meanwhile, SlykDrako implemented an easier way to define the laser position and orientation from a plane, by using drivers and a python script. The updated file can be found on the same post:

  • rogper

    Congratulations and thanks for sharing! ;)
    It would be allot difficult to obtain this effect otherwise.

  • fmoritz

    Very cool!

    I would keep your eyes peeled at Small Blender Things as well:

    This person is creating some pretty amazing OSL scripts in combination with other cycles nodes quite often.

Share this story: