[SOLVED] Compositing two Cycles outputs together? (2.79) Luminance Masking

Hello! This is my first post, so if I’ve overlooked a solution, please point it out and I’ll happily be on my way.

I’m trying to do more or less exactly what @Pootle attempted back in 2014:

TLDR: Take two different textures and composite them together in a single Cycles tree.

In my case, I can get one image texture with alpha to show up over another image texture (took all night, but I’m new to Blender), but what I need to do is integrate a third texture as a luminance mask.

Blender, or at least Cycles, doesn’t seem to use that term, so it simply means applying BW data as Alpha (black=transparent, white=opaque).

As can be seen in my node tree below, I have the “base layer” texture of burlap along the bottom. In the middle, my alpha transparency 2nd image, and the mask texture (generated from an animated Musgrave node) along the top.

In image 1, the two image textures composite just fine. In image 2, you can see the desired “cloud” effect from the Musgrave generating a BW version of the transparent image.

In image 3, I plug the BW data from the Musgrave+Transparency mix in as a Factor, and come away with a mess. Note the undesired white areas not covered by the spreading area of black.

I’m currently trying to plug in a Mix RGB node in various places with various settings, but so far no luck. I’m too new to the forum to attach a .blend. Sorry. Any help or suggestions would be appreciated!

EDIT: I should mention that applying the transparent image file to the underlying burlap texture is not an option. The idea is to reveal and hide pregenrated text and images throughout the course of the animation.


Can you tell I’ve been up all night? Didn’t even occur to me to link externally. :unamused:


Also, a brief update: The inversion of the transparent image seems to be unnecessary. At some point, I thought there was an issue combining black with alpha, but I just plugged the true-color version of the image back in nothing appears to have broken.

Only shader socket connects to another shader socket, green to green. You have color connecting to a shader there, and same with the RGB node

Since there were no images packed in, I used my own. JPG doesn’t support alpha so I also hid it from the socket. Since the musgrave is used as a mask, could combine the masks first and then the color textures. Multiply is math node set to multiply

Model has a mesh, on which material or multiple materials are assigned to. Materials have properties, which can be controlled with texture maps. All material systems do this, but the interfaces change.

With node materials that hierarchy isn’t obvious because you build it yourself. The shaders you add and mix contain the material properties you can then control with textures, and can manipulate those in between. The textures may use various available texture coordinates.

Thanks for the reply!

While I’m puzzling through it, I got a bit closer to what I’m aiming at. The nodes have become remarkably simpler to look at, and I’m sorry about the image packing. Here’s an updated .blend:


The only remaining problem is the sudden drop in alpha of the final effect to what looks like 50% when I mix everything down (Top image):

The bottom image demonstrates the ability of this tree to definitely create a cutout of the alpha image with the BW data from the Musgrave.

Not sure what you’re after anymore. When you put a transparent shader in the mix, you’re making the geometry itself transparent. If you just want the text to be cut off by the combination of musgrave and its own alpha, not sure what the brown background image is doing there.

The preview you’re using in the viewport is not render preview, and the other Cycles previews aren’t reliable in a node setup with any kind of complexity. Can’t trust those when editing materials.

MaskedTextAnim_Test_ja12.blend (2.5 MB)

This has separate materials for mixing the colors, and mixing the shaders to make the text background transparent.

The musgrave texture is one of those that has values outside the 0-1 range. Negative values shown in the shot.

Also the text image has more color data, just masked by the alpha channel when viewed together. Could be relevant to know if you try to mix it just using the color values

All apologies for the confusion. Hopefully this clip I ran up in After Effects describes the intended result better:

I’ll give your .blend a look, thanks for helping!

@JA12, I looked over your .blend, but I think not understanding what I was trying to describe got in the way.

Thank you for pointing out that the Transparent node is making the geometry transparent. I’m so used to working in 2D that I was coming at this with a 2D mindset and thinking just in terms of texture RGBA values, not that 3D element.

I’ve swapped the Transparent for an RGB Input set to full white + a Diffuse.

This actually slaps the image over a solid white background prior to incorporating the animated Musgrave mask. Given all the complications with Alpha, this might be easier to work with. I’ll see what I come up with.

It only took 48 human-hours of work, but I finally got my head around @JA12’s information and got it working!

Includes cloth physics for demo purposes

TLDR: JA12 was spot on with the first suggestion about using Converter->Math->Multiply for the Alpha/Factors, and a Color->MixRGB->Mix for the RGB data.

I was over-complicating (and breaking) everything for three reasons:

  1. I’m coming from a strong 2D background, and wasn’t thinking of the 3D nature of the Materials as a relevant element.

  2. The color-coding of the node I/O sockets wasn’t making sense to me. I’m still a little confused, but I’ve read up and get the gist.

  3. I never have had a great handle on blending mode math, and Blender’s blending nodes are to video editing layer modes as stick shift is to automatic transmission. :rofl:

Once the effect started working correctly, I set up a stack of additional alpha transparencies. It looks awful without grouping, but it’s straight forward.

PS: This screenshot clearly demonstrates what JA12 was saying about the Viewport “Rendered” view being inaccurate. Note the Material previewer and the Viewport aren’t identical!

The visibility of each alpha texture is driven by unique Brightness/Contrast nodes fed directly from the Color data of the Musgrave. You could create a separate Musgrave node for each new texture, but I’m after visual cohesion.

The best part is, since the “Mix” setting of RGBMixer does not change identically colored pixels, each transparency acts independently. In other words, you can call them up one at a time, or in combinations, at any time.

SUPER happy this is finally working. Many thanks to @JA12 and my buddy Blue Hat Zach for helping me figure this out. Suddenly Cycles compositing makes a lot more sense.

I’m rendering out a test now… boom:

1 Like