Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Daily Builds => Topic started by: user116 on 2022-01-29, 23:22:43

Title: 01.2022 compositing issues
Post by: user116 on 2022-01-29, 23:22:43
Hi. Can you please fix this ? This just does not look right.
Needles are opacity cards. When you render them agains bright background they just dissolve and thus the trees lack any volume. It does not matter if the background is HDRI or Corona Sky, does not matter how high you set up Hihlight compression, if you set up Highlight clamping or not.
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-01-30, 03:18:38
Actually I was curious about the same thing. Alpha channels come with a black (or whatever background there is) contour. Can the alpha take alpha as transparent as opposed to the background while rendering?
Title: Re: 01.2022 compositing issues
Post by: user116 on 2022-01-30, 09:21:59
Yes, the difference is obvious and brutal. Better example where the trees do not overlap - impossible to build any volume with single tree which is somewhat dense in itself. Bright background, dark override, and composited image saved with alpha channel and background added in post.
Pretty please address this guys. Thank you
Title: Re: 01.2022 compositing issues
Post by: LorenzoS on 2022-01-30, 09:27:02
maybe the "issue"  is related to this?
https://forum.corona-renderer.com/index.php?topic=35426.0
Title: Re: 01.2022 compositing issues
Post by: Yuriy Bochkaryov on 2022-01-30, 16:42:23
Quote
Hi. Can you please fix this ? This just does not look right.
Needles are opacity cards. When you render them agains bright background they just dissolve and thus the trees lack any volume. It does not matter if the background is HDRI or Corona Sky, does not matter how high you set up Hihlight compression, if you set up Highlight clamping or not.
I also wrote about this problem, but no one answered me
everyone is silent
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-01-31, 11:43:53
just render on black or do not replace background. there is nothing to fix hence the silence.
Title: Re: 01.2022 compositing issues
Post by: Yuriy Bochkaryov on 2022-01-31, 12:19:01
Quote
just render on black or do not replace background. there is nothing to fix hence the silence.
strange offer
why render on black?
how is this justified?
maybe you need to fix the error and there will be no more problems
2022 - and we need a black background to render coniferous plants
I think it's wrong
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-01-31, 12:51:40
on the edges of those conifiers green pixels with value of 0.25 are mixing with blue sky pixels well above 1.0. you are just loosing them: 0.25 and sky will often blend to 1+. not so green any more.
you want to preserve this green 0.25 for future compositing? every possible pixel of it? render on black 0.0.
Title: Re: 01.2022 compositing issues
Post by: Yuriy Bochkaryov on 2022-01-31, 12:57:29
Quote
on the edges of those conifiers green pixels with value of 0.25 are mixing with blue sky pixels well above 1.0. you are just loosing them: 0.25 and sky will often blend to 1+. not so green any more.
you want to preserve this green 0.25 for future compositing? every possible pixel of it? render on black 0.0.
does everything work correctly?
there is no problem, nothing needs to be fixed, everything works correctly?
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-01-31, 13:36:17
on the edges of those conifiers green pixels with value of 0.25 are mixing with blue sky pixels well above 1.0. you are just loosing them: 0.25 and sky will often blend to 1+. not so green any more.
you want to preserve this green 0.25 for future compositing? every possible pixel of it? render on black 0.0.

Rendering on black is fine. The issue is that the alpha channel leaves pixels on the contour. So you need to keep on working on post to remove them.
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-01-31, 13:48:52
on the edges of those conifiers green pixels with value of 0.25 are mixing with blue sky pixels well above 1.0. you are just loosing them: 0.25 and sky will often blend to 1+. not so green any more.
you want to preserve this green 0.25 for future compositing? every possible pixel of it? render on black 0.0.

Rendering on black is fine. The issue is that the alpha channel leaves pixels on the contour. So you need to keep on working on post to remove them.

and it is ok in Corona 7?
Title: Re: 01.2022 compositing issues
Post by: Dionysios.TS on 2022-01-31, 14:24:26
just render on black or do not replace background. there is nothing to fix hence the silence.

This is not the solution!

I've tried many times in the past and the black background leaves small black artifacts on the edges of the foliage objects.
As a fast workaround, I render the image with the background I'll use in post so the defect is minimized but in any case is still there.

I agree with Yuriy, there is something wrong and needs to be fixed.

Thanks.
Title: Re: 01.2022 compositing issues
Post by: LorenzoS on 2022-01-31, 14:32:38
Quote
I've tried many times in the past and the black background leaves small black artifacts on the edges of the foliage objects.
As a fast workaround, I render the image with the background I'll use in post so the defect is minimized but in any case is still there.
same workflow for me

Quote
I agree with Yuriy, there is something wrong and needs to be fixed.
+1

for who work with external views I think it is a big limitation.


Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-01-31, 15:08:17
on the edges of those conifiers green pixels with value of 0.25 are mixing with blue sky pixels well above 1.0. you are just loosing them: 0.25 and sky will often blend to 1+. not so green any more.
you want to preserve this green 0.25 for future compositing? every possible pixel of it? render on black 0.0.

Rendering on black is fine. The issue is that the alpha channel leaves pixels on the contour. So you need to keep on working on post to remove them.

and it is ok in Corona 7?

No.

This should be a separate thread for Corona in general.
Title: Re: 01.2022 compositing issues
Post by: maru on 2022-01-31, 15:50:39
Hi. Can you please fix this ? This just does not look right.
Needles are opacity cards. When you render them agains bright background they just dissolve and thus the trees lack any volume. It does not matter if the background is HDRI or Corona Sky, does not matter how high you set up Hihlight compression, if you set up Highlight clamping or not.

^This is the message the whole compositing discussion originated from.

This behavior is expected in any renderer, and it also happens in real life.

If a thin or transparent object is against a bright background, its borders will contract.

Yes, you CAN negate that effect by using highlight clamping (see the attached examples, max scene, comparison):
https://corona-renderer.com/comparer/nrPkPH

If you cannot reproduce this in some other renderer or in photography, please post some examples and explanation how you did it.

Title: Re: 01.2022 compositing issues
Post by: maru on 2022-01-31, 16:21:49
Another issue from the above posts:

- you render something in Corona against some background

- you want to replace the background or move the object into some other place of the image

- you render a mask of this object, save in 32-bit exr with alpha channel, no post processing, and do other fancy stuff to make sure all is fine

- in the end... OMG BORDERS!


Why?

Because Photoshop is unable to interpret the alpha channel correctly!
Use Fusion (it's free) or other software that is made specifically for compositing. It will handle just fine whatever complex alpha-channel-masked-32-bit-exr you throw at it.



If you are having issues with this - again, please send us sample files (max, exr, other) and let us know how to reproduce your issue. We will look into it.
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-01-31, 16:24:30
I'll try with fusion later. But yes. With photoshop this is the result:

See below please.
I have two tall boxes. One with physical material and the other with legacy, to discard reflections.
Rendered against an empty background.

I save the image as PNG with alpha included.

In photoshop I add a white background and I can see a darker grey contour.

Edit: I added the Max file

Title: Re: 01.2022 compositing issues
Post by: Dionysios.TS on 2022-01-31, 16:43:52
Maru thanks for moving the post here and excuse us for the "contamination" of the Daily 8 one.

Anyway, I remember in the old mental-ray days, to proceed with the compositing video process in Combustion I was saving in TGA format with the Pre-Multiplied Alpha option enable and this defect was gone. Now I don't know how to replicate the same fix in Photoshop as Combustion had a special future for the Alpha channels when they were Pre-Multiplied or not.
Title: Re: 01.2022 compositing issues
Post by: user116 on 2022-01-31, 16:53:01
Hi. Can you please fix this ? This just does not look right.
Needles are opacity cards. When you render them agains bright background they just dissolve and thus the trees lack any volume. It does not matter if the background is HDRI or Corona Sky, does not matter how high you set up Hihlight compression, if you set up Highlight clamping or not.

^This is the message the whole compositing discussion originated from.

This behavior is expected in any renderer, and it also happens in real life.

If a thin or transparent object is against a bright background, its borders will contract.

Yes, you CAN negate that effect by using highlight clamping (see the attached examples, max scene, comparison):
https://corona-renderer.com/comparer/nrPkPH

If you cannot reproduce this in some other renderer or in photography, please post some examples and explanation how you did it.

Yea, sorry for posting in daily thread.
Concerning the topic - sorry but watching some pictures I still think something is off.
(https://upload.wikimedia.org/wikipedia/commons/e/ef/Pinus_sylvestris_Beskid_%C5%BBywiecki.JPG)
Image credits - Wikipedia
The trees sustain their volume. One can also pretty much see the individual needles.
Is there really no way to mitigate this effect without having to resolve to compositing and work freely in WYSIWG using the (awesome) interactive renderer? Highlight clamping is also no solution as the image gets extremally flat.
Title: Re: 01.2022 compositing issues
Post by: maru on 2022-01-31, 17:08:20
Yea, sorry for posting in daily thread.
Concerning the topic - sorry but watching some pictures I still think something is off.
(https://upload.wikimedia.org/wikipedia/commons/e/ef/Pinus_sylvestris_Beskid_%C5%BBywiecki.JPG)
Image credits - Wikipedia
The trees sustain their volume. One can also pretty much see the individual needles.
Is there really no way to mitigate this effect without having to resolve to compositing and work freely in WYSIWG using the (awesome) interactive renderer? Highlight clamping is also no solution as the image gets extremally flat.

The image you posted is also "extremally flat". The sky is not overexposed so there is no huge contrast difference between the trees and the background.

How about this one?
(https://forum.corona-renderer.com/index.php?action=dlattach;topic=35500.0;attach=160257;image)

The tree branches become thinner and thinner up to a point where they are invisible, the brighter the background is.
Title: Re: 01.2022 compositing issues
Post by: Dionysios.TS on 2022-01-31, 17:29:38
The image you posted is also "extremally flat". The sky is not overexposed so there is no huge contrast difference between the trees and the background.

But Maru, even in this "extremely flat" situation this optical problem is still present. If you go back on page 1 in this thread, there is an example which is very similar to the last posted "flat and natural" photo and the leaves are less visible than same image on a black background.

I think is something it has to do with ho the sampler works on the opacity materials with very fine detail. Maybe I am wrong...
Title: Re: 01.2022 compositing issues
Post by: maru on 2022-01-31, 17:51:46
I'll try with fusion later. But yes. With photoshop this is the result:

See below please.
I have two tall boxes. One with physical material and the other with legacy, to discard reflections.
Rendered against an empty background.

I save the image as PNG with alpha included.

In photoshop I add a white background and I can see a darker grey contour.

Edit: I added the Max file

Here are my results from Photoshop (dark border) and Fusion (no border).
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-01-31, 18:06:20
Got it. Thanks!
Title: Re: 01.2022 compositing issues
Post by: user116 on 2022-01-31, 18:59:37
Yea, sorry for posting in daily thread.
Concerning the topic - sorry but watching some pictures I still think something is off.
(https://upload.wikimedia.org/wikipedia/commons/e/ef/Pinus_sylvestris_Beskid_%C5%BBywiecki.JPG)
Image credits - Wikipedia
The trees sustain their volume. One can also pretty much see the individual needles.
Is there really no way to mitigate this effect without having to resolve to compositing and work freely in WYSIWG using the (awesome) interactive renderer? Highlight clamping is also no solution as the image gets extremally flat.

The image you posted is also "extremally flat". The sky is not overexposed so there is no huge contrast difference between the trees and the background.

How about this one?
(https://forum.corona-renderer.com/index.php?action=dlattach;topic=35500.0;attach=160257;image)

The tree branches become thinner and thinner up to a point where they are invisible, the brighter the background is.

I understand that some bleeding of the sky will happen, but you are trying to bend the facts to your favour. In my test examples I would certainly accept some advantage to rendering on black background but for sure not so pronounced.

You posted exaple with sunset is clearly also exagerating the situation to your favour. I was not testing this against full blown sun, merely bright blue sky. Tree on my tests was aproximately the same distance as the leaveless branches on your example and yet the fine twigs in your example are clearly visible.

The image you posted is also "extremally flat". The sky is not overexposed so there is no huge contrast difference between the trees and the background.

But Maru, even in this "extremely flat" situation this optical problem is still present. If you go back on page 1 in this thread, there is an example which is very similar to the last posted "flat and natural" photo and the leaves are less visible than same image on a black background.

I think is something it has to do with ho the sampler works on the opacity materials with very fine detail. Maybe I am wrong...

I also think that how the sampler works might be the problem.
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-01-31, 19:34:06
I'll try with fusion later. But yes. With photoshop this is the result:

See below please.
I have two tall boxes. One with physical material and the other with legacy, to discard reflections.
Rendered against an empty background.

I save the image as PNG with alpha included.

In photoshop I add a white background and I can see a darker grey contour.

Edit: I added the Max file

in your PNG with alpha example - is the black border almost gone if you switch to 32bit mode? if so Photoshop is blending colors with wrong gamma.
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-01-31, 19:50:04
I'll try with fusion later. But yes. With photoshop this is the result:

See below please.
I have two tall boxes. One with physical material and the other with legacy, to discard reflections.
Rendered against an empty background.

I save the image as PNG with alpha included.

In photoshop I add a white background and I can see a darker grey contour.

Edit: I added the Max file

in your PNG with alpha example - is the black border almost gone if you switch to 32bit mode? if so Photoshop is blending colors with wrong gamma.

There aren't 32 bit PNGs, but at 16 bit I can still see the border. I don't know how to premultiply a targa or tiff file in photoshop. I'd need to just do a selection of the alpha, but at that point the test doesn't make sense.
Title: Re: 01.2022 compositing issues
Post by: Dionysios.TS on 2022-01-31, 19:55:01
I'll try with fusion later. But yes. With photoshop this is the result:

See below please.
I have two tall boxes. One with physical material and the other with legacy, to discard reflections.
Rendered against an empty background.

I save the image as PNG with alpha included.

In photoshop I add a white background and I can see a darker grey contour.

Edit: I added the Max file

in your PNG with alpha example - is the black border almost gone if you switch to 32bit mode? if so Photoshop is blending colors with wrong gamma.

There aren't 32 bit PNGs, but at 16 bit I can still see the border. I don't know how to premultiply a targa or tiff file in photoshop. I'd need to just do a selection of the alpha, but at that point the test doesn't make sense.

That's the problem...
Title: Re: 01.2022 compositing issues
Post by: Ondra on 2022-01-31, 20:01:58
I'm sorry but the tree example just won't work - we are certainly not using real pine needle geometry with translucency as its main scattering component. Because our inputs are so far away from physical reality, we cannot expect physically correct results out of the box
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-01-31, 20:07:49

There aren't 32 bit PNGs, but at 16 bit I can still see the border. I don't know how to premultiply a targa or tiff file in photoshop. I'd need to just do a selection of the alpha, but at that point the test doesn't make sense.

even 8bit PNG with alpha will show that behaviour when you switch between 8 and 32 mode.

I'm referring to this option in PS:
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-01-31, 20:15:22

There aren't 32 bit PNGs, but at 16 bit I can still see the border. I don't know how to premultiply a targa or tiff file in photoshop. I'd need to just do a selection of the alpha, but at that point the test doesn't make sense.

even 8bit PNG with alpha will show that behaviour when you switch between 8 and 32 mode.

I'm referring to this option in PS:

Oh. You mean to just Image>Mode>32 bit.
Interestingly, it does seem to improve, but it's very subtle.

Regarding that option with gamma in PS, I never used that or new it existed.
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-01-31, 20:38:48

Oh. You mean to just Image>Mode>32 bit.
Interestingly, it does seem to improve, but it's very subtle.

Regarding that option with gamma in PS, I never used that or new it existed.

if you need it cleaner just use exrs. these would look perfect even in Photoshop.
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-01-31, 20:45:13
Thanks Piotrus.
I'll try. It scares me the disc space, but will definitely give it a try.
Fusion sounds good too and always wanted to play with it.
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-01-31, 21:37:52
16bit exr should be smaller than your 16bit PNG. no need for 32bit.
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-05-22, 23:25:58
I'll try with fusion later. But yes. With photoshop this is the result:

See below please.
I have two tall boxes. One with physical material and the other with legacy, to discard reflections.
Rendered against an empty background.

I save the image as PNG with alpha included.

In photoshop I add a white background and I can see a darker grey contour.

Edit: I added the Max file

Here are my results from Photoshop (dark border) and Fusion (no border).

Thank you Maru. I just did this with Fusion. Now my question is, can Corona render in the VFB directly with the transparency instead of using a black background, like Fusion does? We would save directly into a PNG for example, saving us the fusion step.
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-05-23, 09:11:15
its not Corona. this is PS trying to do compositing in 2.2
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-05-23, 14:32:32
I understand. But if Fusion let's you output/save the image with a transparent background, maybe corona can do it too.
In that case you can save as PNG and open it in PS with perfect transparency.
Title: Re: 01.2022 compositing issues
Post by: TomG on 2022-05-23, 15:34:52
The PNG options from Max when saving specify whether to include the alpha or not. As a note, Photoshop may not show it on loading because Photoshop, but it is there.
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-05-23, 16:54:52
The PNG options from Max when saving specify whether to include the alpha or not. As a note, Photoshop may not show it on loading because Photoshop, but it is there.

Ok. So it wouldn't be possible to show it like this in the VFB?
See attached please.
I feel (really don't know), that if it's shown like this in the VFB, as opposed to a black background, it wouldn't bring black pixels around the image into photoshop. No?
Title: Re: 01.2022 compositing issues
Post by: TomG on 2022-05-23, 16:59:32
The VFB will always show whatever background color or image is set for the scene, but those areas will also generate an alpha mask that gets saved with the image. Photoshop gets a bit weird about this and may load the PNG with the background visible, but the alpha is in there and can be extracted and applied, I don't remember exactly when it decides to get weirded out about it :)

A quick test with a cube shows that so long as Alpha channel is checked in the Max settings, it loaded just fine in PS with that already applied for me.
Title: Re: 01.2022 compositing issues
Post by: lupaz on 2022-05-23, 17:07:21
The VFB will always show whatever background color or image is set for the scene, but those areas will also generate an alpha mask that gets saved with the image. Photoshop gets a bit weird about this and may load the PNG with the background visible, but the alpha is in there and can be extracted and applied, I don't remember exactly when it decides to get weirded out about it :)

A quick test with a cube shows that so long as Alpha channel is checked in the Max settings, it loaded just fine in PS with that already applied for me.

Ah ok. Thanks.
Title: Re: 01.2022 compositing issues
Post by: piotrus3333 on 2022-05-27, 10:42:16
This is how Fusion handles alpha edges issues with Merge node (Additive/Subtractive slider):