1
$\begingroup$

I'm having some difficulty because even though the Transparent Sky option is just what I need, I don't want it for every pass in my scene - I need the sky to be rendered too in other render layers.

There is a BlenderArtists thread (can't find the URL at the moment) where the suggested solution was to duplicate the whole scene and have one of the scenes render with a transparent background, but that would surely kill my render time for this animation to have to build the BVH for a whole mountain landscape in two scenes.

There is a BSE question that somewhat addresses this kind of issue, but I believe the sky is not lighting the terrain. (It would be nice if I'm wrong... can't download the .blend to check) I need my terrain to be lit by the sky color.

Things I've tried include:

Setting a render pass with the entire material as a Holdout shader (but it just shows black without sky transparency checked).

Various combinations of render layers... but I can't get something that just serves as a mask between the landscape and sky.

I've considered using Material IDs or Object IDs, but concluded that it will cause problems for tree leaves on the mountain horizon, which rely on their texture alpha to look like leaves instead of square planes.

Update: Based on the answer suggested, I created a makeshift mask that separates the terrain (foreground) from the sky (background). Basically I used a Color Ramp to squash all non-black values to white. This might be a solution for some cases but it's certainly not elegant, as the horizon is not anti-aliased. Also if the sky is black (like space or a very dark night sky) it doesn't work at all.

Sky mask forced with a Color Ramp - not ideal

Update 2: I figured out that I can make a sky mask by rendering a mist pass at extremely far away values (beyond all geometry) leaving just the sky white and all else black. This solves the anti-aliasing problem, the only drawback being that it prevents me from doing an actual mist pass in this same scene... so it's still not a total solution but good to know about.

Sky mask created using a mist pass at extreme values

Edit: Since posting the above screen shot I've realized the mist's Start distance doesn't need to be extremely far away - it can be any distance if the mist Depth is set to 0.00, and if given a closer Start value such as 0.0001 it may actually render faster than with a far away one (although a mist pass calculates quickly in any case).

Is there anything else I haven't thought of?

$\endgroup$

2 Answers 2

1
$\begingroup$

If you go to "renderlayers -> Passes" You can activate the "environment" pass. This will deliver the background as an RGB value in the compositor. All abjects are now black. This gives you the freedom to combine them as you wish.

$\endgroup$
1
  • $\begingroup$ The only trouble is the sky can only be delivered as an RGB value, not solid white for a mask or transparent against non-transparent. Thanks for the suggestion though. Based on what you said I came up with a sort of hackish solution which I will now edit into my original post. I'm still hoping there's a better way. $\endgroup$
    – Mentalist
    Commented Jul 6, 2015 at 0:24
1
$\begingroup$

I got it... the answer is actually simple: Do set the sky to transparent in the main scene (it will still receive lighting from the sky as long as "Use Environment" remains checked). Then create a new empty scene and assign its World the same sky. For the render layer in the "Sky Scene" leave "Use Environment" checked, but you can uncheck "Use Surfaces" and "Use Hair" as this may speed up render time. Since the new scene contains only the sky, it won't contribute significantly to the render time.

Then add a camera to the "Sky Scene". Add a Copy Transforms constraint to it with the Target being your main scene's Camera. Also, in the Camera tab choose from the drop-down button your first camera's configuration (chances are it's named "Camera").

Then set up your nodes for compositing as needed.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .