Materials lost when sending Maya geometry through houdini

   12928   18   3
User Avatar
Member
32 posts
Joined: Aug. 2014
Offline
Hi,

I've been trying to create assets for geometry processing inside of Maya and it seems like all material bindings are lost after creating the asset.
I created a null-asset for geometry processing (doing only an empty attribute wrangle).
When sending a mesh through the asset it inside of houdini all material bindings are preserved but when importing the asset in Maya and sending an object with materials through it comes out with lambert1 assigned.

Is it possible to send a geometry with materials through a houdini asset and have them preserved?
User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
The material information from Maya is not translated into the asset. This means when the asset outputs the geometry, there's no information on what the “original” material is. So Maya materials can't be preserved at the moment.

What we probably need to do is pass some information into the asset. Then, when the mesh node is created for the output by sync, we'll use this information to replicate the material. Off the top of my head, this could be done in two ways. Both are quite similar:
1) Store the name of the input Maya node as a detail attribute. Then when the output nodes are created by sync, it can find the input Maya nodes and use it as reference nodes to assign materials to the output nodes.
2) Store the material names directly as primitive attributes (and maybe detail attributes). Then, when the output nodes are created by sync, use the attributes to assign the materials to the output nodes.
Andrew / アンドリュー
User Avatar
Member
32 posts
Joined: Aug. 2014
Offline
Thanks for your answer!
User Avatar
Member
6 posts
Joined: Oct. 2019
Offline
I like the second option because it could give the opportunity to play about with the material names in the asset.
User Avatar
Member
29 posts
Joined: Feb. 2015
Offline
Is this an update we can expect soon? If not, has anyone found a work-around yet?
User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
I don't have a chance to work on this yet, unfortunately.
Andrew / アンドリュー
User Avatar
Member
29 posts
Joined: Feb. 2015
Offline
And am I correct in gathering that there still is no way of sending maya attributes through (other than color)? I've gone through the forums and such and haven't found any successful attempts.
User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
NakedChicken
And am I correct in gathering that there still is no way of sending maya attributes through (other than color)? I've gone through the forums and such and haven't found any successful attempts.

Yeah, there's no way send arbitrary attributes at the moment. It would be a good feature to have though.
Andrew / アンドリュー
User Avatar
Member
29 posts
Joined: Feb. 2015
Offline
Agreed.
As a workaround I saw that people were using Alembic exports to bring arbitrary attributes across. Apparently this used to work, but not so in 14 (which I am indeed seeing, can't get it to work no matter what I try). Anyone found a way to make this work in the newest Houdini?
User Avatar
Member
818 posts
Joined: Sept. 2013
Offline
NakedChicken
As a workaround I saw that people were using Alembic exports to bring arbitrary attributes across. Apparently this used to work, but not so in 14 (which I am indeed seeing, can't get it to work no matter what I try). Anyone found a way to make this work in the newest Houdini?

Hm, I gave it a quick test just now, and it seems to work. See the attached zip file. In the scene file, there's a sphere (test_sphere) that has a point attribute “foo”. I exported the sphere into an Alembic archive. Then, read it back with an asset. In the asset's sphere, the “foo” attribute is imported back into Maya.

Maybe you didn't unpack the geometry after loading the Alembic file into the asset? When Houdini import the Alembic archive, the custom attributes (and other things) are “packed” away inside the primitive. Since you need access to the custom attributes, you'll need to “unpack” the geometry.

Attachments:
test_alembic.zip (10.8 KB)

Andrew / アンドリュー
User Avatar
Member
33 posts
Joined: Sept. 2014
Offline
hi all, its been a long time and the houdini engine still weak for maya, anyway, im trying to create an asset for maya through houdini engine that doesnt lose materials after reload asset as you discussed above but i dont understand how to make it correct cuz its not working
i even found this doc, still dont get it, i created an attribute s@shop_materialpath = “test”; from wrangle, and it supposed to link to the same name of material when i load this asset in maya? or no?
https://www.sidefx.com/docs/maya/_maya__material.html [www.sidefx.com]

awong
could you please send a hip how did you make it? would be awesome!
if you still work in houdini after all these years
User Avatar
Member
146 posts
Joined: Oct. 2017
Offline
Take a look at the spaceship example (on Orbolt) This should come into maya with a phong shader with mapped color, and transparency and some other attributes. Note that the textures/colors do need to be baked out as maps, so that Maya can access them as file textures.
User Avatar
Member
33 posts
Joined: Sept. 2014
Offline
thanx i found, but there is just a default phong shader, it creates by default, i made it before, but our artists uses a vray, and it needs to be vray material, i dont know how this phong shader works with vray, and i hoped maybe there is a way linked some custom materials on asset and without loosing it after reload, i tried extract outside geo Material parameter to an assets that we could pick it in maya, but it didnt work cuz maya doesnt recognize this input as a material, only for mesh stuff

and even more problems, after reload an assets it creates a new shader and material phong every time, so if u reloaded it hundreds times there will be a hundred shaders
Edited by Konstantin Kovalenko - April 12, 2019 03:15:56
User Avatar
Member
146 posts
Joined: Oct. 2017
Offline
You're right, there is currently limited support for creating Maya shaders to match Houdini shaders. I've entered a bug for failure to delete old shaders, and an RFE for support for Vray shaders. Oddly enough, the docs say that we create a blinn shader and not a phong, so I will update that as well.

If you want to preserve information about edits that have been made to the asset's outputs and reapply them after sync, you can use the preSyncCallback to cache the information, and the postSyncCallback to re-apply the edits.
User Avatar
Member
33 posts
Joined: Sept. 2014
Offline
Cool, at least we have callbacks, but is there an example how to use it? im not so strong in scripting especially mel, python sometimes is ok
User Avatar
Member
146 posts
Joined: Oct. 2017
Offline
There's an example in the maya scripting doc, although it deals with caching and restoring parm state, rather than output state.

https://www.sidefx.com/docs/maya/_maya__scripting.html [www.sidefx.com]
User Avatar
Member
33 posts
Joined: Sept. 2014
Offline
Thank you. but actually i saw it, and i didnt get how to use it properly, i mean where to put those scripts, i know there is Callback Script inside asset in houdini assets, but im not sure this is it, and if so what to put here?

we have three scripts and where to put each one? this is the main question
User Avatar
Member
146 posts
Joined: Oct. 2017
Offline
Oops, sorry, those callbacks go on the Maya side rather than the houdini side of the asset. I will make that clearer in the documentation. The names of the mel scripts go in string attributes on the asset node in maye, the scripts themselves should go in mel files of the same name somewhere on your MAYA_SCRIPTS_PATH. You can find the attrs in the AssetCallback block on the asset node in the Attribute editor.

I agree, in a lot of ways it would be more convenient if the scripts themselves could be encapsulated in the asset itself (e.g. as default parm values or something) But the you get into a chicken-and-egg kind of problem. You can't run the scripts from houdini since engine is always running out-of-process, and you can't get at the parms until the asset has been sync'd. So you're forced to do at least one sync before having access to the scripts anyway.

Having the procs be normal mel scripts in normal mel files does make it easier to debug the scripts and to share them between scenes and assets, and avoids the risk of having multiple assets with different variants of the same script.
User Avatar
Member
146 posts
Joined: Oct. 2017
Offline
The proliferation of output materials when there is a file texture present has been fixed in 17.5.230.
  • Quick Links