[GeoShader Release] miLabel for XSI

185 views
Skip to first unread message

Amaan Akram

unread,
Mar 11, 2008, 8:36:32 PM3/11/08
to x...@softimage.com
Hello everyone,

A while back there was a discussion on the list about why it was not
possible to set tags on objects inside XSI that can then be passed on to
shaders in Mental Ray to identify objects.

I am sure someone has written a shader to do just that, but I thought it
would be a good exercise to explore the MR scene DAG, so I've written one.
My implementation works by assigning User Data Blobs to objects in XSI and
then the UserDataID field for the blobs is used to transfer values between
XSI and MR.

The shader can be downloaded from:

http://www.amaanakram.com/mr_shaders/miLabel.zip

Maya passes on such data via a mel script that calls these variables
MiLabel, and so I thought it would be appropriate to call this shader with
the same name.

One of the uses of labels is demonstrated in this example of mental ray's
mib_amb_occ node in Maya
http://www.djx.com.au/blog/2007/05/12/ambient-occlusion-with-milabel/

To do the same in XSI, please follow these steps

1) Add geoshader primitive
2) Add the shader miLabel_xsi (the shader has no interface)
3) Select the object you want to assign a label/tag to and run the
following JScript
var oBlob1 = Application.Selection(0).AddProperty( "UserDataBlob",
false, "miLabel" ) ;
oBlob1.Value = 5 ;

//Note that oBlob1.Value can be set to anything--it's not used in //the
shader, but it needs to be set for XSI to pass data over to MR

4)Expand the selected object in Explorer, find the property called
miLabel, and double-click
5)Enter a value for UserDataID (this is the actual value for miLabel)
6)Check Render Data (this is essential to pass data from XSI to MR)

To test this shader like in the maya example above, you can download the
mib_amb_occlusion node for XSI from T2S Mental Ray shaders. You can use
the value set in step (5) above in the shader's Id_inclexcl input.
The shaders can be downloaded from
http://www.tek2shoot.com/knowledge-base/softimage-xsi/unexposed-mental-ray-shaders-v1.1-32-64.html

The shader has been compiled with XSI 5.11's 32-bit SDK. A 64-bit version
can be compiled if needed.

I hope someone will find this little utility shader helpful. Of course,
fire away all bug reports to this e-mail address :)

-Amaan


---
Unsubscribe? Mail Majo...@Softimage.COM with the following text in body:
unsubscribe xsi

Reply all
Reply to author
Forward
0 new messages