I've got some packed prims, and I want to use their @map attribute to set the shader's baseColorMap either uvgrid_grey.pic, uvgrid_color.pic, or Mandril.pic. The sphere on the right shows the idea I'm trying to implement.
Is there a way to do this? I haven't been able to figure it out from the docs and examples, so if any MSS gurus have some tips, I'd greatly appreciate it!
{
“styles” :[
{
“target”: { “name” : “*”},
“overrides” : { “materialParameters”: {
“baseColorMap”: “@map”}}
}
]
}
Material Stylesheets and Attributes
3603 4 1- goldleaf
- Staff
- 4169 posts
- Joined: Sept. 2007
- Offline
- mtucker
- Staff
- 4441 posts
- Joined: July 2005
- Offline
First, you should create the map attribute as a primitive attribute instead of a point attribute.
Second, the only way to bind a primitive attribute to a material parameter is through a cvex script. So set the style sheet to:
{
“styles” :[
{
“target”: { “name” : “*” },
“overrides” : {
“materialParameters”: {
“baseColorMap”: {
“script” : {
“code” : “cvex myFn(string map=\”\“; export string out_map=\”\“) { out_map = map; }”,
“bindings” : { “map” : “map” }
}
}
}
}
}
]
}
Second, the only way to bind a primitive attribute to a material parameter is through a cvex script. So set the style sheet to:
{
“styles” :[
{
“target”: { “name” : “*” },
“overrides” : {
“materialParameters”: {
“baseColorMap”: {
“script” : {
“code” : “cvex myFn(string map=\”\“; export string out_map=\”\“) { out_map = map; }”,
“bindings” : { “map” : “map” }
}
}
}
}
}
]
}
- goldleaf
- Staff
- 4169 posts
- Joined: Sept. 2007
- Offline
- anon_user_89151269
- Member
- 1755 posts
- Joined: March 2014
- Offline
- goldleaf
- Staff
- 4169 posts
- Joined: Sept. 2007
- Offline
McNistor
Interesting. What does this allow you to do in practical terms? Assign different shaders/textures for the pieces of a shattered ball?
The shattered sphere was just a quick way to demonstrate the type of scenario I was trying to work in, without being able to share the alembic cache; this sort of things is probably more useful for Crowds or lighting Alembic scenes, where you don't want to load everything as Geometry in order to bind materials. I wanted to see if I could setup an attribute in a Python SOP, basic on the object's name, to setup the texture maps properly.
I'm o.d.d.
-
- Quick Links