Rendering a single cloud layer with alpha against a black background

Started by pokoy, January 16, 2020, 05:12:17 AM

Previous topic - Next topic

pokoy

I'm trying to render a cloud with its alpha against a black background.

The camera looks down, in the normal render there's a lake object visible in the background. For the single hero-render I need it on a black background with nothing else being visible.
This doesn't work. If I turn off direct visibility for the terrain, lake and the atmosphere I'm still not getting a black background. What's more, it seems that the standard renderer renders differently from PT...

What would be the correct way to achieve this?

cyphyr

If you have the Professional edition this can be done easily with Render layers.

In the Render Layers go to the render elements tab and check  Cloud RGB and Cloud Alpha.
Set a save destination.
Render a sequence of 1 frame.
Click render Animation.

If you also check Atmo RGB and Atmo Alpha you will also be able to colour the cloud to the tone set by the atmosphere.

If you do not have the Professional edition of Terragen then the process is a little more complex.

I would suggest disabling the lake (select the node and press d) and adding a final surface layer (before the planet) with the colour set to black.
Disable the atmosphere and the cloud should render against black.
If you increase the colour of the cloud to pure white (maybe even set it to a value of 2) you can do a second render which can be an alpha for the cloud.
If you do a third render with the atmosphere back on you can use the alpha to cut out both the cloud element and the atmosphere.

Hope this helps and apologies if I have misunderstood.
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

pokoy

Thanks Richard, much appreciated. I'm on the professional version luckily. I just tried and I'm getting a normal render with no elements and no alpha included. It sort of worked yesterday, even in RTP (except for the terrain still being visible, I didn't know its color should be set to black), but it doesn't today...

Do I need to take care of the Object and Light groups in the Render layer node?

pokoy

Ah wait, I connected the Render layer node to the wrong input of the camera, corrected now, waiting for the result...

cyphyr

If you're using Render Layers you don't need to set the surface layers to black.
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

pokoy

I left Objects and Light groups untouched, they're empty.

I do get the individual cloud layer, but the background isn't really black. Also it doesn't make any difference if Atmosphere RGB is on or off, the cloud is properly lit and colored. And there's no alpha in the image at all... unchecking RGB components and using only 'Cloud Alpha' still renders a RGB image so not sure how to get a proper alpha channel that way as no alpha seems to be included in the file.

Not sure how all of this works internally but it looks like it may not be possible after all. Or I am doing it all wrong... 

It's probably better to post a file and have someone else have a look at it, I'll post something soon.

Thank you!

pokoy

Ok, seems to work now. It's a bit of an awkward workflow in that I had to use the Object groups to include terrain, shaders, water and set them to invisible, and setting 'all other objects' to visible. And now it saves separate files, but I didn't realize they are saved only if 'extra output images' is enabled... it kind of makes sense of course, but the naming of that option wasn't obvious to me.

I'm sure I'm doing it the wrong way but at least it does what I need.

Thank you Richard!!

Matt

The extra output images (Render Elements) are saved to separate files. If you enable the render element Cloud RGB (tgCloudRgb) then you don't need to make the background black in the beauty pass. But doing that could speed up the render so may be worth doing anyway. If you look at the tgCloudRgb file it always has clouds on a black background. They are premulted by the cloud alpha (which can also be saved as a separate element).
Just because milk is white doesn't mean that clouds are made of milk.

pokoy

Quote from: Matt on January 16, 2020, 05:29:00 PMThe extra output images (Render Elements) are saved to separate files. If you enable the render element Cloud RGB (tgCloudRgb) then you don't need to make the background black in the beauty pass. But doing that could speed up the render so may be worth doing anyway. If you look at the tgCloudRgb file it always has clouds on a black background. They are premulted by the cloud alpha (which can also be saved as a separate element).

Yes, it makes sense once you realize what 'extra' means. I was confused by the wording 'extra output files' should be called 'Elements' so it's clear what they do.
Output image should be called 'Final composite' or 'Beauty'. It just didn't occur to me that I need to use the extra output too to output the elements.

Also, why is alpha always an extra file? It would be perfectly fine to include alpha in the element. Then again, it allows you to mix alpha of multiple elements in one file which is a nice feature in itself...

Thanks for clarifying!

Matt

I see why it's confusing, and perhaps we should change the naming here.

Regarding alpha channels: Alpha elements are separate because some of Terragen's elements need "chromatic alpha" which can't be represented by a single alpha channel. I wish chromatic alpha was more widely recognized so that file formats and applications would support them natively, but I seem to be the only one talking about it.

https://planetside.co.uk/forums/index.php?msg=239993

Your clouds won't need chromatic alpha (unless you use coloured density inputs), but the alpha may still come out tinted slightly yellow. If so, this is caused by the atmosphere. Any amount of atmosphere between the camera and the cloud could tint the cloud RGB yellow, and it also tints the alpha yellow because (1) Terragen's elements are designed to be composited using an additive workflow, and this applies to the alpha channels too because objects and volumes mutually holdout each other, (2) atmosphere alpha is chromatic, so when it acts as holdout to the cloud alpha it doesn't just darken it, it tints it yellow.

You can avoid all this by making the atmosphere invisible (or turn off "enable primary"), then your cloud alpha will be grayscale. But in order to maintain this generality, alphas are separate images.
Just because milk is white doesn't mean that clouds are made of milk.

pokoy

Thanks for the extra information on chromatic alpha - didn't know there's such a thing but it makes perfectly sense with today's demands and software abilities. In my case, simple alpha will do as you say, but it's all much clearer now.