Open Shading Language (OSL)    "Patterns"

OSL ST Coloration Project​

November 07th, 2015

Project Overview

This is a project from class VSFX 502 - Programming 3-D Models and Shaders. This page displays the results of patterns created using OSL and it's application to shaders using RIB and Maya. The purpose of this assignment was to learn the basics of the open shading language (OSL).

Final Render Image

Setting Up Project

 

Step1:   Compile the shader to your maya project directory;


Step2:   Bring the osl file to the front and using the popup menu choose, "Declare Shader as Rib";


Step3:   Use Rman Tool->Plugins->Bxdf->PxrLMDiffuse and save the rib file in the Maya project

               directory;


Step4:   "Hook" the output of the osl node to the "frontColor" of PxrLMDiffuse;


Step5:   Open Maya. - set project, - save or open a scene;


Step6:   Confirm the project by opening Render Settings, and look at the Workspace tab;


Step7:   Assign any material to an object and go to its shading group tab;


Step8:   Use Attributes->RenderMan->Add Rib Box and enter this text, ReadArchive "Cross.rib";

 

OSL Scripting Code

I used the OSL scripting to creat these patterns. I have to make sure that the .oso file and .rib file are all in the project path. So the scripting will be work correctly. All the code for these pattern as follow.

Conclusion

This is my first time using OSL to create the shader patterns. It is pretty cool! And in the future, I will try to create more complicated patterns using OSL. It is very useful for me and also I realize the math is very important to us! I am very excited about the next assignment!​