Author Topic: Shadowcatcher for compositing - png vs exr  (Read 3842 times)

2018-01-16, 18:02:56

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12754
  • Marcin
    • View Profile
I need help with:
-explanation what is going on here (technical reason)
-deciding whether this is a bug or expected

Super simple task: you render a bunch of object on a solid background, then you want to open your file in Photoshop (or proper compositing app) and replace the background - for example with an image, or with a different solid color.

So that's a basic case where shadowcatcher in "for compositing" mode makes sense.

Let's set up a basic scene, render it out, and save the result with alpha channel.
Let's save two versions:
1) in .exr format (32 bit, alpha included)
2) .png (24 or 48 bit, it produces same result, alpha included)

We end up with two *similar* looking images.
We open the png version in PS, add a solid layer of whatever color, save.
We open the exr version in PS, add a solid layer of whatever color, save.

We end up with two images with different brightness in shadows/reflections. Why?

Archive with images and scene: https://www.dropbox.com/s/sf99dy0x2prts85/shadowcatcher-darker-shadows-png.zip?dl=0
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2018-01-16, 18:40:44
Reply #1

sprayer

  • Active Users
  • **
  • Posts: 794
    • View Profile
« Last Edit: 2018-01-17, 18:08:30 by sprayer »

2018-01-16, 19:00:14
Reply #2

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8839
  • Let's move this topic, shall we?
    • View Profile
    • My Models
@maru, and what is "real" result, i.e. how does render with shadowcatcher's solid mode looks?
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2018-01-16, 22:15:16
Reply #3

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12754
  • Marcin
    • View Profile
here is a solid mode render on a 50% grey background

tomorrow I can retest this with a brighter background
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2018-01-17, 17:16:17
Reply #4

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12754
  • Marcin
    • View Profile
Here are the results:
-always solid straight from max
-for compositing > exr > photoshop
-for compositing > png > photoshop

For the background in the exr version I just had to add a solid color and set H0 S0% V50%. It worked just like that.
For the background in the png vesion I had to add 2,2 gamma to the solid color for it to be consistent with the other examples.
So this seems to be related to gamma. Is there something like "alpha channel gamma"?
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2018-01-17, 18:30:57
Reply #5

pokoy

  • Active Users
  • **
  • Posts: 1861
    • View Profile
I'd take PS out of the equation since it's known to be a pain with 32bits, and try the same in AE instead. AE handles 32bits correctly in all cases so to make sure the resulting render is correct, try AE instead.

2018-01-17, 18:44:04
Reply #6

mferster

  • Active Users
  • **
  • Posts: 523
    • View Profile
I think this alpha gamma issue is related to the bright halo effect that oft gets brought up when saving out an image with an alpha mask.

I did a quick test...first image is just the straight .png saved image with a black background applied behind it in photoshop.

second image is the same png with the same black background added... However I separated the alpha channel from the image and converted it to a layer mask, then applied a rough 2.2 gamma curve to the mask... By the looks of things something is definitely going on with the alpha's gamma.

 

2018-01-17, 19:40:19
Reply #7

burnin

  • Active Users
  • **
  • Posts: 1539
    • View Profile
Know ;)

"The alpha channel is generally linear."

If interested & willing to know more:
- Linear space and alpha channel output (in AE)
- Should the alpha channel be gamma corrected
- check this post for more on the Path to High-End 3D Vehicle Visualization & Color Science (in The Rabbit Hole).

2018-01-17, 23:05:01
Reply #8

mferster

  • Active Users
  • **
  • Posts: 523
    • View Profile
So.... from what I understand from this section (14m 3 seconds, I don't know why the timecode isn't working) in the video below..

is that if you are working in srgb color space my method is correct...ish? Unless I'm completely missing something



2018-01-22, 14:06:25
Reply #9

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12754
  • Marcin
    • View Profile
So the most reliable solution here, if we assume that we must use png format and Photoshop, is that we save the image with "gamma override" set to 1.0 in 3ds Max, and then we apply gamma 2.2 to the whole image, right? I am then getting pretty much consistent result with the "always solid" mode of the shadowcatcher.
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us