Author Topic: Choosing specific elements for CXR  (Read 1416 times)

2024-06-25, 16:00:46

RecentSpacesSam

  • Active Users
  • **
  • Posts: 92
    • View Profile
There was some discussion in this thread https://forum.corona-renderer.com/index.php?topic=35535.15 that for Cryptomatte it would be beneficial to only output that element into a .cxr file, whilst saving the other elements out in another format in an effort to prevent the file from being larger than necessary.

We're investigating using Cryptomatte more in our workflow (even more so now material masks are supported) and huge CXR files could potentially be a big stumbling block.
I appreciate this may be too late for 12 but in future versions is there a chance this might get looked at again in the future?

2024-06-26, 11:35:01
Reply #1

RecentSpacesSam

  • Active Users
  • **
  • Posts: 92
    • View Profile
Reading my post back I felt the need to clarify a few things.

My main reason for wanting this is to be easily able to use Cryptomatte in Fusion.
This already works but the downside is that you have to use a monster sized CXR file for it to work as currently the cryptomatte metadata doesn't get written into normal EXR's (not sure if this is the same across other renderers).

Generally one multi-layer EXR's is slower to load than several individual layers which slows down an artist's ability to work and increases comp render times.

Two possible solutions:
1. Implement functionality similar to 3DS Max's default exr setup, where individual passes can be added/removed and their bit-depth changed per element
2. Write cryptomatte metadata/manifest information to the Cryptomatte render element so that all passes rendered to separate files.

2024-06-26, 15:19:10
Reply #2

Ink Visual

  • Active Users
  • **
  • Posts: 173
    • View Profile
+1

As I already posted in the Cryptomatte Playground thread linked above, I would love to see improvements to the way CXR is saved, and fully support RecentSpacesSam proposed solutions.

« Last Edit: 2024-06-26, 15:25:59 by Ink Visual »

2024-06-26, 16:03:55
Reply #3

piotrus3333

  • Active Users
  • **
  • Posts: 267
    • View Profile
Reading my post back I felt the need to clarify a few things.

My main reason for wanting this is to be easily able to use Cryptomatte in Fusion.
This already works but the downside is that you have to use a monster sized CXR file for it to work as currently the cryptomatte metadata doesn't get written into normal EXR's (not sure if this is the same across other renderers).

Generally one multi-layer EXR's is slower to load than several individual layers which slows down an artist's ability to work and increases comp render times.

Two possible solutions:
1. Implement functionality similar to 3DS Max's default exr setup, where individual passes can be added/removed and their bit-depth changed per element
2. Write cryptomatte metadata/manifest information to the Cryptomatte render element so that all passes rendered to separate files.

in general what you need for fast exr read is multipart exr (requires exr 2 support). software reads only one part (so one render element) and not the whole file.
assuming you are using cryptomatte plugin from Reactor - this one does not support multipart exrs - so you end up with two exrs per frame (multipart and non-multipart for cryptomattes)

you can basically edit the cxr file (LifeSaver plug for Fusion or Photoshop + Natron I guess), use better compression for colour data (dwab should be ok for LightMix), keep crypto at 32bit.
will save you a lot of disk space.
Marcin Piotrowski
youtube

2024-06-27, 14:23:35
Reply #4

RecentSpacesSam

  • Active Users
  • **
  • Posts: 92
    • View Profile
Once again thanks for the detailed reply Marcin!

I had a look at LifeSaver and its counterpart pioSaver, unfortunately Lifesaver won't work for Cryptomatte as it only saves out to multi-part EXR's and neither option saves in the cryptomatte metadata.

Unless I've missed a step, for now we may still be stuck with creating two renders (beauty elements vs. masking/utility elements) but being able to re-order the render into multi-part will no doubt be a huge help, especially with the smaller sizes DWAB brings

2024-06-27, 16:48:49
Reply #5

piotrus3333

  • Active Users
  • **
  • Posts: 267
    • View Profile
deleting layers from cxr in Photoshop and resaving (tested with proEXR plugin) will get you a file with just cryptomattes.
Marcin Piotrowski
youtube

2024-06-27, 22:06:37
Reply #6

Ink Visual

  • Active Users
  • **
  • Posts: 173
    • View Profile
Thanks Marcin, we will try that on our end as well! Unfortunately it doesn't sound like a great workflow for animations though, for this we would still need better cxr management at render output stage.

2024-06-28, 10:35:44
Reply #7

piotrus3333

  • Active Users
  • **
  • Posts: 267
    • View Profile
Thanks Marcin, we will try that on our end as well! Unfortunately it doesn't sound like a great workflow for animations though, for this we would still need better cxr management at render output stage.

??
this is about animations first. you can probably handle cxr files for few stills just fine but in case of animations this is not realistic at all.
now there is a question of speed of batch processing cxrs in Photoshop but if this is the tool you have - it will work.
Marcin Piotrowski
youtube

2024-06-28, 10:56:11
Reply #8

RecentSpacesSam

  • Active Users
  • **
  • Posts: 92
    • View Profile
Thanks Marcin.

Handy to know for PS, although the ease at which you can re-render a mask for a still means Cryptomatte isn't required as much.

A few tests I tried in Fusion:

1.
exporting just the beauty element from the cxr/exr using a default saver - reduces file size and keeps the metadata.
exporting all of my other passes using pioSaver - reduces file size but loses the metadata
Unfortunately copying the metadata from the single-layer exr into the pioSaver multi-channel-exr doesn't work with the cryptomatte node

2.
rendering a cxr with "Render Only Masks" enabled and only the channels I wanted (crypto/worldPos/normals). Unfortunately you can't get masks from this.

3.
saving a multi-layered exr from max including all the channels at various bit depths and copying the meta-data from the re-saved cxr/exr - unfortunately this also did not work.

I do wonder if this is partly a limitation of Cryptomatte in fusion but based on this I think the best solution would be for Corona to allow users to choose the specific elements to be CXR'd along with bit depth & compression.

This would allow us to have compressed beauty elements at 16bit with beauty & crypto saved together and other elements left at 32bit.

2024-06-28, 11:34:09
Reply #9

piotrus3333

  • Active Users
  • **
  • Posts: 267
    • View Profile
Thanks Marcin.

Handy to know for PS, although the ease at which you can re-render a mask for a still means Cryptomatte isn't required as much.

A few tests I tried in Fusion:

1.
exporting just the beauty element from the cxr/exr using a default saver - reduces file size and keeps the metadata.
exporting all of my other passes using pioSaver - reduces file size but loses the metadata
Unfortunately copying the metadata from the single-layer exr into the pioSaver multi-channel-exr doesn't work with the cryptomatte node

2.
rendering a cxr with "Render Only Masks" enabled and only the channels I wanted (crypto/worldPos/normals). Unfortunately you can't get masks from this.

3.
saving a multi-layered exr from max including all the channels at various bit depths and copying the meta-data from the re-saved cxr/exr - unfortunately this also did not work.

I do wonder if this is partly a limitation of Cryptomatte in fusion but based on this I think the best solution would be for Corona to allow users to choose the specific elements to be CXR'd along with bit depth & compression.

This would allow us to have compressed beauty elements at 16bit with beauty & crypto saved together and other elements left at 32bit.

are you copying metadata with CopyMetadata node in Fusion?

are you able to test the speed of Photoshop batch action processing 10 cxr frames (real production size obviously) and deleting everything but cryptomattes? maybe it wouldn't be a deal breaker.

this is the cryptomatte metadata that I suppose should be retained:
Marcin Piotrowski
youtube

2024-06-28, 17:11:57
Reply #10

RecentSpacesSam

  • Active Users
  • **
  • Posts: 92
    • View Profile
Yep, using the copy metadata node. I imagine it's because the Cryptomatte fuse is expecting the elements to appear in a certain order but re-shuffling with pioSaver returns them differently, who knows.

I haven't tested a PS action yet but it's on the radar.

2024-07-02, 13:46:23
Reply #11

piotrus3333

  • Active Users
  • **
  • Posts: 267
    • View Profile
Yep, using the copy metadata node. I imagine it's because the Cryptomatte fuse is expecting the elements to appear in a certain order but re-shuffling with pioSaver returns them differently, who knows.

I haven't tested a PS action yet but it's on the radar.

to save multichannel exr from Fusion you need to pack channels you need into Fusion's auc channels like Z, mat ID etc.
not convenient and efficient at all.

since Natron is a no go (metadata is lost) - similar free solution would be Gaffer. just delete some channels and write new exr.
Marcin Piotrowski
youtube

2024-07-02, 18:40:32
Reply #12

RecentSpacesSam

  • Active Users
  • **
  • Posts: 92
    • View Profile
Fantastic, that does exactly what I need! I've never really looked into Gaffer as it didn't seem like it would be useful (for arch-vis at least) but the automation stuff could be really cool.

2024-07-22, 10:26:43
Reply #13

Avi

  • Corona Team
  • Active Users
  • ****
  • Posts: 634
    • View Profile
We have this logged as feature request.

(Report ID=CMAX-190)
Arpit Pandey | chaos-corona.com
3D Support Specialist - Corona | contact us