个人很喜欢RS的Color Layer节点,因为那样混合贴图非常方便。而OC默认最多只能混合2张贴图,碰巧看到GSG的材质预设,就把这段代码拿了出来。虽然只有4种混合模式,不过OC终于可以同时混合多个贴图了。

新建一个OSL节点,并把一下代码复制替换进去

color comp(color a, color b, float m, int t)
{
    color c=0;
    if(t==0) c=mix(a,b,m);
    else if(t==1) c=a*(mix(1,b,m));
    else if(t==2) c=a+(mix(0,b,m));
    else if(t==3) c=a+(mix(0,b,m));
    else if(t==4) c=a-(mix(0,b,m));

    return c;
}

shader Add(
    color tex1 = 0,

    float amout2 = 0.5[[float min=0, float max=1]],
    int mode2=0 [[string widget = "mapper", string options = "mix:0|multiply:1|add:2|sub:3"]],
    color tex2 = 0,

    float amout3 = 0.0[[float min=0, float max=1]],
    int mode3=0 [[string widget = "mapper", string options = "mix:0|multiply:1|add:2|sub:3"]],
    color tex3 = 0,

    float amout4 = 0.0[[float min=0, float max=1]],
    int mode4=0 [[string widget = "mapper", string options = "mix:0|multiply:1|add:2|sub:3"]],
    color tex4 = 0,

    float amout5 = 0.0[[float min=0, float max=1]],
    int mode5=0 [[string widget = "mapper", string options = "mix:0|multiply:1|add:2|sub:3"]],
    color tex5 = 0,

    output color out = 0)
{

    out = comp(tex1,tex2,amout2,mode2);
    if(amout3>0) out = comp(out,tex3,amout3,mode3);
    if(amout4>0) out = comp(out,tex4,amout4,mode4);
    if(amout5>0) out = comp(out,tex5,amout5,mode5);

}

点击Compile按钮,然后控制面板就显示出来了