How to assign multiple materials to the same object

   14038   11   1
User Avatar
Member
453 posts
Joined: 2月 2013
Offline
How do I get multiple material slots on one object (via houdini engine in unreal engine)?

As far as I know, for unity you can create an attribute “unity_material” and set it to string with a path to a material. What's the equivalent for Unreal? I tried just assigning different materials via a Material Sop, but that didn't work. (I still only get one material slot per object).

- I'm asking, because I read somewhere that support for that was recently added.
User Avatar
Member
173 posts
Joined: 4月 2014
Offline
Hello DASD,

We do have support for multiple materials per generated static mesh. Please have a look at the attached asset; points of interest are SHOP nodes Multi_Whole1/2/3 and obj Multi_Whole (look at material nodes). You can also import this asset into UE and see how it works.

Please let me know if this answers your question.
Thank you!

Attachments:
HAPI_Test_Materials_Multi.otl (24.3 KB)

User Avatar
Member
453 posts
Joined: 2月 2013
Offline
Your example file certainly works. I tried to apply this on my file and I did something very similar before, but I am still debugging.
I think - correct me if I'm wrong - that the different cop nodes being fed into the materials is actually essential for this to work. I did not have time to test it yet, but I think that if you only set colors on the shaders, Houdini Engine won't differentiate between dirrent shaders and give the object only one material slot.
- If that's not it, I must be missing something else.
User Avatar
Member
173 posts
Joined: 4月 2014
Offline
Hello,

Setting colours on shaders should work. Are you using stylesheets by any chance? Can you attach your asset so we could have a look at what's going on?

Thanks!
User Avatar
Member
453 posts
Joined: 2月 2013
Offline
I'm not using stylesheets, as far as I know. I'll try to find a solution next week and make an update in this post.
User Avatar
Member
3 posts
Joined: 3月 2015
Offline
I have spent some time trying to figure out this myself, and I got it working after placing my shop network inside my digital asset.

I had it outside first, since I have more than one digital asset that uses the same materials.

That was on a simple sphere with 2 materials, I could not get it working in my proper digital asset.

But is that the case, that the shop network needs to be inside the digital asset?
User Avatar
Member
453 posts
Joined: 2月 2013
Offline
I tested it (Houdini Indy version 15.0.287) and the only thing that worked was to feed cops into the shaders (like shown in your example).
- It's not bad but I guess that is not intended behavior.
User Avatar
Member
3 posts
Joined: 3月 2015
Offline
I'm still having problems getting this to work, so I'm uploading a cleaned version of my project file.
With one digital asset that works and one that does not.

Attachments:
Multi_Material_Test.zip (105.6 KB)

User Avatar
Member
3 posts
Joined: 3月 2015
Offline
Could anyone test my file, to see if I have done something obviously wrong?
User Avatar
Member
453 posts
Joined: 2月 2013
Offline
My guess is that it does not like that you feed objects into each other. Try putting it all into one object node.
User Avatar
Member
45 posts
Joined: 2月 2014
Offline
You could also try to use a single material node to assign your materials, place it at the end before the output node.
User Avatar
Member
173 posts
Joined: 4月 2014
Offline
There's also a way to specify Unreal materials, using unreal_face_material string primitive attribute (you can have different assignments for different primitives); it must be a valid UE4 material or material instance reference. If engine does not find such material during cooking, it will fallback to default Houdini UE4 material which we ship (which samples vertex colors, I believe).
  • Quick Links