RixPatterns
|
Introduction
This tutorial presents a C++ pattern plugin called
The OSL code for the original sparky shader is shown below. |
Listing 1 (sparky.sl)
|
Althought the code for |
C++// Surface parameter RtFloat const *V; ctx->GetBuiltinVar(RixShadingContext::k_v, &V); // Assign values to each point. for(int i = 0; i < ctx->numPts; i++) { resultF[i] = RixSmoothStep(age[i] - rearblur[i], width[i] + age[i], V[i]) * (1 - RixSmoothStep(age[i], width[i] + age[i] + frontblur[i], V[i])); resultRGB[i] = RixMix(start[i], end[i], resultF[i]); } return 0; } OSLresultMask = smoothstep(age - rearblur, len + age, v) * (1 - smoothstep(age, age + frontblur + len, v)); resultRGB = mix(start, end, resultMask); |
This video,
|
On frame 1 the "Spark Age" parameter was set to 0.0. On the last frame the value was set to 1.0 - figure 2.
|
Many OSL functions have Rix... equivalents, such as, RenderManProServer-XX.0/include/RixShadingUtils.h
Useful color conversion functions are declared in, RenderManProServer-XX.0/include/RixColorUtils.h For convenience the commonly used Rix functions are accessible from Cutter's popup menu.
Before using the CutrSparky.args file the value of "rfmdata nodeid" should be edited so that it does not conflict with any other node ids specified in the users RenderMan_for_Maya.ini file. Refer to the tutorial "RixPattern Plugins: Cutter" for information about compiling and using custom RixPattern plugins. |
© 2002- Malcolm Kesson. All rights reserved.