How do I assign my HDA with multiple material elements for Unreal to see?

   26125   30   7
User Avatar
Member
40 posts
Joined: Oct. 2018
Offline
this is exactly the answer to my question… but i'm busy with heightfields in stead of objects.

can someone tell me how to do this with heightfields? i can't just merge them together because then i have double the height maps etc ( i guess thats not good)

when i use a heightfield layer node to merge the 2 masks together, and assign a unreal material before the merge, the second one gets replaced by the first material input resulting in unreal texturing the complete terrain with 1 material instead of using the mask.

can someone help me out here.
User Avatar
Staff
534 posts
Joined: Sept. 2016
Offline
@pande Not sure what you're trying to do here, are you trying to use one landscape with two materials assigned to it?
User Avatar
Member
8 posts
Joined: Sept. 2018
Offline
Hi all! I also have a question regarding this problem and I'm wondering whether there is a way to solve this using material instancing workflow? If I have a mesh with two different groups, each of them with their own material, principledshader, and texture, it is possible to generate materials for each unique principledshader. Extending this, I would like to create multiple instances of one master unreal material and apply those instances to different parts of the generated static mesh. When I am trying to achieve that in Unreal, I get two separate materials generated, but only one of them is used to generate a master unreal material instance which is applied to the entire generated mesh. I hope that the pictures will make my problem easier to understand.

The only solution I can think of now is to generate separate static meshes based on different materials (glancing at the docs it seems like this is not even possible unless you're dealing with collisions/LODs), but regardless I probably cannot do that as I need my generated static mesh to stay seamless.

Attachments:
01_ue_multimatinst.PNG (1.8 MB)
02_ue_multimatinst.PNG (2.3 MB)

User Avatar
Member
40 posts
Joined: Oct. 2018
Offline
dpernuit
@pande Not sure what you're trying to do here, are you trying to use one landscape with two materials assigned to it?

hi and thanks for repplying.

what i'm trying to do eventually, is assign materials to a mask in houdini (a houdini material or a unreal asset with the unreal_material node.. doesn't really matter) so that unreal reads that out. is that even possible?

i got it so far that when i load the .hda file in unreal, the height map gets a material assigned (this was by using the unreal_material node assigning a unreal material, so this part works for me haha)

my problem is this.

when i have 1 heightfield, and make a simple mask. i then make a copy of that mask and invert it. so i have 2 masks nodes next to each other. then i assign a unreal material asset with the unreal_material node to the mask.

the moment i use a heightfield layer to merge those 2 layers (i learned this is the way to merge 2 heightfield layers) the first heightfield material input overrides the second heightfield material input. so i end up both masks having the first material assigned to, also the mask and height layer get the material assigned to. when i choose the mask itself in the unreal_material node to assign the material to, no material at all gets assigned to it. i hope this is clear since i'm not at my pc itself so i cant upload a example file. but its just 6 nodes, 1 heightfield, then 2 masks left and right, with 2 unreal_material nodes, then merge them with the heightfield layer node.

would be so awesome if u can help me figure this out
User Avatar
Staff
534 posts
Joined: Sept. 2016
Offline
@pande I see, so you're actually trying to assign two different unreal materials to a Landscape layer / HF mask ?
That's actually not possible, as unreal only allows you to use one material per Landscape.

Most of the discussion in this topic was for mesh materials, as meshes can be assigned multiple materials.

For Landscapes, they can only have two materials, a main one, and a second one for the holes that are created via the visibility mask. You should use a layer blend on your main material, to define what texture/values/colors to use for a given layer.

In your case, your HF has height, mask and mask2 (dont merge the two masks together, as unreal will then see them as one, and wont be able to texture them differently).
Your unreal landscape will have two layers, mask and mask2.
You need to setup your material with a layer blend that takes into account mask and mask2.

You should have a look at for more details on Landscape materials:
https://docs.unrealengine.com/en-us/Engine/Landscape/QuickStart/4 [docs.unrealengine.com]
User Avatar
Staff
534 posts
Joined: Sept. 2016
Offline
@went_procedural If I understand correctly what you're trying to do, the issue with your current setup is that you're only generating one material instance.

=> Your material node assign two different material for each group
=> The first attribute creates tells the UE4 plugin that everything should use a material instance created from your master material.
=> You override that material instance myTexture to the first principled shader's diffuse.
=> Then you ovveride that same myTexture paramater on the material instance to the second principled shader's diffuse.

End result, you've created a MI from your master material, and overrident its myTexture paramter to the second principled shader.

What you want is, to create two material instance of your master material, on with the first principledshader's diffuse, the other with the second's.

The issue could be that since you're setting the unreal material to the same values, the plugin thinks that you want to use the same material instance for both groups. So Unfortunately, you may have to duplicate your master material.
User Avatar
Member
8 posts
Joined: Sept. 2018
Offline
@dpernuit Thanks a lot for your response! I was thinking that this could be the case so it's good to have a confirmation.
User Avatar
Member
20 posts
Joined: Sept. 2013
Offline
The issue could be that since you're setting the unreal material to the same values, the plugin thinks that you want to use the same material instance for both groups. So Unfortunately, you may have to duplicate your master material.

Has this been resolved / is there any fix for this? I need to generate hundreds of material instances from a single parent material, all with different parameters, with multiple material slots on a single merged static mesh, and performance is critical so duplicating a master material hundreds/thousands of times is not going to work.

Is there any workflow that supports this? Would that be an RFE situation to have the plugin automatically generate multiple material instances if it detects different 'unreal_material_parameter_*' attribute values on different prims?

Thanks!
User Avatar
Member
1 posts
Joined: May 2021
Offline
Hello,
I am new to Houdini my default material is coming out in this gradient color. So there is got to be something that I have turned on accidentally please help if anyone knows what's going on.

Attachments:
Screenshot (51).png (948.7 KB)

User Avatar
Member
4 posts
Joined: Aug. 2021
Offline
I have a similar question to this thread but the solutions do not really work for me.

What I have is a plane/cube that is copied multiple times with the copy to points node and on that plane I project a picture of a football player, in this case, as a texture. Through the naming of those pictures and a picNum attribute I created, I am able to show every copied to points plane with a different player picture. In Houdini this works perfectly. However, when I export the HDA to Unreal I only get one of the pictures copied to every plane, or if I create an instance I can get a second picture but if I try to have 3 or more, the pictures start repeating and mixing up. Looking from the geometry spreadsheet in Houdini, the right material pictures should be put on the right planes.

How can I fix this?

Attachments:
geometry spreadsheet.png (28.9 KB)
Houdini Unreal material.png (802.7 KB)
Unreal 1 instance.png (678.3 KB)
Unreal multiple instances.png (835.5 KB)
Unreal no instances.png (656.4 KB)

User Avatar
Member
5 posts
Joined: June 2022
Offline
I wrote a blog post - https://www.arctiem.com/post/creating-multiple-material-slots-in-unreal-using-houdini-engine-hda [www.arctiem.com] specifically about this problem. Let me know if it helps!
  • Quick Links