HDA won't create multiple material instances

   3241   4   1
User Avatar
Member
45 posts
Joined: Jan. 2016
Online
I have an HDA which is essentially a sphere partitioned into a number of sections. For each section (which might consist of a number of primitives), I would like to assign a different material instance with a different diffuse texture.

So, if I create a sphere with 8 sections (and for simplification here imagine each section is just one primitive), then here is what I have in my 'unreal_material_instance' attribute column:

Material'/Game/Materials/EarthHoudiniTile_0.EarthHoudiniTile_0'
Material'/Game/Materials/EarthHoudiniTile_1.EarthHoudiniTile_1'
Material'/Game/Materials/EarthHoudiniTile_2.EarthHoudiniTile_2'
Material'/Game/Materials/EarthHoudiniTile_3.EarthHoudiniTile_3'
Material'/Game/Materials/EarthHoudiniTile_4.EarthHoudiniTile_4'
Material'/Game/Materials/EarthHoudiniTile_5.EarthHoudiniTile_5'
Material'/Game/Materials/EarthHoudiniTile_6.EarthHoudiniTile_6'
Material'/Game/Materials/EarthHoudiniTile_7.EarthHoudiniTile_7'

And here is what I have in my 'unreal_material_parameter_diffuse' column:

Texture2D'/Game/Textures/A_0.A_0'
Texture2D'/Game/Textures/A_1.A_1'
Texture2D'/Game/Textures/A_2.A_2'
Texture2D'/Game/Textures/A_3.A_3'
Texture2D'/Game/Textures/B_0.B_0'
Texture2D'/Game/Textures/B_1.B_1'
Texture2D'/Game/Textures/B_2.B_2'
Texture2D'/Game/Textures/B_3.B_3'

I have created all those material instances in UE4, and they have a parameter called ‘diffuse’ which is a texture parameter.

Most of this seems to work - I get the geometry in, it has the right number of material slots, with materials assigned to them. However, only the first material is correctly created as an instance with the diffuse texture parameter set. All the other materials are directly linked to the UE4 materials I created, and the parameter is not changed. If I look in the HoudiniEngine/Temp folder there is just one material instance there, called ‘EarthHoudiniTile_0_instance_DFA94D48’.

So it seems like the first material slot has had it's material instance created, with the parameter set, but all the rest have been skipped somehow.

Is this a bug, or am I just going about this the wrong way?
User Avatar
Staff
534 posts
Joined: Sept. 2016
Offline
Hi,

Could you send us your hda so I can check that?

Your setup seems correct to me, it seems to me that the issue is more likely to be a limitation/bug of the current material instances attributes on the ue4 plugin.
User Avatar
Member
45 posts
Joined: Jan. 2016
Online
Sure, see attached. Thanks!

Attachments:
Sectioned_Sphere.hdalc (8.8 KB)

User Avatar
Staff
534 posts
Joined: Sept. 2016
Offline
Hi,

Your issue is actually due to a limitation in the current material instance attribute implementation, as it only supports one material for now. This was due to the fact that when applying those material instance attributes, the material slots and static meshes are already created, making it hard to match primitive attributes to those..

Tomorrow's daily build (16.5.345) will have a fix for this, helping in supporting multiple material slots to the material instance attribute system, but this should still be considered an edge case and not fully supported by the plug-in.

Let me know if it fixes your issue.
User Avatar
Member
45 posts
Joined: Jan. 2016
Online
Hi,

I had to leave this part of my project for a while and I'm now just coming back to it, thanks for your response (and the fix!) and sorry for the slow response.

However, I'm having a slight issue with this now:

When I bring in the Sectioned Sphere HDA with only 1 subdivision, it assigns all the textures correctly, but if I change then subdivisions to a higher number (as I need to), then it doesn't correctly assign the “diffuse” parameter to the correct texture any more. I have attached a UE4 project for you to take a look at. You'll see that when Subdivisions is set to 1, the top row of textures run A0 to A3 and the bottom row run B0 to B3. However, setting the Subdivisions to 2 or higher, the bottom row now also runs from A0 to A3.

Looking at the HDA in Houdini, in the geometry spreadsheet it does seem like the values are correctly assigned there, so I'm not sure where the error is creeping in.

It's not an insurmountable problem for now, as I can just go through and manually change all the diffuse assignments for the lower row myself, but I'm hoping to be able to automate the creation of a sphere with a large number of tiled texture assignments in the future, where manually changing them will be annoying.

Any idea what's happening here?

Attachments:
HDA_Test2.zip (4.2 MB)

  • Quick Links