import attribute in shader by name?

   4234   2   1
User Avatar
Member
8599 posts
Joined: July 2007
Offline
i want to expose a string parameter which will define the name of the attribute to import from geometry

for example:
i have a geometry with 3 vector attributes named “red”, “green”, “blue”
i want to use one of those attribs to define a surface color
so i create a parameter VOP with the name of the attribute
but i want to be able to choose the name of the attribute later by typing the name directly in the material parameters pane

is something like this possible?
or is renaming the attribute in SOPs to match hardcoded shader name the only way?
I dont want to force artists to dig inside the shader network and rename it there
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
7025 posts
Joined: July 2005
Offline
Hey,

Unfortunately, the way that Mantra (and PRman for that matter) work is you have to define the parameters' name before compiling the shader since it's in the parameter area of the shader. So yes, you'll have to set the attribute name in the SOP network.

However, you can easily make a very simple “custom SOP” (really just an HDA) that simply exposes the From and To fields of the Attribute SOP's renaming. If you really want to do a little scripting you can even write a script that would list all the attributes on the geometry and expose that as a menu item, but that would take a bit more work

Cheers,

Peter B
User Avatar
Member
8599 posts
Joined: July 2007
Offline
thanks Peter

Attribute SOP is good enough for me
i just thought, it can be done in shader
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links