Community
Arnold for Houdini Forum
Rendering with Arnold in Houdini and Solaris using the HtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Houdini Alembic Packed Primitives and material attributes

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
fxnut
6579 Views, 10 Replies

Houdini Alembic Packed Primitives and material attributes

Hi guys,

In Houdini it's possible to use the Material SOP to assign materials to primitives on geometry. If I save this out as an Alembic and bring it back in unpacked, this works.

Unfortunately, it doesn't seem to work if you try to render with the Alembic as a Packed Primitive (I'm using Arnold 5.1 with the new Alembic Packed Primitive support). I've tried setting the Material SOP to use detail attributes instead, but still no luck.

I've also not been able to find a way to set a material for the entire Alembic Packed Primitive using an attribute (i.e. not on a per poly basis, but for the whole Packed Primitive). Is there a way of doing this?

Thanks,

Andy

10 REPLIES 10
Message 2 of 11
julian.hodgson
in reply to: fxnut

Hi Andy,

I've included the packed.zip for some example files.

The simplest way to work is show in the packed_primitive.hip it shows how you can assign the shop_materialpath attribute per packed primitive (for example with the Material SOP). These materials are then translated and assigned by HtoA.

For the case when you want the assignment in the alembic file, operator_assigment.hip scene shows how you can export an alembic file with the shop_materialpath attribute in the file, bring it back into houdini and assign a material using operators.

Using the set_parameter ROP you can select shapes and update the shader connection to the names defined in the alembic file:

1564-set-parameter.png

Note you will have to force translation of the materials with the Forces Materials parameter on the Arnold ROP, and make sure no materials are assigned to the OBJ with this work flow.

You'll have to render the alembic files from the ROP in the first place (they're not in the zip file).

Please tell me if this works for you, and let me know if you have any questions.

Cheers,

Julian

Message 3 of 11
fxnut
in reply to: fxnut

Hi Julian,

Thanks ever so much for replying. I've just been testing this out this morning.

packed_primitive.hip

Yes, this works. Definitely useful to be able to specify the shop_materialpath attribute for each object. Unfortunately, that only solves half the problem for me as I can't apply the attribute on a per-primitive (polygon) basis. So for example, in your scene, what if I wanted to have half the torus red, and the other half green? If I use the Material SOP to apply the material as a per-primitive attribute, it crashes the renderer. Is there a way around this that I'm missing?

For the syntax in the "Selection" parameter for the Set Parameter ROP, is this documented somewhere? I found this page (https://support.solidangle.com/display/A5AFHUG/Set+Parameter) but it doesn't introduce any of the concepts you've used in your example.

One other thing, is it possible to use the Set Parameter ROP to drive the "opaque" flag in the same manner using an attribute? Again, is this possible to do on a per polygon basis?

operator_assignment.hip

Was this to illustrate how to set materials on existing packed primitives? Yep, that's all good. Thanks for that.

Cheers!

Andy

Message 4 of 11
julian.hodgson
in reply to: fxnut

Hi Andy,

You can find documentation for the operator selection and assignment syntax here:

https://support.solidangle.com/display/A5AFHUG/Operators.

We intend to support per primitive or faceset assignment soon from the alembic file.

However you can change the opaque value on a shape using operators now:

1628-opaque.png

and once we have the faceset support this could extend to polys.

Also the next HtoA release should allow per primitive assignments of shape attributes per packed alembic primitive, including opacity.

Message 5 of 11
fxnut
in reply to: julian.hodgson

Perfect. Thanks Julian!

Message 6 of 11
Anonymous
in reply to: fxnut

Hi Julian, can you please update that ZIP file and show how you intended to use

set_parameter ROP in this case?

I did try to create it base don your description, but ending up with

C0000005 error

untitled1.zip

Message 7 of 11
Stephen.Blair
in reply to: Anonymous

I repro the crash, and I think it's because material isn't assigned to the object, but to the polgyons (for facesets or whatever it is in Houdini).

If export and expand the ass I see

 declare shop_materialpath uniform STRING
 shop_materialpath 288 1 STRING
    "/obj/shopnet1/red"
  "/obj/shopnet1/red"
  "/obj/shopnet1/red"
  "/obj/shopnet1/red"
  "/obj/shopnet1/red"


// Stephen Blair
// Arnold Renderer Support
Message 8 of 11
julian.hodgson
in reply to: fxnut

Were you missing the alembic file? Try this 210.zip file from out test suite.

Cheers,

Julian

Message 9 of 11
Anonymous
in reply to: fxnut

Thank you Julian. i was aware of creating abc first. Your scene works, if i use alembic from my scene, doesnt work, if i take your alembic into my scene doenst work. Seems i will have to do some debugging and try to figure out, whats going on, as both scenes looks the same.

Message 10 of 11
Anonymous
in reply to: fxnut

Ha. i see what is the problem. Sorry this might be little long. Will send it to your email as well, Julian.

Attaching new zip with all the nodes in it.

If you export source_no_shader (renders gray - no shader) and render resulting abc with set_parameter, it will render without the shader (gray) as there were no shader assigned. - correct

If you export source_shader (materials assigned on OBJ level and renders in IPR as expected) and render ABC with set_parameter, it will not render any material (gray). Strange, but makes sense, as materials on OBJ level doesnt create attribute shop_materialpath. But almost noone is assigning materials on OBJ level, as almost noone is using OBJ level with alembics. - correct

If I export source_no_shader_prims (this does not render by it self, as shop_materialpath is wrongly setup - see * for explanation) and try render with set_parameter im getting the C0000005 error. If i use your ABC file, it works as expected. They do both unpack to polysoups. No idea why my exported file is crashing, yours fine.

If i export source_shop_materialpath, with correct use of material node (renders fine in IPR) and render abc with set_parameter, it renders pink. Assume that due the missing /utility1 that is needed for set_parameter, but this cant be used with material node, as it doesnt render in IPR.

There is also difference how those ABC are exported. If i export it with no materials, materials on top level they do unpack as polysoups. If i export abc with shop_materialpath being primitive attribute they do unpack as polygons.

* is wrongly setup as its Detail attribute, not primitive attribute. Also the link is bad as it should be "/obj/shopnet1/red" not "/obj/shopnet1/red/utility1". shop_materialpath is attribute created by the "material" node, that most of us use for assigning materials. If i correctly change it (see /obj/source_no_shader_prims/geo1) to primitive attribute and remove utility1 from link, it render in IPR. but doenst render when exported to alembic due to the C000005 error. geo1 it self cant be rendered back with abc, but renders pink. Geo2, geo3 dont render backs as abc due the c00005

Hope it helps in some manner. From what i discovered, it will not work as set_parameter needs different string link in shop_materialpath compared to shop_materialpath stirng created by the material nodeshopmaterialpath.zip

Message 11 of 11
pachatlantide
in reply to: fxnut

EDIT: with the latest Arnold, checking  "Export referenced Materials" in the Arnold ROP seems to do just that.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report