node group input

Hi guys,

I have a question concerning node groups.

I am working on a rust material; quite a complex set up, overall; I didn’t experience any problems with the shader itself but, with almost 40 nodes and an important maze of noodles, I thought I made a group out of it.

My question concerns making group inputs for images; in my setup, I have two masks images (B&W) that I want the group’s input interface to offer the color input so that it is possible selecting the external mask file from outside the group; the reason for this is that things like the rust or the scratches textures can be packed with the group, but masks are unique for each object/UV; but I found no way of creating a color input from the masks; I thought of substituting them for a diffuse BSDF, but that didn’t work: it upset completely the whole render.

Is my assumption that B&W masks don’t work through a diffuse correctly? if so, does anybody know why? And, is there any way of getting the user to select the mask image without needing to open the group?

I am running Blender 2.7.8.1. on a Windows 7 machine. I am not sure I’ve explained the problem clearly; please let me know if you need any further information.

Looking forward to your response,

Kind Regards,

Sept

What are you doing with the masks inside the nodegroup?

If, for example, you need to sample the input texture (your masks) with other coordinates different from the coordinate the render is currently using, then you can’t do this easily, at least with nodes.

The only two ways I know that work, is to use OSL, where you can input the reference of the image to the script, as OSL can deal with this situation normally; or with pynodes where you need to check the input link to get the reference of the connected image, and then change an inside dummy image node to use the same image.

The later, involves more knowledge of Blender API itself, than shading technics (as it has nothing to do with cycles), but works fairly ok when you code it correctly.

Hi Secrop,

Thank you for your answer. The reason why I use masks in a node group is because they are the only way I know of of generating areas in the exact places, ideal for the spotty nature of rust; the masks are used as factor of the color mix between the diffuse BSDF and the rust texture. But when I place the mask inside a group, all hell breaks loose.

This problem is not a deal breaker, but I am curious if it is the case that masks are incompatible with groups; it will take a bit chunk of usability from groups; but even if this is an issue, groups are great anyway. For a proof of concept scenario of the issue, I have included screen shot; see below.


Looking forward to any idea out there,

Kind Regards,

Sept

for such a setup, something like this can be enough:



(or am I missing something?)

Hi Secrop,

Thank you for your fast (and accurate) answer.

You are right. My “noodle soup” (and, one could argue, my brain) was so dense, that the forest just didn’t let me see the trees. Just after I sent my last response a few hours ago, I realized the problem (after having to get down to basics to explain the issue) and corrected it without any trouble. I’ve never played with node groups before and when I saw the rust shader was really complicated, I thought about node groups: packaging the shader as a black box, in which only relevant data (such as the bump intensity, the base color, or … the mask) is available. A distribution dream.

My problem was that I was trying to get the mask input from the diffuse color socket; I was blindsided into thinking that to get the mask image input I needed a color input socket rather than- as was the case- a vector socket, to get it (as it seems obvious now) from the very factor of the mix shader which is actually receiving it. Indeed, node configurations can get so complicated that one can easily forget the simple underlying principles.

Once again, thank you for your help and support.

Kind Regards,

Sept