Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Bug Reporting => [Max] Resolved Bugs => Topic started by: actrask on 2018-06-06, 21:34:39

Title: Negative pixels in a refraction
Post by: actrask on 2018-06-06, 21:34:39
Hi,

I'm working on a shot with red acrylic. There are bits in the refraction that look different in Corona's VFB compared to it being opened as a 32-bit .exr in Photoshop.

When I sample the problem area pixels in the VFB it returns negative pixels. So I assume that's the issue. I guess my questions are 1. Why? and 2. If that's the case, is there someway to clamp down the pixels from going negative while keeping all the fidelity in overexposed areas?

The material was taken from Corona's material library.

Thanks in advance. I've been working with Corona for a few months now and really like it!
Title: Re: Negative pixels in a refraction
Post by: pokoy on 2018-06-06, 21:39:44
Not sure but it could be that this issue is on Photoshop's side. I had some cases where very bright pixels would show similar results to what you see from other programs. What I ususally do to get rid of this is to resave the image as HDR and open that one, maybe this already helps. Another thing to try would be to save a HDR instead of EXR from the VFB and see how that behaves in PS.

Now I know you 're seeing negative values but try nevertheless and let us know if it helped or not.
Title: Re: Negative pixels in a refraction
Post by: actrask on 2018-06-06, 21:44:13
I usually save as a half float .exr. So when this popped up I tried full float .exr as well as .hdr and got the same result.

When you save out an .exr in vray, it has a "deep exr" box to check. What is that and does Corona have that option? Or is that vrays way of saying 'half float or full float'?

edit: wow it gets crazy bringing down the exposure in photoshop (see attached)
Title: Re: Negative pixels in a refraction
Post by: pokoy on 2018-06-06, 22:13:12
As we discovered recently, PS uses half float for EXR all the way, full float will be clamped to half float no matter what.

What if you try to paint a color over these areas? In my case with similar problems, I wasn't able to paint any color on top of those pixels, they'd always stay untouched. What fixed it for me was to save as HDR, this would fix those places and I could paint over them.

What does it look like in After Effects? Curious...
Title: Re: Negative pixels in a refraction
Post by: actrask on 2018-06-06, 22:50:53
That's interesting about the PS half float. Although I read the only data you'll ever gain with full float over half float is overexposed areas with lots of motion blur, so I can see why they don't bother.

No dice with After Effects, it shows the same yellow pixels.

The hue/sat in 32bit mode does a pretty good job of removing the yellow in Photoshop. In fact, just moving the hue to -85 puts the pixels right back into place.

So not a huge deal, but I wanted to see if there was a fix because the less comping hacks the better.

I wish I had Nuke on this machine to see how that brings it in.
Title: Re: Negative pixels in a refraction
Post by: pokoy on 2018-06-06, 23:48:44
Then it might really be something that Corona's VFB does. I remember reading that the data the VFB displays is not 100% identical to what gets saved to disk. Maybe a corner case where it's visible due to extreme (negative) values?
...or a bug where negative values shouldn't appear in the first place.
Title: Re: Negative pixels in a refraction
Post by: Njen on 2018-06-07, 00:14:04
When you save out an .exr in vray, it has a "deep exr" box to check. What is that and does Corona have that option? Or is that vrays way of saying 'half float or full float'?

Deep is a method of sampling pixels in z screen space. It has no connection in setting the bit depth of an image.
Title: Re: Negative pixels in a refraction
Post by: Njen on 2018-06-07, 00:22:41
...or a bug where negative values shouldn't appear in the first place.

My guess is this or the shader has some kind of hack/cheat in it. Maybe the math got a little mixed up somewhere, unless the VFB really is doing something wrong. Either way I think the OP should definitely post this into the Bugs forum.
Title: Re: Negative pixels in a refraction
Post by: pokoy on 2018-06-07, 07:36:42
Are you using the blur/sharpen filter by any chance? I guess this one could probably produce negative values, if yes try disabling it, maybe that helps.
Title: Re: Negative pixels in a refraction
Post by: sevecek on 2018-06-07, 08:56:37
Hi,

do you save the image as Corona EXR (.cxr) or as EXR through Max save dialog?
Title: Re: Negative pixels in a refraction
Post by: actrask on 2018-06-07, 17:04:40
No I haven't tried saving as a .cxr. What's the TL:DR on a .cxr? Is it like vray's .vrimg file? I'll give it a shot later today.

In Corona's VFB post panel Sharpening/Blurring is turned off. I'm using a LUT so I suppose I should turn that off and try it. Bloom/Glare is on and Tone Mapping is on. The image filter is set to Tent.

Good to learn what deep output does in Vray :thumbsup:

To be clear, I haven't messed with any of the material settings on the acrylic. It was dragged in directly from Corona's material library. The light sources are a few corona lights and an hdr pano in the environment slot.
Title: Re: Negative pixels in a refraction
Post by: maru on 2018-06-12, 10:06:52
So far I wasn't able to reproduce this. @Actrask, could you please share the scene and exr renders with us? You can use this uploader: https://corona-renderer.com/upload
Thanks in advance!
Title: Re: Negative pixels in a refraction
Post by: maru on 2018-06-12, 15:45:39
Ok, I think I got it, but still one more example wouldn't hurt. ;)
Title: Re: Negative pixels in a refraction
Post by: Dung (Ivan) on 2018-06-29, 13:35:02
Hello actrask,

we are very sorry, but we will have to leave the things as they are. The reason is that the change would be risky.
Title: Re: Negative pixels in a refraction
Post by: actrask on 2018-08-29, 16:10:02
No problem at all, it hasn't come up again since I made the post. Thanks for looking into it though.
Title: Re: Negative pixels in a refraction
Post by: actrask on 2018-12-14, 19:37:36
I have a small follow-up on this. The pixels go negative when the refracted color is too saturated.

That doesn't answer why the frame buffer returns different info than the .exr, but if you can clamp those refracted pixels from going negative wouldn't that solve the issue?