primvar_helper

Primitive Variables are a really cool way to get variation in Renderman Shading Networks. As it requires adding Attributes to your Shape Nodes within Maya to control the variation it can be quite time consuming to set it up. So I was trying an attempt to build an interface that helps a bit with the set up.The GUI let’s you choose a name, the PrimVar type and min/max values of which it will randomly pick floating point numbers within that range. It is also possible to just use integers with the according checkbox. The GUI is far from being pretty or well organized, but it does the job. :)

 

As I am a bit short on time however I just had the time to properly make use of Float PrimVars as that’s what I need for a current project I’m doing. As with all my scripts they are not written very well, but should be kind of readable. So feel free to modify it as needed. I hope I will find the time soon to make the other types work properly.
So for example using 3 PrimVars with just one shader on all objects results in loads of variation… Which is always a good thing :)

 

Additionally as you can see there is also an “Object ID” part in the GUI. It let’s you add integer PrimVars with increasing values for each object. At the same time it will add an AOV with the same name like the primvar (of course this custom AOV has to be set up in Slim beforehand).
An alternative approach to making Object ID’s would be having distinct floating point values for each object. So the value that get’s assigned by the script corresponds to the value that is being rendered within the Object ID AOV. For example object 3, that has the Object ID primvar value of 3 assigned has a value of 3,3,3,3 for RGBA. The good part is that it is very easy to set up, but one may run into aliasing issues when dealing with very thin geometry for example. To make use of this technique I also prepared a Nuke Gizmo that handles these kind of Object ID’s and has a slider to separate them.

Also here’s a quick demo:

Simple PrimVar Helper Script from Julius Ihle on Vimeo.

So hopefully I will find some time to complete the script, but for now if anyone’s interested feel free to grab it from HERE.