Passing object data to a shader

Discussions regarding Materials, Material-Compounds or Shaders, etc.
User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 22:38
Location: St. Thomas, Ontario

Passing object data to a shader

Post by Daniel Brassard » 30 May 2012, 16:55

Can somebody help me in understanding how to pass object information to a shader in Softimage?

Here is what I want to do:

I have an object in the scene (say a teapot).

I create a new geoshader primitive.
I connect a geoshader to the geoshader primitive.
I open the geoshader node.

Here is where i am stuck (like a bug on fly paper).....

I want to create a input field were a user could write in a field the name of the teapot object or pick it from the scene explorer and the field would be automatically filled. The shader would then automatically take some information from that object i.e

teapot.no_polygons->geoshader.no_polygons;
teapot.no_vertices->geoshader.no_vertices;
etc.

Most example I have are direct manipulation of the scene in Mental Ray standalone. I have no example on how to select an object and provide object attributes/parameters within Softimage Shader code (C++).

Can someone help me with an example (even partial ccp code is fine to show me the process)

Thanks!
$ifndef "Softimage"
set "Softimage" "true"
$endif

BenR
Posts: 92
Joined: 11 Jun 2009, 18:52

Re: Passing object data to a shader

Post by BenR » 30 May 2012, 22:03

If I understand what you are trying to do, you will want to use a UserDataBlob to pass the information to your geoshader. Take a look at the Wireframe sample in the SDK.

Ben

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 22:38
Location: St. Thomas, Ontario

Re: Passing object data to a shader

Post by Daniel Brassard » 31 May 2012, 11:56

Thanks BenR, I'll look into it. Cheers!

Dan
$ifndef "Softimage"
set "Softimage" "true"
$endif