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.
Links
7 Comments
Very cool example of the power of OSL, and might actually be useful for animation. Great stuff.
Amazing...how about mixing with smoke??
My thoughts exactly! Imagine this plus volumetrics in cycles...
Thank you guys. I'm glad to contribute to the Blender community with all the pleasure I have using Blender.
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: http://renatogsousa.weebly.com/1/post/2012/12/laser-sheet-osl-demo-and-blend-file.html
Congratulations and thanks for sharing! ;)
It would be allot difficult to obtain this effect otherwise.
Very cool!
I would keep your eyes peeled at Small Blender Things as well:
http://blenderthings.blogspot.com/
This person is creating some pretty amazing OSL scripts in combination with other cycles nodes quite often.