VFT | OSL shaders in Blender

For my graduation project VFX Fractal Toolkit (VFT) I developed a couple of Open Shading Language (OSL) shaders to render volumetric fractals. I produced with them the following animations.

As a renderer I used Arnold and was pretty satisfied with the workflow. However I was wondering how difficult would it be to use the same OSL shaders in another renderer, e.g. Blender’s Cycles. Especially because I was trying to mimick OpenCL’s syntax in OSL (not the best idea, but helped me port OpenCL shaders which I built first), included couple of header files etc..

As it turned out it was a pretty quick process and everything worked out of the box, requiring only minimal changes. The only thing I had to change was to properly set up multiple node outputs. Arnold doesn’t support multiple outputs for an OSL node so I worked around it by outputting a 4×4 matrix type with encoded values in it and extracting them afterwards. This makes Blender’s shaders nicer and more readable, you can check the diff here.

The shading setup in Blender looks pretty similar to the one used in Arnold and also outputs similar results.

Screenshot from 2019-06-19 18-37-47

For the testing I used Blender 2.80 beta running in a Docker container.

Keep in mind that rendering such volumes is pretty slow and neither Arnold nor Cycles support OSL on GPU. I included the changes in blender branch of the repository (not for all OSL shaders yet, but you get the idea :)).

Advertisements
VFT | OSL shaders in Blender

Debugging Python in VFX applications

In this guide I will show you how you can debug Python scripts in various VFX DCC applications, like Houdini, Nuke, Maya and Blender. I will cover remote Python debugging from Visual Studio Code and configuration of applications.

debug_screen

UPDATE 1: added new image :), fixed typo in pip command, mentioned other ways of pointing to ptvsd module, compared VSCode debugging to pdb.

UPDATE 2: mentioned Motion Builder and other packages

Continue reading “Debugging Python in VFX applications”

Debugging Python in VFX applications