Script 2.8


Script Node

OSL was designed for node based shading, and each OSL shader corresponds to a node in a node setup. To add an OSL shader, add a script node and link it to a text datablock or an external file. Input and output sockets will be created from the shader parameters, when clicking the update button in the node or the text editor.

OSL shaders can be linked to the node in a few different ways. With the Internal mode, a text datablock is used to store the OSL shader, and the OSO bytecode is stored in the node itself. This is useful for distributing .blend files with everything packed into it.

The External mode can be used to specify a .osl file on disk, and this will then be automatically compiled into a .oso file in the same directory. It is also possible to specify a path to a .oso file, which will then be used directly, with compilation done manually by the user. The third option is to specify just the module name, which will be looked up the shader search path.

The shader search path is located in the same place as the scripts or configuration path, under:

Linux /home/$user/.config/blender/2.65/shaders/
Windows C:\Users\$user\AppData\Roaming\Blender Foundation\Blender\2.65\shaders\
Mac OS X /Users/$user/Library/Application Support/Blender/2.65/shaders/
For use in production, we suggest to use a node group to wrap shader script nodes, and link that into other .blend files. This makes it easier to make changes to the node afterwards as sockets are added or removed, without having to update the script nodes in all files.

  • 最終更新:2020-03-07 23:40:13