How to preserve Multi Sub Object Material ID Order with Alembic Export

   15546   12   4
User Avatar
Member
18 posts
Joined: 3月 2017
Offline
Hi there!
Do you guys have an idea how to preserve the order of my Material ID's when I export my Alembic file back to 3ds Max?
I need this for a building destruction simulation later on. I'm quite new in Houdini.

In Max I created a building and applied a multi sub object material with 20 materials and named them _1, _2, _3, _4 … (According to this video: https://vimeo.com/113366813). [vimeo.com]

Then I imported the Alembic file in Houdini and unpacked it. The object consists of the exact amount of prim groups that I had previously created as materials. And the prim groups are correctly applied and named.

But then it comes: when I export my model back to max, the face IDs are basically correct but the id numbers are totally messed up when I apply the previous multi sub object material.

How can I tell Houdini to export the face ID's in the correct order or what do I need to do? Is there another better workflow maybe?

Thank you very much in advance!
Edited by Qwertzus - 2017年3月16日 17:47:54
User Avatar
Member
16 posts
Joined: 12月 2016
Offline
+1
User Avatar
Member
1 posts
Joined: 10月 2012
Offline
+1. Any body now how fix this problem ?!). thnx
User Avatar
Member
18 posts
Joined: 3月 2017
Offline
Hi, I solved it.

The solution is to create single objects according to every single Material ID in the Multi/Sub-Object Material.
For example: You have an object with 5 Material IDs and a matching Multi/Sub-Object Material with 5 Slots. Detach all faces which have the same ID and name the new object like the material ID.

Object with 5 IDs means 5 detached objects: 001, 002, 003, 004, 005.
It's important to preserve the correct order as in the Multi/Sub-Object Material.
001 has Slot 1
002 has Slot 2
003 has Slot 3


You can automatize this process with several maxscripts (Scriptspot).

Then select all numbered objects and export them as Alembic.

In Houdini Alembic SOP check “Load As -> Unpack Alembic..”
and “Primitive Groups -> Name Groups Using Shape Node Name”
You can see the groups by middle click the Alembic SOP now.

On Export just make sure you export only the groups you imported. So the ID order stays intact.
Then apply the Multi/Sub-Object Material and you should see the correct IDs.
User Avatar
Member
11 posts
Joined: 3月 2012
Offline
I know it's an old topic, but I managed to to import ABC files made with Houdini into 3ds Max, and get the Material ID working, in a convenient way.

The trick is to have Prim Groups setup in Houdini, with names like this:
_0 _1 _2 _3….

After exporting to alembic, and importing to 3ds max:

Prims grouped _0 will become Material ID 1,
Prims grouped _1 will become Material ID 2 and so on.
Edited by Pawel_Grzelak - 2019年9月27日 10:27:06

Attachments:
2019-09-27 16_19_24-C__Users_massivedesign_Desktop_Arktura Panele_panel_A.hip - Houdini Core 17.5.36.png (27.9 KB)

User Avatar
Member
18 posts
Joined: 3月 2017
Offline
Yes this works. But:
Not as soon your IDs have more than 1 digit.
If you have IDs beyond _9, lets say, _12 there will be chaos.

That's why I still need to split the model and rename each Object according to its Material ID. This is how I force Houdini to export it back correctly.
User Avatar
Member
2 posts
Joined: 7月 2017
Offline
While I was searching about this topic I found out that the groups are in alphabethical order. So in your case if you want to go up past 9th multisub you can rename 1 2 3 to a b c d …. z so that you have material id's as much as the alphabet . I hope this works after 3 years
User Avatar
Member
191 posts
Joined: 10月 2018
Offline
From my experience, max brings in groups and attributes in an ordered list so this applies to attributes as well. But the last few versions of max I heard they changed the alembic importer to be a little smarter and recognize the last integer value of a prim group and assign that to the polygon material id. Vray proxy loaders function differently though. But you can have as many id's as you want if you just give the numbers padding, ie: _00 _01 _02 … _10 _11

The attributes have their own caveats though when going to max which would be nice if they could address those in the future..
User Avatar
Member
18 posts
Joined: 3月 2017
Offline
Yes the Alembic workflow got a lot better since 3dsMax 2019. It now supports a bunch of custom Alembic attributes.
So there is no need anymore for the hacky Material ID method

Material IDs got a lot easier: For example, if you name your primitive group “group_12” in Houdini, the faces will get material id 12 in 3dsMax.

If you need more custom attributes, all you must do is check the attributes you want to export in Max (e.g. Material Name).
In Houdini use the Alembic Import SOP and check “User Properties: Load Values and Metadata”. You should now see "abc_userProperties“ and ”abc_userPropertiesMetadata".
Then use a bit of Python to extract the data to use it in Houdini. You can find more information here: Alembic extension functions [www.sidefx.com]

Before export you must bring your Alembic attributes back to the 3dsMax specific json format in the beginning. This means you need to exactly export "abc_userProperties“ and ”abc_userPropertiesMetadata".
In case of the Material Name you can just write a litte maxscript to automatically re-assign the materials to the imported alembic objects.
User Avatar
Member
191 posts
Joined: 10月 2018
Offline
Using the abc_userProperties and MetaData seems to only keep track of object level properties and not vertex or polygon level attributes. Have you come across anything to keep those consistent when saving out alembics from Houdini?

Currently, I've found that the “uv” attribute gets special mapping in Max as well as the first color type attribute. Otherwise the attributes get brought in alphabetically like the old groups used to, which can be problematic for multiple uv map channels. I've been cleaning all attributes before exporting from Houdini and keeping them alphabetically consistent to make sure they import correctly. ie: attributes _map_02, _map_03, _map_04, uv, v

I didn't find any logic on import into Max that will associate any extra uv channels to their corresponding map channel.
User Avatar
Member
18 posts
Joined: 3月 2017
Offline
Vertex Color gets imported as “Max_Vertex_Color_Map0” you can remap this to Cd in the Alembic SOP before.





And you can see all the attributes as soon you unpack the alembic file e.g. with the Unpack SOP.
Here you can also see that vertex color is now called “Cd”, because I converted it earlier.



The default UV Channel is imported as “uv” all additional UV Channels are named “Max_Map_Channel_2”, “Max_Map_Channel_3”, “Max_Map_Channel_4”, etc.

Houdini is handling UV Attributes as a 3-Float Attribute. The UV0 Channel is imported correctly as “uv” 3-Float Attribute. But any additional UV Channels are being imported as 2-Float Attributes along with a local variable which has the same name as the attribute.

In order to work with them correctly they need to be converted to 3-Float Attributes and the local variable needs to be reapplied to export it correctly in the end. (e.g. with an Attribute Create SOP)

This is I came up with the UVs… but there must be a more elegant way
Edited by Qwertzus - 2020年4月15日 06:31:25
User Avatar
Member
191 posts
Joined: 10月 2018
Offline
It seems the local variables work for the extra uv map channels, but not for the vertex colors. ie: Max_Vertex_Color_Map_1 3flt (Clr) → Max_Vertex_Color_Map-1 doesn't get mapped to -1:Illum. I know it's not real common to use the -1 and -2 color channels in Max, but thought I would include it for more testing.

I've also been trying to make a uniform workflow because some other artists we pass alembics to might import them directly or use VRay Proxy Loaders, which seems to be pretty basic in it's approach to handling the channels. From what I can tell, it just assigns the channels in alphabetical order of the list it gets with the exception of putting “uv” in channel 0. It doesn't make any channel links like the regular import.
User Avatar
Member
79 posts
Joined: 9月 2014
Offline
- can't get the "Max_Map_Channel_2" to work
a Demo Scene would be very welcome
  • Quick Links