Master material shared with multiple objects in Solaris

   1046   9   1
User Avatar
Member
41 posts
Joined: Aug. 2014
Offline
Hi,

I am going to prepare airplane model bought from Turbosquid. It has 3 separate sections for fuselage because of traditional single UV style to maximize texture density. Anyhow, 3 different materials wouldn't be so much issue to handle, but later I need to prepare multiple additional airplanes with same materials so I thought there must be some way to handle master material which will be assigned to all airplanes and if at some point client asks for glossiness change, bump or what ever, that would be easily changed from master material, right?

My question is, using MaterialX and Karma in Solaris, is it possible to create single material shared with multiple objects, but each using different base_color image and normal image?

Basically master material would have unified specualr_roughness controlled with image and also subtle noise bump all over and have ports for base_color image and normal. Possible?


Thanks
User Avatar
Member
9 posts
Joined: Jan. 2024
Offline
As far as I know in USD itself there's not really such a thing as cross-referencing between Shaders/Materials like a master material. In Houdini itself however, you can of course just create "reference copies" of Houdini nodes so they reference the parms of the others, except for those you want to tweak.

In USD with most renderers what you could do instead is putting down a node that reads a particular user data from a primvar on the geometry. E.g. you could read a filepath from a mesh attribute and use that for the texture, or use a float value from the mesh for specular - etc.

This works fine with Arnold materials. Quickly trying Materialx here with string values doesn't seem as trivial, see attached.

Maybe this gives you some ideas for general approaches.

Attachments:
hou_materialx.png (59.7 KB)

User Avatar
Member
274 posts
Joined: Nov. 2013
Offline
USD allows you to export and reference (and later override) whatever scene description you want, so exporting a base material setup and referencing (or sublayering) that into multiple assets is a perfectly reasonable way to go. In theory the editmaterial lop should allow you to author sparse overrides (such as base_color) on top of the referenced base material. In practice the material editing workflow might not quite be there yet (I haven't tried myself in since Houdini 19).

Primvars are another way to go if you feel like its tractable to attach overrides as attributes to the geometry (or ancestors), but usually just overriding the actual material is more straightforward.
Edited by antc - Feb. 12, 2024 16:34:37
User Avatar
Member
41 posts
Joined: Aug. 2014
Offline
Thank you antc and coloebleed.

I need to check when I get back to the office how to export material and reference it.

Would it work if I create master material inside material library and merge it in to the stream? Just like we can merge in lights and cameras to stream? Then apply it using material linker as usual and finally add material edit later in that stream to edit it by adding per material specific images?

So much new stuff to learn!


Thanks
User Avatar
Member
41 posts
Joined: Aug. 2014
Offline
OK, what I was thinking yesterday kind of worked. I plugged material library using merge and edit material.
But now with material linker I cannot see those edited materials because edited material names are same as master.

Then I when to referencing rout. I exported master material as USD and read in as reference. But again, all referenced materials comes in with same name so I need to somehow rename each edited materials A, B and C for example so those can be identified when applying to different parts.


EDIT:
Oh, that was easy. Simply editing MaterialPath name for example addinf suffix such as ORIGINALNAME_A and double clicking in to edit material node and change subnet name similarly ORIGINALNAME_A.
Edited by JuhaT - Feb. 13, 2024 02:01:09
User Avatar
Member
41 posts
Joined: Aug. 2014
Offline
Well, I suppose editing material with editmaterial node will cut the link from reference and make it as new material.
Need to search another way.
User Avatar
Member
274 posts
Joined: Nov. 2013
Offline
I was able to get this to work using an editmaterialproperties lop. I had less success with an editmaterialnetwork lop.

Attached is a hip file where the network on the right creates a material called "base_material" and exports it to materials.usdnc. The "base_color" parameter of "base_material" is set to a purple color. In the material network it's important to click "Promote Parameter" on the base_color parameter (using the gear icon to the right of the parameter). If you don't promote the parameter it won't show up populating the editmaterialproperties lop (via the "Create Parameters" button).

The network on the left then imports materials.usdnc as a sublayer. The material is assigned again, and then a editmaterialproperties lop is used to make the base_color a greenish color. Everything else describing the material is coming from the materials.usdnc file. If you go back and make a change the the base material on the right, re-export, and then click "Reload Files" on the sublayer_base_material node you should see it update.

You don't need to export the materials to usd for editmaterialproperties to work of course, although if you're working across several assets in separate files it's generally simpler to share a usd file than a hip file imo. But if you wanted to avoid exporting usd files you could put your base material setup in a hda and use that in multiple assets instead.
Edited by antc - Feb. 13, 2024 18:24:36

Attachments:
material_edit.hipnc (339.8 KB)
materials.usdnc (3.1 KB)

User Avatar
Member
41 posts
Joined: Aug. 2014
Offline
antc
I was able to get this to work using an editmaterialproperties lop. I had less success with an editmaterialnetwork lop.

Attached is a hip file where the network on the right creates a material called "base_material" and exports it to materials.usdnc. The "base_color" parameter of "base_material" is set to a purple color. In the material network it's important to click "Promote Parameter" on the base_color parameter (using the gear icon to the right of the parameter). If you don't promote the parameter it won't show up populating the editmaterialproperties lop (via the "Create Parameters" button).

The network on the left then imports materials.usdnc as a sublayer. The material is assigned again, and then a editmaterialproperties lop is used to make the base_color a greenish color. Everything else describing the material is coming from the materials.usdnc file. If you go back and make a change the the base material on the right, re-export, and then click "Reload Files" on the sublayer_base_material node you should see it update.

You don't need to export the materials to usd for editmaterialproperties to work of course, although if you're working across several assets in separate files it's generally simpler to share a usd file than a hip file imo. But if you wanted to avoid exporting usd files you could put your base material setup in a hda and use that in multiple assets instead.

You are absolute legend!
Following your sample file, I managed to replace color parameter with File parameter and I was able to plug whatever image I needed to that material. Super!

Now my last challenge here is how to alter that material name so I can read in two or more base material and modify them by using specific image for base color and assign them using group using Material linker.

Right now if I add another base material, it will obviously overlap with first one and I cannot apply it to different section of my geometry using subset groups. Is there any way of altering material name just to be able to see it in material linker?

Attachments:
Capture.JPG (120.3 KB)
Capture2.JPG (64.7 KB)
Capture3.JPG (25.7 KB)

User Avatar
Member
274 posts
Joined: Nov. 2013
Offline
There's a couple of options to get a differently named material. On the editmaterialproperties lop try setting the 'Reference Type' parameter from 'None' to 'Reference'. That should create another (differently named) reference to the base material for you. Alternatively, a reference lop can be used instead of the sublayer lop so as to be more targeted about the path/name to the material in the first place.

Here's an updated hip with examples.

Attachments:
material_edit.hipnc (374.7 KB)

User Avatar
Member
41 posts
Joined: Aug. 2014
Offline
antc
There's a couple of options to get a differently named material. On the editmaterialproperties lop try setting the 'Reference Type' parameter from 'None' to 'Reference'. That should create another (differently named) reference to the base material for you. Alternatively, a reference lop can be used instead of the sublayer lop so as to be more targeted about the path/name to the material in the first place.

Here's an updated hip with examples.
Thank you so much!
Import Materials (sublayer + reference) seems to work nicely as I see additional materials on Material List.
I will try to adopt that into my scene.

Much appreciated antc.

Attachments:
Capture.JPG (60.1 KB)

  • Quick Links