Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Bug Reporting => [Max] Resolved Bugs => Topic started by: atelieryork on 2015-09-25, 14:58:48

Title: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 14:58:48
Not sure if this is a bug with max, EXR or Corona, but when you save your render from the VFB out as an EXR, if you save it with Storage Type set to Tiles you will lose all your colour information and it will essentially be 8-bit. You must save it out as Scanlines Storage Type, then you'll have full 16/32-bit.

This might be an issue with default max 2016 exr output settings.

Perhaps this is a known issue?
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 15:16:56
Well...

Now for some reason I can't seem to get this to work with either scanline or tiles mode...

Something fishy is going on, and it's not just my lunch...
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 15:22:47
So if I save to EXR from the Render dialog "Save VFB" button then it strips out all Tone Mapping from the image and saves as a proper 32-bit EXR, which I can re-expose properly.

Anything I save at all from the Corona VFB manually as an EXR 32-bit float, the tone mapping is preserved but the image can't be re-exposed properly, so all the information has been clamped and lost.

I must be doing something very wrong here.

Any ideas!
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 15:34:06
Interestingly if I look at the same render in the Max Frame Buffer and save it out from there as an EXR, it also doesn't seem to work. It comes in clamped into PS.

The only way I can get an unclamped EXR out of max is by using the corona Save VFB button. But then I lose all my tone mapping...

I really must be doing something wrong here.

If I disable the CoronaCameraMod and re-render with no Tone Mapping applied, I can then save it out properly with full depth. As soon as I do any kind of Tone Mapping at all, either with Corona CameraMod or within the CoronaVFB, it clamps the image when I save it out.
Title: Re: Contrast setting in Tone Mapping Clamps Renders
Post by: atelieryork on 2015-09-25, 15:40:15
Ok revelation time!

It's the "Contrast" setting in Tone Mapping - either through the mod or the vfb.

As soon as it's anything other than 1, all your depth is lost when you save the EXR out.

So there's the bug....

I should mention that I'm on Daily build from 22nd.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 15:45:42
Now i found the actual issue, maybe the thread title could be changed, because it's not accurate at all.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: pokoy on 2015-09-25, 15:57:25
Could you test 2 things:

- What if Gamma Uutput is set to automatic and manual (set to 2.2)?
- Depth Format - Full Float / Half Float / Integer

Contrast works fine for me so I feel something else is causing this. For example, I have a problem with strip rendering in Backburner where one file saves black images while another one saves perfect files when merging the strips. I suspect it's something about Max and EXRs in general as there have been changes in gamma handling in 2016.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 16:07:05
So gamma has no effect, I tested that.

And also neither does full/half/integer. They make no difference.

As far as I can tell, using Contrast for me breaks my EXR output.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: pokoy on 2015-09-25, 16:10:49
So gamma has no effect, I tested that.

And also neither does full/half/integer. They make no difference.

As far as I can tell, using Contrast for me breaks my EXR output.

Strange. Are you using daily builds?
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 16:13:34
Yes, from 22nd.

You?

Which version of max are you using? And which corona build?
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 16:31:07
I can confirm that this bug also happens with 1.2.1 and from within the VFB (not using cameramod). My colleague has this setup.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: pokoy on 2015-09-25, 16:35:01
I'm on 1.2.1, really no idea where this comes from...
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 16:35:56
I'm on 1.2.1, really no idea where this comes from...

Could you please upload a very simple scene where you're not having this issue?

And please supply the EXR with it.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: pokoy on 2015-09-25, 17:12:35
Oops, you're right. The file where I am using 32bits for post (and which works fine) had contrast set to 1, that's why it was working fine. I thought I was using contrast on this one.
Contrast seems to clamp values above 1.0
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 17:14:30
Oops, you're right. The file where I am using 32bits for post (and which works fine) had contrast set to 1, that's why it was working fine. I thought I was using contrast on this one.
Contrast seems to clamp values above 1.0

Cool, thought so.

I'm amazed I'm the first to spot this, apparently. Or maybe others have, but not reported it.

Maybe most people are not using Contrast for tone mapping? I started playing with it this week and really, really like how it works. You can get all the contrast and richness back into your image while having it highly exposed. Great for bright white interiors (which is what I'm working on here).

Hope this can be fixed!
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: pokoy on 2015-09-25, 17:27:04
Let's hope it's possible to fix. Considering how contrast can easily produce negative values the limitation may be by design.

You're right, the tone mapping controls are very effective. Still, I would love to have a way to save both at the same time, a tone-mapped version and another one without any tone mapping applied.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-25, 17:28:26
Let's hope it's possible to fix. Considering how contrast can easily produce negative values the limitation may be by design.

You're right, the tone mapping controls are very effective. Still, I would love to have a way to save both at the same time, a tone-mapped version and another one without any tone mapping applied.

Definitely.

There is already a way to save both - use the Save VFB button in render setup dialog. It will save a "raw" version of the VFB with no tone mapping applied. So you can save that, then save out from the VFB as normal for your tone mapped version.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: Nekrobul on 2015-09-25, 18:43:45
Use these settings
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: Juraj on 2015-09-25, 21:42:30
Indeed don't use the contrast, works strangely in my opinion, not sure what kind of curve it produces but seem to work mostly on blacks. Needs filmic :- )
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-26, 14:49:23
Use these settings

I will try these on Monday but I'm pretty sure that these won't fix the problem.

Are you positive that you're not getting the issue if you use Contrast >1.0?
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-09-29, 09:52:36
No dice on those settings. Same issue.

Is anyone from Legion able to acknowledge this issue? I'd like to rule out user error (aka I'm being stupid somehow). I feel like someone somewhere would have spotted this at some point before me...

Cheers,
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: Ondra on 2015-10-07, 16:56:15
this is the expected behavior

look at this color curve:
(https://i.imgur.com/Nz7rX2q.png)

When you have no tone mapping, there is straight line between input and output. If you extrapolate that into overbrights (colors with intensity > 1.f, or > 255), you still get the same straight line - see red in the image.

But if you use contrast, you use a curve similar to the one in the image. Now imagine you extend that into overbrights. Where will the curve go? It is depicted in blue. It shows that all overbrights are compressed into very shallow range of colors (which quickly degenerates into single color because of numerical precision limits).

This is not a bug and it makes sense for 2 reasons:
1) if you used contrast, you are working in non-linear space, so it is no longer safe to change exposure of the image. Same as using gamma, highlight compression, etc. You can always do tone mapping in post-production and use the correct linear output from Corona.
2) by using the contrast function you explicitly requested for the near-black and near-white range to be destroyed to increase the differences between black and white. This is what the contrast function does by definition. If there is some other implementation that is not as aggressive, I could switch it, but the function we use currently was the best one I was able to find based on a number of desirable properties.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: atelieryork on 2015-10-07, 17:13:39
Hi Ondra,

Thank you for the detailed response! I think I now understand what this all means and why it occurs and I had suspected it was something like this causing it. The bottom line is that using Contrast in the VFB or CameraMod destroys your ability to re-expose the image, and this is a very serious limitation that basically makes the tool useless to anyone who might want to re-expose in post (which must be a lot of people, I would guess). I very, very frequently render my main image which overall has a very nice exposure, but some areas might be undesirably over exposed, so I simply reduce the exposure in post and comp it back in where needed. A typical use is to get rid of those nasty aliased overbright areas around light sources. They disappear when underexposed and you can get all that for "free" without having to re-render the whole image again with a lower exposure, when using 32-bit with retained dynamic range.

The main benefit of Contrast, for me, is that I was really enjoying the workflow of getting the image looking basically 10/10 in the VFB using Contrast - for example when producing nice, bright white interiors with dark black floors and crisp highlights - it's very difficult to achieve that look without considerable post-production but corona's Contrast tool basically solved it, so that's a shame it's not usable without this issue.

I really don't know how you can solve it but I would strongly suggest that you put up a warning message in the console when the user has Contrast > 1.0 so at least they know that this will kill all dynamic range in their image once rendered. 32-bit EXR (half or full) becomes pointless once Contrast is used, so it's also a matter of disk space and RAM usage in post (I bet there are people using Contrast >1.0 who are rendering animations to 32-bit EXR for no reason - you might as well render to 8-bit PNG/TIF/TGA etc.) and save a huge amount of space and RAM).

I hope you can find a workaround or alternative implementation that retains at least some dynamic range. Contrast is a very nice tool indeed and helps to establish mood very quickly, so it's a shame to lose it.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: Juraj on 2015-10-08, 00:23:00
32-bit EXR for no reason - you might as well render to 8-bit PNG/TIF/TGA etc.

Rendering to linear output seemingly yes,...but color-depth is always welcome even for clamped images. And since .exr is such effective format (disk size, channels,etc..) it makes absolute sense to use it no matter of linear/non-linear post-production phase.
Title: Re: EXR - Store Image as Tiles = No Colour Depth
Post by: Ondra on 2015-10-08, 11:11:41
yep, you can still do a shitton of stuff in LDR image that keeping the 32bit resolution per channel makes sense