anderslanglands / alShaders2

BSD 3-Clause "New" or "Revised" License
75 stars 38 forks source link

crypto_material naming in HtoA #13

Closed martinkindl83 closed 7 years ago

martinkindl83 commented 7 years ago

Currently the default crypto_material outputs long path to material node including some subnodes /obj/alembic1/SHOP_tx_versions/MAT_mat_body/arnold_with_ids/passthrough1

In original release of crypto inside the ALS shaders its used to be same as shop_materialpath attribute that is used in houdini to assigns the shader so above value would be /obj/alembic1/SHOP_tx_versions/MAT_mat_body

can we also incorporate naming stripping (similar to Maya namespace stripping) that would output only shader name and not whole path? i.e. MAT_mat_body

good naming is very handy in rare cases where 2D is forced to pick matte based on name, not manual selection.

We are forced to use custom crypto to do it for us, and this making .ASS files double in size as its per primitive assignment.

jonahfriedman commented 7 years ago

So there's two things here - going back how it was and dealing well with HtoA naming.

  1. Going back how it was

Here's how this works: Cryptomatte doesn't do anything in the Houdini scene, and only does stuff in the Arnold scene, so its starting point is how HotA structured and named the objects. The Cryptomatte AOV shader looks at what object is rendering, and which shader is assigned at that sample. In your example you have a passthrough shader at the head of your tree, so that's what's assigned, and name is the name that HtoA gave it, so that's the name we have available.

How this used to be in Arnold 4 was kind of mess. If there were multiple shaders on a mesh, during sampling there wouldn't be any way to tell one which one was running (Solid Angle fixed this in Arnold 5), so it would have to use its own name during sampling. That name would often not be the name we put in the manifest. You may have some rose colored glasses on...

This is all a bit academic, but the short version is there's no way to go back to how it was, nor should we want to.

  1. Houdini name parsing

There's work to do here. There's a thread on the HtoA list about Houdini-style Cryptomattes specifically about that, so I think that's probably the right place to discuss this. Btw, recently Sen Haerens contributed name parsing for Cinema 4D style naming.

If you want to contribute to this, here's how: Put together a bunch of real-world use cases in Houdini, turn off all the namespace stripping options, and see what kind of names you end up with for objects and materials. Figure out what kind of naming you end up with for at least the most common workflows. Those names will essentially be the raw material for processing into useful identifiers. Post your results (on the e-mail thread I think, as it'd be good to get HotA users to weigh in on whether these represent their workflows as well).

martinkindl83 commented 7 years ago

Thank you Jonah for your explanation. Add 1 - this makes total sense now, BUT:

If i export Ass file i will get:


polymesh { name /obj/sphere_object1:polygons matrix 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 shader "/shop/arnold_with_ids1/arnold_with_ids/OUT_material:surface"


Why we cant use shader name (as above) instead what we are using now? sorry it its obvious and im missing something.

jonahfriedman commented 7 years ago

And if you turn off material namespace stripping, and you render that object, you don't get the material name "/shop/arnold_with_ids1/arnold_with_ids/OUT_material:surface"?

martinkindl83 commented 7 years ago

Turning it OFF doesnt seem to have any effect. Not mentioning that in above ass file im getting "/shop/arnold_with_ids1/arnold_with_ids/OUT_material:surface" but in crypto im getting "/shop/arnold_with_ids1/arnold_with_ids/passthrough1"

jonahfriedman commented 7 years ago

Martin,

I don't know why it's different, except that an ass file is not exactly the same thing as an Arnold scene. That parameter on the polymesh node is not a string, it's only represented as a string in the ass file.

I've told you how you can contribute if you want to. Closing.