Accounting for lighting in multi-layer renders?

Recently I tried rendering a complex scene, one that was too big to fit into my video card’s RAM (GTX 670). I tried splitting it up onto different render layers, and copied over the lights to all the layers, but when I rendered it, the Daz character’s lighting & shadows looked different than when I had test-rendered it with my CPU. It’s as if Blender wasn’t properly rendering the lighting setup with the scene split into multiple layers.

I’m not sure why that happened, though. My question here, is there some trick or technique to getting proper lighting with multi-layer rendering?

I had originally found out about this because my card was choking on the scenes, and running out of RAM. I found Blender Guru’s guide to multi-layer rendering here:

But, I didn’t find any references to issues with lighting…

I would hazard a guess that it might have to do with exactly how you combined the layers: did you “add” the lights to copies of themselves? As a pragmatic way of diagnosing the problem, I’d add “Viewer” nodes to observe the outputs at each stage (where you are combining the various renders together), and see where the anomalies that you now describe might be creeping in.

When you’re building up a complex lit scene in multiple renders, you might wish to (in BI) use “layer-specific lights,” and to put the various elements which will be independent renders into appropriate layers. But, it really depends on the composition of the scene itself. The lighting rigs should be standardized, e.g. linked-to from different files if you’re doing renders in different files, but perhaps not every light in that rig should actually “shine on” everything in the scene. Yes, the lighting in a test-render might look (very) different than in the combined scene at first.

Sorry I didn’t reply last week. I got side tracked here…

I never did actually combine all the layers. I never finished the render I was working on either. It just looked off to me, and I canceled it… I’ve not tried to do a multi-layer render since. At the time I didn’t take into account, as you said, that the lighting on the individual layers may look different than the final composited image.

I’ll have to do some basic test renders with primitives and procedural textures, and see the differences between layer lighting and composited image…

Be very careful not to become confused by the many ambiguous meanings of the word, “layer.”

In the context of “layer lighting,” at least in BI, it’s talking about “the twenty little buttons.” This is what we programmer-types would call a “bitmask,” consisting of twenty independent yes/no choices, or “bits,” which are simply an attribute of the thing. Lights can be made “layer-specific,” which means that they have a layer-bitmask too, and they will only consider objects whose layer-bitmask intersects their own. (That is to say, "has at least one ‘on-bit’ in common.) Layer-specific lights ignore any non-intersecting object.

This makes layer-specific lighting a very powerful tool, and one that is often used when you are doing multi-pass compositing. But this use of the word “layer” is not the same as the notion of “multi-pass compositing” where multiple independently-rendered “data sets” are somehow mathematically merged (“composited …”) to produce a final product.

The best general strategy that I personally have found is to distinguish between what I call “basic lighting,” which is the lighting necessary to enable you to see the thing, and “stage lighting,” which is additional lighting (and, “additional shadows!”) which is intended for dramatic message and effect. Basic-lighting is usually shadowless. Stage-lighting and stage-shadows is selectively added later.

If by BI you’re referring to the Blender Internal renderer, I am not using it, and I never do use it. I always use Cycles…

I actually didn’t notice that you could place individual lights on multiple layers, aside from copying them then moving them to another layer. I just looked in the Relations tab under Object, for a light I just added in Blender (to a blank scene, even).

Otherwise I’m having trouble following what you’re really talking about here…

I don’t much understand what you mean by basic lighting and stage lighting. I’ve never divided up my scenes with lighting like that and I really don’t understand what that means.

Do you have a link to a tutorial going over this sort of thing?

Since I do not routinely use Cycles, it may well be that I am speaking of features which do not relate directly to the Cycles environment, and I cordially ask other participants to “weigh in” here, please.

The essential notion that I am speaking of is that, when you are combining multiple components into a single shot, there won’t be any single lighting source, amongst the various individually-rendered inputs, which will serve the purpose of “that light up there, over there.” When you start combining things, you’ll probably need to use nodes that select the brightest value for a particular pixel, instead of nodes that try to add them. And this suggests that the lighting which is participating in those layers should be, basically, ambient.

… which should look very, very bland.

On top of this, you add things like “highlights,” and particular “shadows,” which represent the changes from “bland.” You’re going to add these highlights, and subtract these shadows, all during the final compositing steps.

Incidentally, when I do use Cycles, I use it as a source of “bland lighting,” and I use BI (yes, at the same time) to contribute the directional spotlights and shadows. Cycles, to me, is “a great soft-box.”

And … shadows were an important “eye-opener” for me, when I realized just how expensive shadow calculations can be. I learned to do shadowless base calculations, then to use “shadow-only spotlights” and other tricks to add “convincing shadows” exactly where I wanted them to be and nowhere else. (The products are always short videos.)

“The old photographer in me” would never do any shooting without my trusty “spot meter,” which can measure the amount of light falling at any particular point. Also drilled into my head was Ansel Adams’ Zone System. You can use the same ideas when constructing and lighting a scene. (Blender allows you to measure the lighting of any point – and the “OpenGL Previews” work just fine for this in many cases. It also allows you to pull a histogram.)

What I called “basic lighting” is shadowless lighting that is sufficient to be sure that no point of the scene is opaque-black, and to bring the basic lighting curve more-or-less to the bell-curve histogram shape that the Zone System says it should be. The lighting in every layer should be more-or-less the same shape. When you combine the layers, you select the brightest illumination for that point. (It is also helpful to use several color tints in these layers.)

On top of this are “highlights” and “shadows.” When viewed by themselves, these layers might be fairly dim … or, you might need to use a curves-node to dim them … because these layers are added (or, for shadows, subtracted) over the basic light. They are put exactly where they are needed. Once again, by studying histograms you can calculate how much is needed. The “curves” node is useful for fine adjustment.

Shadows are ordinarily very expensive: a lot of render-time is spent calculating exactly where shadows fall. Shadow-spotlights, strategically placed and calculated separately, are a very efficient way to add plausible shadows. There are not as many shadows in the scene as there “should be,” but they’re the shadows that will get noticed and that need to be there for that reason. Shadows are a critical component in maintaining the 3D illusion: that the viewer is looking into a 3D world not at a flat screen. But they can also be distracting. Only CG gives you the strange luxury of treating light and shadows separately, and of rigging a light that doesn’t cast a shadow.

Shadow information can also be added, with (say) a slight bluish tint. In the real world, out of doors, shaded areas are slightly blue with sky-light. You can take the shadow-information and not only use it to subtract light from areas but also to inject a tint into the darkness you’ve created.