Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Feature Requests => Topic started by: chocolatecookie on 2022-11-08, 19:19:12

Title: Save out bloom&glare pass with transparent background
Post by: chocolatecookie on 2022-11-08, 19:19:12
beautiful bloom and glare isnt saved out with a transparent background. How can I save the pass with thebloom&glare flares and a transparent background?

i attached a reference image.
Title: Re: Save out bloom&glare pass with transparent background
Post by: chocolatecookie on 2022-11-14, 16:26:42
hi all,

can I assume from the silence in this thread that this is not really doable to implement?

kind regards
Title: Re: Save out bloom&glare pass with transparent background
Post by: TomG on 2022-11-14, 16:31:57
Being a form of lighting, they are best added using Linear Add rather than transparency/alpha, so saving to an HDR format allows good and expected control in post. Probably why they aren't created with alpha as doing a Normal overlay would make them work like transparent stickers rather than actual lighting with adjustable exposure etc.
Title: Re: Save out bloom&glare pass with transparent background
Post by: chocolatecookie on 2022-11-15, 11:26:41
thanks for the answer. so basically it is not possible, if I want to overlay a render with bloom&glare onto a background image, and retain the flexibility of moving that render over the background image? No need to adjust the exposure. In the VFB I can do that already.
Title: Re: Save out bloom&glare pass with transparent background
Post by: pokoy on 2022-11-15, 13:14:40
thanks for the answer. so basically it is not possible, if I want to overlay a render with bloom&glare onto a background image, and retain the flexibility of moving that render over the background image? No need to adjust the exposure. In the VFB I can do that already.
Bloom & glare should be applied in additive mode - for this you don't need alpha as black will not be visible and only brighter colors will be blended. As Tom said, ideally in 'linear add' mode (and linear workflow) but if you just want to add it in PS, 'screen' mode will work good enough and you can still add a tone control adjustment layer to the bloom & glare layer for further modifications (boost, gamma etc).
Title: Re: Save out bloom&glare pass with transparent background
Post by: maru on 2022-11-15, 14:50:44
Add a CShading_Beauty render element. Disable "apply bloom" and "apply glare" in that element.
Add a CShading_BloomGlare render elements. Make sure "apply bloom" and "apply glare" are enabled in that element (unless you only wish to have one of them, or split them into 2 elements).
Render.
This will give you a Beauty render element without bloom and glare (let's call it A) and a separate bloom and glare element on a black background (let's call it B).

To get "beauty with bloom and glare", just open Photoshop or any other 2D editor and mix image A and B using the Add operation.
Title: Re: Save out bloom&glare pass with transparent background
Post by: chocolatecookie on 2022-11-15, 21:05:56
thanks for your answer. I see the teapot scene does not have a background in 3D. Imagine saving the "beauty with bloom and glare" workflow you suggested, as a png/tiff. If I were to open that image in PS, and pasting it onto, for example, a plain blue background, do I keep the bloom and glare rays visible -at the edges of the geometry-, where it gets transparent?
Title: Re: Save out bloom&glare pass with transparent background
Post by: maru on 2022-11-16, 09:08:15
It does not matter if you have some background or not. What you get is:
- beauty without bloom and glare
- bloom and glare only (with no other objects)

Then you put the bloom and glare only on top of the beauty without bloom and glare and mix them using add operation.
Title: Re: Save out bloom&glare pass with transparent background
Post by: maru on 2022-11-16, 09:38:13
Proof attached. :)
Title: Re: Save out bloom&glare pass with transparent background
Post by: chocolatecookie on 2022-11-16, 10:06:06
thanks for that clarification. If I correctly apply it, you will get attached scene I think? Toplayer = CShading_BloomGlare, layer underneath = CShading_Beauty (without Bloom-Glare). Mixed together with Add.
As you can see the Bloom-Glare-pass leaves out the lightrays at the edges if saved with alpha channel applied. As I missing something? what I need is to keep those lightrays, while maintaining the ability to change the background color or leave out the background and save it as a .png for example.
Title: Re: Save out bloom&glare pass with transparent background
Post by: philipbonum on 2022-11-16, 13:01:03
Bloom and glare render layer should not be saved with alpha, I believe that will fix your problem? :)
Title: Re: Save out bloom&glare pass with transparent background
Post by: chocolatecookie on 2022-11-16, 14:00:52
Well, esthetically it looks 99% as in the VFB, but no alpha = black flattened background.
which means I would need to mask out the bloom&glare manually I think. Here you can see the magic wand in PS that selects the darker parts of the Bloom-glare-pass.
Title: Re: Save out bloom&glare pass with transparent background
Post by: TomG on 2022-11-16, 14:08:35
You don't need to mask the bloom and glare pass - when you are using an Add mode, whether Linear or not, black "adds nothing" automatically, ie has no effect, ie is like it is masked without ever having to mask it.

(EDIT and similarly "faint" bloom and glare "adds just a little", ie also looks like there is a mask of some grey there... and "really  bright" bloom and glare will add so much it pretty much wipes out what was underneath it, just like a mask of "full white" would.... the Add mode is the key, as you are adding a light source which works in an add mode, not adding a sticker or other overlay that would require a mask e.g. like a tree cutout would need a mask as it is not lighting but an object, so needs to be layered in normal mode with a mask )
Title: Re: Save out bloom&glare pass with transparent background
Post by: maru on 2022-11-16, 15:43:55
Bloom and glare should not be saved with alpha. It is a 100% solid bitmap and you apply it on top of the beauty pass with Add operation.
If you add 0 (pure black color) to something then you are not adding anything.
Title: Re: Save out bloom&glare pass with transparent background
Post by: chocolatecookie on 2022-11-16, 17:15:39
thanks for the clarification, I see. so can I take it that if that is how it works, it's not possible to mask out the black parts of the bloom-glare-pass quickly, so I can put the whole -object + bloom&glare- onto a different color background? (whilst not using the Add operation)
For example if I have a powerpoint, and I or a colleague need to customize the background of that powerpoint-slide, (where this object sits on), I need to comp it in PS using the Add operation? And what if the object needs to move (because of changing text)? Then I need to go to PS again and move the -object + bloom&glare-?

Here`s an example, hope that clears it up a bit.
Title: Re: Save out bloom&glare pass with transparent background
Post by: pokoy on 2022-11-16, 19:07:10
There's no alpha for bloom and glare. Only alpha-less and add/screen blending in PS or elsewhere. The fact that bloom and glare is added on top is the only reason you are able to obtain a separate layer/file of it. It's just the way it is in all apps, any bloom/shine/glare is added on top in addition blending mode.

Even if there was you'd have to un-multiply the image based on alpha which mostly only compositing apps offer (certainly not Powerpoint, even PS can't do it).

Title: Re: Save out bloom&glare pass with transparent background
Post by: maru on 2022-11-17, 10:03:11
Do not use alpha channel or any kind of transparency at all. Your bloom and glare layer should be 100% solid.
Title: Re: Save out bloom&glare pass with transparent background
Post by: philipbonum on 2022-11-17, 11:01:37
If the use case is a quick background change in Powerpoint - which I assume don't support blending modes - I would load the bloom and glare pass in Photoshop, add a blank mask to it, copy paste the image onto the mask. This creates a black and white version of the image as a mask to the layer. Effectively masking away all the black/grey pixels. Then save as png(with alpha) and load into Powerpoint.
I assume this would look ok-ish on top of whatever background you need in Powerpoint.
Title: Re: Save out bloom&glare pass with transparent background
Post by: maru on 2022-11-17, 11:30:46
I couldn't find a way to merge the bloom and glare layer onto a transparent layer with the Add operation (it would always render the background black, even when using the "Apply image" option), so the solution was (as usual) to use something else than Photoshop. Here is an example made with Fusion (it's free). You can then save this as a PNG or some other format and place it on top of the bloom and glare-less background, and it won't give you black fringes or anything like that.

...this was a part of Compositing in Powerpoint 101 course...
Title: Re: Save out bloom&glare pass with transparent background
Post by: chocolatecookie on 2022-11-17, 18:52:10
thanks guys! I think that does the trick yeah. any chance this can be implemented inside corona? in the meantime I'll figure out the fusion workaround then
Title: Re: Save out bloom&glare pass with transparent background
Post by: vemod on 2022-11-18, 11:45:54
Yes, correct application of bloom and glare requires add mode, but here's a work-around:

On the bloom and glare layer, select all and copy, then add a layer mask to that layer and paste what you have copied in to the layer mask.

apply the layer mask to the layer. then in the top menu choose layer>matting>remove black matte.





Title: Re: Save out bloom&glare pass with transparent background
Post by: maru on 2022-11-18, 13:53:18
Yes, correct application of bloom and glare requires add mode, but here's a work-around:

On the bloom and glare layer, select all and copy, then add a layer mask to that layer and paste what you have copied in to the layer mask.

apply the layer mask to the layer. then in the top menu choose layer>matting>remove black matte.

No idea how reliable this is, but at first glance seems to work fine, thanks for sharing!