Node Material and Colour Pass problem

Hey everyone!

I’m attempting to mix two materials together using the material nodes. I’ve kind of got the results I want but I’m not sure I’ve managed to do it the best way possible as I haven’t used material nodes much before.

The problem I have is trying to get the colour pass in the compositor to show the colours of the two materials used in the Node Material at the same time. It seems that depending on which material you have highlighted/selected in the material node tree decides which colour will be shown in the colour pass when rendering. I need both materials colours to show at the same time; not one or the other. This is important for compositing the AO pass with the Colour Pass. Does anyone know if it can be done?

I’ve attached a blend file and these images as it’s hard for me to just explain the problem with words. There are three cubes; the cube in the middle is using the node material whilst the other cubes either side are just using the basic materials that are used to make the node material. It’s the centre cube that is the problem.

One extra problem I can’t work out is… why does the cube on the left render a black hole instead of a transparent hole?

blend file:

Thanks in advance

n.b. this is just an example file.


I have just one question: why don’t you use the same UV texture for the grey and pinkish color? If it’s for different bump values, you could use a stencil map (the same as your alpha map) instead.

Your render settings are quite high for this kind of scene. If it’s just an example file, you could keep the OSA at 5 and use AAO instead of Raytrace AO, render times will be divided by 5. It’s not a big deal but you will gain time to tweak your parameters.

For the black round shapes: it’s a shadow. Decrease your Max Dist Value in the AO panel. Note that if you use AAO you won’t see the shadow.
If with a value of 0 for the Max Dist, you still see some black part, that’s because the cube is too close from the ground. Separate them a little bit.

Hey bupla!

Thanks again for your help. It would have taken me ages to realize the black holes were due to AO distance. That’s sorted nicely now. Thanks!

I’m not sure I totally understand your first question. However, let me explain a little more background info. I did originally attempt to make this material without using nodes (just one material), but I wanted the pinkish texture to have a different colour ramp than the grey metallic material. This obviously meant having two separate materials otherwise they would have had to share the same colour ramp. This then led me on to attempting to combine them using nodes so that each separate material could retain it’s specific colour ramp.

All this leaves me with the colour pass problem. Maybe I’m making things more complicated than they need to be. I’m just not aware of a different approach that’s all.

p.s. You’re right about the render settings; they were quite high. I usually have them high to check for any artifacts around edges. Forgot to turn them down.

Maybe could you try to achieve what you want with a blend texture instead of a color map?

The stencil texture I told you is a possibility to create some masks within textures.
See here for more details on this technique.

Hey thanks bupla! I think I just solved the problem just as you were posting your reply. Here’s a screenshot of how I did it. Not sure if it’s what you originally suggested, but it did involve using the black hole texture as a stencil instead of an alpha mask on the pink material, and then reusing it in the node tree for the alpha factor input on the mix node.

Thanks again for your help.

p.s. wonderful website full of great illustrations. pity my french is very limited.


Well done for the stencil and thanks for your comment!

I’ve discovered that this problem is only partially solved.

It’s still an issue that only one of the materials information eg. colour pass, reflection pass, diffuse pass and so on, gets sent to the compositor. This makes it pretty much impossible to do any compositing with node materials. Very frustrating.

For example… if I create a node material that is a mixture of one material that is reflective and another that isn’t reflective; instead of the combined mix of the materials being sent to the compositor, only one material’s (the material that is selected in the node tree) reflection pass gets sent.

Is there a way around this problem? as it kind of makes node materials pretty useless when you want to do compositing with them.

futar, I downloaded your file and noticed you did not have the Refl (reflection) pass enabled, only Combined, Z and Col. You need to enable the other passes desired in order to use them in nodes.

Sorry I should have made it clear that I’m not talking about my blend file anymore; I’m just talking in general terms. I do know how to enable render passes.

The problem is, generally speaking, that node materials that are made up of more than one material only deliver one of the materials passes when you enable them instead of a mix of the two; wether it be the colour pass or the reflection pass or whatever.

Hope this makes sense

I have the exactly same problem! It’s impossible to make a realistic glass with reflections and refractions…

Very, very frustrating.

Oh, looks like I found our solution! It’s SO ridiculous that i can’t believe! :eek: :o
(sorry my poor english)
Do you use a exclusive material for “node”, right? And if this material is “raytracing”, Blender get crazy, cause they are 2 raytracing materials (one ‘node’ and other “glass”) for 1 raytracing object… To fix it, just turn of “raytracing” in the “node” material, leaving turned on raytracing of the glass material. Compositing will be perfect for any Mixes (Add, Screen… anyone).

Yeah! See them:


Thanks for trying to help pauloup; but I think you have misunderstood my problem. It’s not just to do with reflections and raytracing, it’s to do with certain ‘passes’, such as colour, specular, reflection when using two or more materials combined in a node material.

To start off with I only noticed the problem with the colour pass. You can see this problem in the first blend file I posted. I did manage to discover a workaround for this problem with the help of bupla, but I can’t get the same workaround to work for the reflection pass and other passes.

In the new blend file posted here hopefully it will be more apparent exactly what the problem is if you pay attention to the cube in the centre of the render.

Now… when you select the ‘ScanMat’ material in the material node editor and then hit render, you should notice in the compositor that the reflection pass for the centre cube shows no reflection for the circle in the middle of the cube. This is because the original ‘ScanMat’ material isn’t reflective.

However… when you select the ‘Alumi’ material in the node material editor and hit render, you should notice in the compositor that the whole of the cube in the centre becomes reflective.

What I feel needs to be happening is a mixture of the two. In other words, you only see reflections where the circle is on the centre cube. Does anyone know how to get this to work?

N.B. I know this could be solved by using just one material and not using nodes at all. However I’m trying to mix two materials which have different colour ramps. The only way I know of to do this is with nodes.


Well, after many attempts to work on this problem, it could be a bug.
The reflection pass doesn’t seem to work correctly with node materials.
First as futar said, I don’t understand why the render pass changes according to the material node you have selected in the node material window, it’s curious.
Second, if you use node materials to mask some parts of the reflection, the reflection pass will show the entire reflection unmasked.

Not just the reflection pass; the colour pass and maybe others too (haven’t tested all of them) don’t seem to function as you would hope when using node materials.

If it is a bug, it definitely needs fixing as it makes complex node materials a nightmare to try and composite with.

Now I understand. The problem get just in separated passes. Yeah, it look like a bug. :frowning:

futar: there may be a workaround for your problem, but I don’t know if it fits your project. I understand that you want to achieve your results with node materials, but there is another way.
If for your cube, you want a reflective part, and a non-reflective one, and keep these differences in the reflection pass, you could use vertex groups, each one assign to a different material.
It will work for the reflection pass, and you could have two color ramps (or use a blend texture as I said before). The inconvenient is that you have to “model” the different parts, i.e. the gray circle, which will be longer.
It won’t solve your problem, but it could help.

Thanks for the suggestion bupla. I’ll keep it in mind for other projects, but it wouldn’t be feasible for the project I’m working on at the moment. The change in material occurs on a flat surface and is dependent on the texture. So it would be impossible (for me anyway) to model the different parts.

Perhaps I will try adding this problem to the bug tracker. See what response I get.