...
Code Block |
---|
|
/** Turn our mesh into a subdivision surface */
nsi.SetAttribute( "simple polygon",
NSI::CStringPArg("subdivision.scheme", "catmull-clark") ); |
Creating and Assigning Shaders
Shaders are created as any other nodes using the NSICreate API call. They are not assigned directly on geometry but through an intermediate attributes nodes. Having an extra indirection allows for more flexible export as we will see in the following chapters.
Code Block |
---|
|
/** Create a simple shader node using the standard OSL "emissive" shader */
nsi.Create( "simpleshader", "emissive" );
nsi.SetAttribute( "simpleshader", NSI::CStringPArg("shaderfilename", "emissive") );
/** Create an attributes nodes and connect our shader to it */
nsi.Create( "attr", "attributes" );
nsi.Connect( "simpleshader", "", "attr", "surfaceshaer" );
/* Connecting the attributes node to the mesh assign completes the assignment */
nsi.Connect( "attr", "", "simple mesh", "geometryattributes" ); |