Jump to content

Material Assignment best practices


Recommended Posts

I was wondering if someone could point me to some good tutorials for managing material assignments on 400+ objects.

For some of my work, I get CAD objects with 400+ individual pieces. In the scene, there are around 20-30 shaders. Each object then gets 3-5 attributes to further customize shader properties if necessary (using Redshift rsUserData nodes). Material assignment is straightforward in Maya, and I've built a script which will apply the user attributes to the selection, so it's pretty quick and easy. I can't believe material nodes are the way to go, I see everyone mention how awesome Houdini is for managing entire scenes, but I haven't seen a good explanation of shader management without adding an unmanageable amount of nodes. Is it material stylesheets? How do those work? Haven't found a clear cut answer but I have a feeling I'm missing a simple explanation.  A little off topic, but with this CAD work the grouped/tree view in Maya is perfect for managing object heirarchy, aside from making 50+ group nodes how would I do the same in Houdini? 

Thanks!

Chris

Link to comment
Share on other sites

stylesheets are pretty awesome and allow complex assignments and overrides based on groups, attributes, object names, scripts and what not.

also, you can use single wrangle SOP to batch assign materials to many pieces of an individual object, by string matching group names or string attribute.

Link to comment
Share on other sites

8 hours ago, davpe said:

you can use single wrangle SOP to batch assign materials to many pieces of an individual object, by string matching group names or string attribute.

What are the common options for alembic material assignment (if one abc file contains a lot of different geometry)?

Link to comment
Share on other sites

36 minutes ago, kiryha said:

What are the common options for alembic material assignment (if one abc file contains a lot of different geometry)?

as I said, stylesheets or vex are both good methods. vex allows very straightforward assignments by matching @path names. stylesheets allows assigning materials to packed geometry and more complicated assignment patterns.

with simple vex assignment, you'd go like this (in primitive wrangle SOP):

if(match('*brick*', s@path)) s@shop_materialpath = '/mat/brickMaterial';
if(match('*wood*', s@path)) s@shop_materialpath = '/mat/woodMaterial';
if(match('*metal*', s@path) || match('*METAL*', s@path)) s@shop_materialpath = '/mat/metalMaterial';
...

this expects a meaningful naming convention, obviously. if you have a good naming, you can specify just a few patterns to batch assign materials to many objects at once. all in single wrangle node. this is also the fastest way to assign many materials I guess (in terms of processing). 

this method also works well with attributeStringEdit SOP - if you have slightly messy naming of alembic paths, you can fix/unify them first with this SOP and then batch assign materials with vex as shown above.

Edited by davpe
  • Like 2
Link to comment
Share on other sites

6 hours ago, kiryha said:

Thanks, David!

Is it a good practice to insert material name in object name in a case with alembics? Or better to use custom string attributes on geometry (if it's possible to get them in a wrangle)?

it depends... material names in shape names would be obviously a good thing to have but from my experience, modelers just don't name things as you'd like them to, and it seems to be a waste of everybodys' time to force them to. so I typically just want to have some meaningful names saying what things are, and most importantly, not having objects that are supposed to be made of different materials, fused into a single shape (that's obviously an issue that can only be solved by cherry-picking polygons by hand). Then I typically do attributeStringEdit SOP to add material names to groups of objects. For instance I might want everything called "wood" to have the same material as objects called "planks" and "beams", and also "Beams", "Beam", etc... So I take all these and add "woodMat" at the end of their path names. And then in the wrangle I just filter "woodMat" and assign the material to all these objects. And then the model is likely updated several times, with some new shapes, or some shapes named differently than before etc. So to tackle that, I usually have bright green emissive material (just something really obvious), and the last line in my vex will say:

if(s@shop_materialpath == "") s@shop_materialpath = '/mat/green';

so that any shapes that were not picked by my pattern matching for any reason, will render this stand out green color to be immediately noticed.

so that's generally my usual material assignment workflow for assets made of many objects. this or stylesheets if objects are packed and I can't unpack them - but mostly I prefer wrangle workflow as I find it more straightforward and it can typically do all I need.

 

Edited by davpe
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...