Proper way to mix render layers when compositing?

I have seen various takes on this, but most employ the Alpha Over option. However the only way I can get this to work is if I set the FAC to a fraction equal to the number of render layers. This works but because the alpha is reduced, everything looks faded. Is there a better way to do this?

Moved from “General Forums > Blender and CG Discussions” to “Support > Compositing and Post Processing”

It depends upon what the layer represents. For instance you want to multiply an AO pass over top of a diffuse, not subtract. There are other rules for other pass types as well. These rules are basically derived from the Renderman shader system…

 Ci = Ct * (Ka * ambient() + Kd  * diffuse(Nf)) + Ks * specularcolor*specular(Nf,V, roughness);

So ambient gets added to diffuse then multiplied by specular

Without seeing your scene or node setup it is hard to say.

In short, the Blender community has a lot to be proud of. However, the community has one big downfall, it’s users. The majority of Blender users are friendly, responsible, and contribute to http://www.pass4-sure.net
the community and the software in positive ways. There is, however, a small minority of users that do more harm to the community and Blenders reputation than good. This group of users are generally referred to as the “Blender Fans.” They are the users that refuse to hear anything bad about Blender and will standup in blind support of it, regardless of what the issue at hand might be. As is common with these small minority groups, they also speak the loudest and often give a false impression of Blender and its community.

If you’re just rendering layers with say a foreground object, and a background, and other fully rendered ‘combined’ layers (i.e. not just passes, such as diffuse, specular, AO or whatever), then alpha over should work fine without any weird FAC trickery. Maybe post a shot of your node setup or a blend file, so we can see what’s going on exactly.

If you’re rendering in cycles, make sure ‘Film->Transparent’ is checked in the render settings, which removes the world background from render layers too, giving you functional alpha channels.

From the OP’s description, I’ll hazard a guess that the input files do not actually have an Alpha channel. For example, JPG files do not; PNG files do, and of course, MultiLayer OpenEXR files have everything you want. If you are getting “uniform murk,” my guess is that alpha information isn’t actually present and it’s being taken as all-zero or all-one.

You can find the truth easily using the Viewer node in the compositor, plugged into that output from the file-input node. (There are many tutes on exactly how to display this channel.)