The PxrOSL Pattern node is a useful way to create and prototype OSL patterns from inside Maya.
We only support OSL patterns (textures for shading) and not closures (materials). |
When you first open the node you'll see the representation above. If you expand the Source Code rollout you'll find a handy example built-in to the node.
You can see the source path under Compile and Reload buttons.
Compile - Compile the current code to a .oso file for rendering
Reload Source File - External edits to the file can be loaded from the saved/updated .osl file
The plus and minus icons are to expand and shrink the editor area.
The Parameters rollout will populate given a correct .oso file.
To begin, take a look at the page on Installing Custom Nodes.
Define the RFM_SHOW_PATH environment variable to point to your own custom configuration directory.
Create a config directory in that new location and save a custom rfm.json file (you can copy the original one to make changes). Here's a simple version:
{ "$schema": "./rfmSchema.json", "resources": { "user": { "nodes": { "search_paths": ["/Users/Artist/Shading/OSL_pkg/shader/myshow"] } } } } |
You should have the following structure:
RFM_SHOW_PATH |_ config |_ rfm.json |
Now add some metadata to your OSL shaders (below we use a simple example):
// // AddFloat_1 // shader AddFloat_1 [[ string category = "math", string help = "Adds two float inputs", int rfm_nodeid = 1553001, string rfm_classification = "rendernode/RenderMan/pattern/Studio/math" ]] ( float input_A = .0, float input_B = .0, output float resultF = .0 [[ string widget="null" ]], ) { resultF = input_A + input_B; } |
Here are the parts of the Help data: