anderslanglands / alShaders2

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

Metadata missing when using multiple drivers #9

Closed SenH closed 7 years ago

SenH commented 7 years ago

There is an issue when you attach the Cryptomatte AOVs to multiple drivers where one of them is not driver_exr. In the following screenshot I attached the Cryptomatte AOVs also to the IPR driver so I can verify them in the IPR.

drivers

When you render this scene out the Cryptomatte AOVs are showing up in the EXR but the metadata is missing which is confusing since the Cryptomatte gizmo does not work in that case.

Here is an example ass file: cryptomatte_multi_driver_metadata.ass.gz I changed the driver_c4d_display to driver_tiff because IPR drivers are not exported. When you render this out without 2f2c7c9 you will see all AOVs are rendered out but the Cryptomatte metadata is missing from the EXR.

2f2c7c9 changes the logic so the metadata is always compiled even if only one of the drivers supports metadata. We're still protected by the check_driver function in various places so that the metadata is only written to supported drivers. https://github.com/anderslanglands/alShaders2/blob/master/cryptomatte/cryptomatte.cpp#L468

@jonahfriedman I was curious about the already_has_crypto_metadata_* user parameter. Can you explain what it does?

jonahfriedman commented 7 years ago

Thanks for that fix as well. When I fixed it for multiple drivers, I forgot that some of them might not be EXR drivers.

The already_has_crypto_metadata_ user data is a flag that says that a driver has already been processed and has metadata written to it, to avoid doing it again. It gets the name of the Cryptomatte appended to so it only applies to one cryptomatte (when things work correctly). I think with progressive renders and in the DCCs the Arnold universe is not always destroyed between renders, so it's best to check. Arnold runs in a lot of different contexts after all. I don't remember what the issue was that caused me to add it in the first place.

SenH commented 7 years ago

Really glad to participate and contribute back. Thank you for open sourcing it in the first place!

When I tested it yesterday already_has_crypto_metadata_ user parameter set on a driver did still work.

jonahfriedman commented 7 years ago

Ah- that's not meant for users, it's creating that user data to communicate with itself. It creates that user data, for example already_has_crypto_metadata_crypto_object, so that it knows that crypto_object metadata has already been written to that driver.

jonahfriedman commented 7 years ago

This issue is fixed, closing. Thanks!