Example #1
0
    def init(node_tree, init_dif_spec=True, start_pos_x=0, start_pos_y=0):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        :param start_pos_x: x start position
        :type start_pos_x: int
        :param start_pos_y: y start position
        :type start_pos_y: int
        """

        pos_x_shift = 185

        # init parent
        if init_dif_spec:
            DifSpec.init(node_tree)

        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]

        # move existing
        output_n.location.x += pos_x_shift

        # nodes creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = Lamp.SEC_GEOM_NODE
        sec_geom_n.label = Lamp.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 2300)
        sec_geom_n.uv_layer = _MESH_consts.none_uv

        mask_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        mask_tex_n.name = Lamp.MASK_TEX_NODE
        mask_tex_n.label = Lamp.MASK_TEX_NODE
        mask_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 2400)

        lampmask_mixr_gn = node_tree.nodes.new("ShaderNodeGroup")
        lampmask_mixr_gn.name = Lamp.LAMPMASK_MIX_GROUP_NODE
        lampmask_mixr_gn.label = Lamp.LAMPMASK_MIX_GROUP_NODE
        lampmask_mixr_gn.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 2300)
        lampmask_mixr_gn.node_tree = lampmask_mixer.get_node_group()

        out_add_lampmask_n = node_tree.nodes.new("ShaderNodeMixRGB")
        out_add_lampmask_n.name = Lamp.OUT_ADD_LAMPMASK_NODE
        out_add_lampmask_n.label = Lamp.OUT_ADD_LAMPMASK_NODE
        out_add_lampmask_n.location = (output_n.location.x - pos_x_shift, start_pos_y + 1950)
        out_add_lampmask_n.blend_type = "ADD"
        out_add_lampmask_n.inputs['Fac'].default_value = 1

        # links creation
        node_tree.links.new(mask_tex_n.inputs['Vector'], sec_geom_n.outputs["UV"])

        node_tree.links.new(lampmask_mixr_gn.inputs["Lampmask Tex Alpha"], mask_tex_n.outputs["Value"])
        node_tree.links.new(lampmask_mixr_gn.inputs["Lampmask Tex Color"], mask_tex_n.outputs["Color"])
        node_tree.links.new(lampmask_mixr_gn.inputs["UV Vector"], sec_geom_n.outputs["UV"])

        node_tree.links.new(out_add_lampmask_n.inputs["Color1"], lampmask_mixr_gn.outputs["Lampmask Addition Color"])
        node_tree.links.new(out_add_lampmask_n.inputs["Color2"], out_mat_n.outputs["Color"])

        node_tree.links.new(output_n.inputs["Color"], out_add_lampmask_n.outputs["Color"])
Example #2
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]

        # move existing
        for node in node_tree.nodes:
            if node.location.x > pos_x_shift:
                node.location.x += pos_x_shift

        # node creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = DifSpecMultDifSpec.SEC_GEOM_NODE
        sec_geom_n.label = DifSpecMultDifSpec.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)

        mult_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        mult_tex_n.name = DifSpecMultDifSpec.MULT_TEX_NODE
        mult_tex_n.label = DifSpecMultDifSpec.MULT_TEX_NODE
        mult_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        mult_base_col_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        mult_base_col_mix_n.name = DifSpecMultDifSpec.MULT_BASE_COL_MIX_NODE
        mult_base_col_mix_n.label = DifSpecMultDifSpec.MULT_BASE_COL_MIX_NODE
        mult_base_col_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1400)
        mult_base_col_mix_n.blend_type = "MULTIPLY"
        mult_base_col_mix_n.inputs['Fac'].default_value = 1

        mult_base_a_mix_n = node_tree.nodes.new("ShaderNodeMath")
        mult_base_a_mix_n.name = DifSpecMultDifSpec.MULT_BASE_A_MIX_NODE
        mult_base_a_mix_n.label = DifSpecMultDifSpec.MULT_BASE_A_MIX_NODE
        mult_base_a_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1700)
        mult_base_a_mix_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(mult_tex_n.inputs['Vector'], sec_geom_n.outputs['UV'])

        node_tree.links.new(mult_base_col_mix_n.inputs['Color1'], base_tex_n.outputs['Color'])
        node_tree.links.new(mult_base_col_mix_n.inputs['Color2'], mult_tex_n.outputs['Color'])
        node_tree.links.new(mult_base_a_mix_n.inputs[0], base_tex_n.outputs['Value'])
        node_tree.links.new(mult_base_a_mix_n.inputs[1], mult_tex_n.outputs['Value'])

        node_tree.links.new(vcol_mult_n.inputs['Color2'], mult_base_col_mix_n.outputs['Color'])
        node_tree.links.new(spec_mult_n.inputs['Color2'], mult_base_a_mix_n.outputs['Value'])
Example #3
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        # init parent
        DifSpec.init(node_tree)
Example #4
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        # init parent
        DifSpec.init(node_tree)
Example #5
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]
        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_col_n = node_tree.nodes[DifSpec.SPEC_COL_NODE]

        # move existing
        output_n.location.x += pos_x_shift

        # nodes creation
        lum_boost_val_n = node_tree.nodes.new("ShaderNodeValue")
        lum_boost_val_n.name = lum_boost_val_n.label = DifLumSpec.LUM_BOOST_VALUE_NODE
        lum_boost_val_n.location = (spec_col_n.location.x,
                                    spec_col_n.location.y + 100)

        lum_boost_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        lum_boost_mix_n.name = lum_boost_mix_n.label = DifLumSpec.LUM_BOOST_MIX_NODE
        lum_boost_mix_n.location = (out_mat_n.location.x,
                                    out_mat_n.location.y + 300)
        lum_boost_mix_n.blend_type = "MULTIPLY"
        lum_boost_mix_n.inputs["Fac"].default_value = 1.0

        lum_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        lum_mix_n.name = lum_mix_n.label = DifLumSpec.LUM_MIX_NODE
        lum_mix_n.location = (out_mat_n.location.x + pos_x_shift,
                              out_mat_n.location.y + 200)
        lum_mix_n.blend_type = "MIX"

        # links creation
        node_tree.links.new(lum_boost_mix_n.inputs['Color1'],
                            lum_boost_val_n.outputs['Value'])
        node_tree.links.new(lum_boost_mix_n.inputs['Color2'],
                            base_tex_n.outputs['Color'])

        node_tree.links.new(lum_mix_n.inputs['Fac'],
                            base_tex_n.outputs['Color'])
        node_tree.links.new(lum_mix_n.inputs['Color1'],
                            out_mat_n.outputs['Color'])
        node_tree.links.new(lum_mix_n.inputs['Color2'],
                            lum_boost_mix_n.outputs['Color'])

        node_tree.links.new(output_n.inputs['Color'],
                            lum_mix_n.outputs['Color'])
Example #6
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree, disable_remap_alpha=True)

        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        opacity_mult_n = node_tree.nodes[DifSpec.OPACITY_NODE]

        # move existing
        opacity_mult_n.location.y -= 200

        # nodes creation
        sec_uv_n = node_tree.nodes.new("ShaderNodeUVMap")
        sec_uv_n.name = DifSpecOverDifOpac.SEC_UVMAP_NODE
        sec_uv_n.label = DifSpecOverDifOpac.SEC_UVMAP_NODE
        sec_uv_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)
        sec_uv_n.uv_map = _MESH_consts.none_uv

        over_tex_n = node_tree.nodes.new("ShaderNodeTexImage")
        over_tex_n.name = DifSpecOverDifOpac.OVER_TEX_NODE
        over_tex_n.label = DifSpecOverDifOpac.OVER_TEX_NODE
        over_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)
        over_tex_n.width = 140

        over_mix_node = node_tree.nodes.new("ShaderNodeMixRGB")
        over_mix_node.name = DifSpecOverDifOpac.OVER_MIX_NODE
        over_mix_node.label = DifSpecOverDifOpac.OVER_MIX_NODE
        over_mix_node.location = (start_pos_x + pos_x_shift * 3,
                                  start_pos_y + 1300)
        over_mix_node.blend_type = "MIX"

        # links creation
        node_tree.links.new(over_tex_n.inputs['Vector'],
                            sec_uv_n.outputs['UV'])

        node_tree.links.new(over_mix_node.inputs['Fac'],
                            over_tex_n.outputs['Alpha'])
        node_tree.links.new(over_mix_node.inputs['Color1'],
                            base_tex_n.outputs['Color'])
        node_tree.links.new(over_mix_node.inputs['Color2'],
                            over_tex_n.outputs['Color'])

        node_tree.links.new(vcol_mult_n.inputs[1],
                            over_mix_node.outputs['Color'])
Example #7
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        # init parents
        DifSpec.init(node_tree)
        StdAddEnv.add(node_tree, DifSpec.GEOM_NODE, DifSpec.SPEC_COL_NODE,
                      DifSpec.BASE_TEX_NODE, DifSpec.OUT_MAT_NODE,
                      DifSpec.COMPOSE_LIGHTING_NODE)
Example #8
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        # init parents
        DifSpec.init(node_tree)
        StdAddEnv.add(node_tree,
                      DifSpec.GEOM_NODE,
                      DifSpec.SPEC_COL_NODE,
                      DifSpec.BASE_TEX_NODE,
                      DifSpec.OUT_MAT_NODE,
                      DifSpec.OUTPUT_NODE)
Example #9
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]
        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_col_n = node_tree.nodes[DifSpec.SPEC_COL_NODE]

        # move existing
        output_n.location.x += pos_x_shift

        # nodes creation
        lum_boost_val_n = node_tree.nodes.new("ShaderNodeValue")
        lum_boost_val_n.name = lum_boost_val_n.label = DifLumSpec.LUM_BOOST_VALUE_NODE
        lum_boost_val_n.location = (spec_col_n.location.x, spec_col_n.location.y + 100)

        lum_boost_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        lum_boost_mix_n.name = lum_boost_mix_n.label = DifLumSpec.LUM_BOOST_MIX_NODE
        lum_boost_mix_n.location = (out_mat_n.location.x, out_mat_n.location.y + 300)
        lum_boost_mix_n.blend_type = "MULTIPLY"
        lum_boost_mix_n.inputs["Fac"].default_value = 1.0

        lum_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        lum_mix_n.name = lum_mix_n.label = DifLumSpec.LUM_MIX_NODE
        lum_mix_n.location = (out_mat_n.location.x + pos_x_shift, out_mat_n.location.y + 200)
        lum_mix_n.blend_type = "MIX"

        # links creation
        node_tree.links.new(lum_boost_mix_n.inputs['Color1'], lum_boost_val_n.outputs['Value'])
        node_tree.links.new(lum_boost_mix_n.inputs['Color2'], base_tex_n.outputs['Color'])

        node_tree.links.new(lum_mix_n.inputs['Fac'], base_tex_n.outputs['Color'])
        node_tree.links.new(lum_mix_n.inputs['Color1'], out_mat_n.outputs['Color'])
        node_tree.links.new(lum_mix_n.inputs['Color2'], lum_boost_mix_n.outputs['Color'])

        node_tree.links.new(output_n.inputs['Color'], lum_mix_n.outputs['Color'])
Example #10
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        opacity_mult_n = node_tree.nodes[DifSpec.OPACITY_NODE]

        # move existing
        opacity_mult_n.location.y -= 200

        # nodes creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = DifSpecOverDifOpac.SEC_GEOM_NODE
        sec_geom_n.label = DifSpecOverDifOpac.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)
        sec_geom_n.uv_layer = _MESH_consts.none_uv

        over_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        over_tex_n.name = DifSpecOverDifOpac.OVER_TEX_NODE
        over_tex_n.label = DifSpecOverDifOpac.OVER_TEX_NODE
        over_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        over_mix_node = node_tree.nodes.new("ShaderNodeMixRGB")
        over_mix_node.name = DifSpecOverDifOpac.OVER_MIX_NODE
        over_mix_node.label = DifSpecOverDifOpac.OVER_MIX_NODE
        over_mix_node.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1300)
        over_mix_node.blend_type = "MIX"

        # links creation
        node_tree.links.new(over_tex_n.inputs['Vector'], sec_geom_n.outputs['UV'])

        node_tree.links.new(over_mix_node.inputs['Fac'], over_tex_n.outputs['Value'])
        node_tree.links.new(over_mix_node.inputs['Color1'], base_tex_n.outputs['Color'])
        node_tree.links.new(over_mix_node.inputs['Color2'], over_tex_n.outputs['Color'])

        node_tree.links.new(vcol_mult_n.inputs['Color2'], over_mix_node.outputs['Color'])
Example #11
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        # init parents
        DifSpec.init(node_tree)
        StdAddEnv.add(
            node_tree, DifSpec.GEOM_NODE,
            node_tree.nodes[DifSpec.SPEC_COL_NODE].outputs['Color'],
            node_tree.nodes[
                DifSpec.REMAP_ALPHA_GNODE].outputs['Weighted Alpha'],
            node_tree.nodes[DifSpec.OUT_MAT_NODE].outputs['Normal'],
            node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE].inputs['Env Color'])
Example #12
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        compose_lighting_n = node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]

        # move existing
        out_mat_n.location.x += pos_x_shift
        compose_lighting_n.location.x += pos_x_shift
        output_n.location.x += pos_x_shift

        # node creation
        spec_diff_mult_n = node_tree.nodes.new("ShaderNodeMixRGB")
        spec_diff_mult_n.name = DifSpecWeight.SPEC_DIFF_MULT_NODE
        spec_diff_mult_n.label = DifSpecWeight.SPEC_DIFF_MULT_NODE
        spec_diff_mult_n.location = (start_pos_x + pos_x_shift * 5,
                                     start_pos_y + 1900)
        spec_diff_mult_n.blend_type = "MULTIPLY"
        spec_diff_mult_n.inputs['Fac'].default_value = 1.0

        # links creation
        node_tree.links.new(spec_diff_mult_n.inputs['Color1'],
                            spec_mult_n.outputs['Color'])
        node_tree.links.new(spec_diff_mult_n.inputs['Color2'],
                            vcol_mult_n.outputs['Color'])

        node_tree.links.new(out_mat_n.inputs['Spec'],
                            spec_diff_mult_n.outputs['Color'])
Example #13
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]

        # nodes creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = DifSpecOverDifOpac.SEC_GEOM_NODE
        sec_geom_n.label = DifSpecOverDifOpac.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)

        over_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        over_tex_n.name = DifSpecOverDifOpac.OVER_TEX_NODE
        over_tex_n.label = DifSpecOverDifOpac.OVER_TEX_NODE
        over_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        over_mix_node = node_tree.nodes.new("ShaderNodeMixRGB")
        over_mix_node.name = DifSpecOverDifOpac.OVER_MIX_NODE
        over_mix_node.label = DifSpecOverDifOpac.OVER_MIX_NODE
        over_mix_node.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1300)
        over_mix_node.blend_type = "MIX"

        # links creation
        node_tree.links.new(over_tex_n.inputs['Vector'], sec_geom_n.outputs['UV'])

        node_tree.links.new(over_mix_node.inputs['Fac'], over_tex_n.outputs['Value'])
        node_tree.links.new(over_mix_node.inputs['Color1'], base_tex_n.outputs['Color'])
        node_tree.links.new(over_mix_node.inputs['Color2'], over_tex_n.outputs['Color'])

        node_tree.links.new(vcol_mult_n.inputs['Color2'], over_mix_node.outputs['Color'])
Example #14
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        lighting_eval_n = node_tree.nodes[DifSpec.LIGHTING_EVAL_NODE]
        compose_lighting_n = node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]
        vcol_scale_n = node_tree.nodes[DifSpec.VCOLOR_SCALE_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]

        # move existing
        lighting_eval_n.location.x += pos_x_shift
        compose_lighting_n.location.x += pos_x_shift
        output_n.location.x += pos_x_shift

        # node creation
        spec_diff_mult_n = node_tree.nodes.new("ShaderNodeVectorMath")
        spec_diff_mult_n.name = DifSpecWeight.SPEC_DIFF_MULT_NODE
        spec_diff_mult_n.label = DifSpecWeight.SPEC_DIFF_MULT_NODE
        spec_diff_mult_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1900)
        spec_diff_mult_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(spec_diff_mult_n.inputs[0], spec_mult_n.outputs[0])
        node_tree.links.new(spec_diff_mult_n.inputs[1], vcol_scale_n.outputs[0])

        node_tree.links.new(compose_lighting_n.inputs['Specular Color'], spec_diff_mult_n.outputs[0])
Example #15
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]

        # move existing
        out_mat_n.location.x += pos_x_shift
        output_n.location.x += pos_x_shift

        # node creation
        spec_diff_mult_n = node_tree.nodes.new("ShaderNodeMixRGB")
        spec_diff_mult_n.name = DifSpecWeight.SPEC_DIFF_MULT_NODE
        spec_diff_mult_n.label = DifSpecWeight.SPEC_DIFF_MULT_NODE
        spec_diff_mult_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1900)
        spec_diff_mult_n.blend_type = "MULTIPLY"
        spec_diff_mult_n.inputs['Fac'].default_value = 1.0

        # links creation
        node_tree.links.new(spec_diff_mult_n.inputs['Color1'], spec_mult_n.outputs['Color'])
        node_tree.links.new(spec_diff_mult_n.inputs['Color2'], vcol_mult_n.outputs['Color'])

        node_tree.links.new(out_mat_n.inputs['Spec'], spec_diff_mult_n.outputs['Color'])
Example #16
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]
        compose_lighting_n = node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_col_n = node_tree.nodes[DifSpec.SPEC_COL_NODE]

        # move existing
        output_n.location.x += pos_x_shift * 4

        # nodes creation
        lum_boost_val_n = node_tree.nodes.new("ShaderNodeValue")
        lum_boost_val_n.name = lum_boost_val_n.label = DifLumSpec.LUM_BOOST_VALUE_NODE
        lum_boost_val_n.location = (spec_col_n.location.x,
                                    spec_col_n.location.y + 100)

        lum_boost_mix_n = node_tree.nodes.new("ShaderNodeVectorMath")
        lum_boost_mix_n.name = lum_boost_mix_n.label = DifLumSpec.LUM_BOOST_MIX_NODE
        lum_boost_mix_n.location = (compose_lighting_n.location.x,
                                    compose_lighting_n.location.y + 200)
        lum_boost_mix_n.operation = "MULTIPLY"

        lum_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        lum_mix_n.name = lum_mix_n.label = DifLumSpec.LUM_MIX_NODE
        lum_mix_n.location = (compose_lighting_n.location.x + pos_x_shift * 2,
                              compose_lighting_n.location.y + 100)
        lum_mix_n.blend_type = "MIX"

        lum_a_inv_n = node_tree.nodes.new("ShaderNodeMath")
        lum_a_inv_n.name = lum_a_inv_n.label = DifLumSpec.LUM_A_INVERSE_NODE
        lum_a_inv_n.location = (compose_lighting_n.location.x +
                                pos_x_shift * 2,
                                compose_lighting_n.location.y - 300)
        lum_a_inv_n.operation = "SUBTRACT"
        lum_a_inv_n.use_clamp = True
        lum_a_inv_n.inputs[
            0].default_value = 0.999999  # TODO: change back to 1.0 after bug is fixed: https://developer.blender.org/T71426

        lum_out_shader_n = node_tree.nodes.new("ShaderNodeEeveeSpecular")
        lum_out_shader_n.name = lum_out_shader_n.label = DifLumSpec.LUM_OUT_SHADER_NODE
        lum_out_shader_n.location = (compose_lighting_n.location.x +
                                     pos_x_shift * 3,
                                     compose_lighting_n.location.y - 200)
        lum_out_shader_n.inputs["Base Color"].default_value = (0.0, ) * 4
        lum_out_shader_n.inputs["Specular"].default_value = (0.0, ) * 4

        # links creation
        node_tree.links.new(lum_boost_mix_n.inputs[0],
                            lum_boost_val_n.outputs['Value'])
        node_tree.links.new(lum_boost_mix_n.inputs[1],
                            base_tex_n.outputs['Color'])

        node_tree.links.new(lum_mix_n.inputs['Fac'],
                            base_tex_n.outputs['Alpha'])
        node_tree.links.new(lum_mix_n.inputs['Color1'],
                            compose_lighting_n.outputs['Color'])
        node_tree.links.new(lum_mix_n.inputs['Color2'],
                            lum_boost_mix_n.outputs[0])

        node_tree.links.new(lum_a_inv_n.inputs[1],
                            compose_lighting_n.outputs['Alpha'])

        node_tree.links.new(lum_out_shader_n.inputs['Emissive Color'],
                            lum_mix_n.outputs['Color'])
        node_tree.links.new(lum_out_shader_n.inputs['Transparency'],
                            lum_a_inv_n.outputs['Value'])

        node_tree.links.new(output_n.inputs['Surface'],
                            lum_out_shader_n.outputs['BSDF'])
Example #17
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]

        # delete existing
        node_tree.nodes.remove(node_tree.nodes[DifSpec.OPACITY_NODE])

        # move existing
        for node in node_tree.nodes:
            if node.location.x > start_pos_x + pos_x_shift:
                node.location.x += pos_x_shift * 2

        # node creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = sec_geom_n.label = DifSpecOclu.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)
        sec_geom_n.uv_layer = _MESH_consts.none_uv

        oclu_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        oclu_tex_n.name = oclu_tex_n.label = DifSpecOclu.OCLU_TEX_NODE
        oclu_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        oclu_sep_rgb_n = node_tree.nodes.new("ShaderNodeSeparateRGB")
        oclu_sep_rgb_n.name = oclu_sep_rgb_n.label = DifSpecOclu.OCLU_SEPARATE_RGB_NODE
        oclu_sep_rgb_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1200)

        oclu_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        oclu_mix_n.name = oclu_mix_n.label = DifSpecOclu.OCLU_MIX_NODE
        oclu_mix_n.location = (start_pos_x + pos_x_shift * 4, start_pos_y + 1400)
        oclu_mix_n.blend_type = "MULTIPLY"
        oclu_mix_n.inputs['Fac'].default_value = 1

        oclu_a_mix_n = node_tree.nodes.new("ShaderNodeMath")
        oclu_a_mix_n.name = oclu_a_mix_n.label = DifSpecOclu.OCLU_A_MIX_NODE
        oclu_a_mix_n.location = (start_pos_x + pos_x_shift * 4, start_pos_y + 1600)
        oclu_a_mix_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(oclu_tex_n.inputs["Vector"], sec_geom_n.outputs["UV"])

        # pass 1
        node_tree.links.new(oclu_sep_rgb_n.inputs["Image"], oclu_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(oclu_a_mix_n.inputs[0], base_tex_n.outputs["Value"])
        node_tree.links.new(oclu_a_mix_n.inputs[1], oclu_sep_rgb_n.outputs["R"])

        node_tree.links.new(oclu_mix_n.inputs["Color1"], base_tex_n.outputs["Color"])
        node_tree.links.new(oclu_mix_n.inputs["Color2"], oclu_sep_rgb_n.outputs["R"])

        # pass 3
        node_tree.links.new(spec_mult_n.inputs["Color2"], oclu_a_mix_n.outputs["Value"])

        # pass 4
        node_tree.links.new(vcol_mult_n.inputs["Color2"], oclu_mix_n.outputs["Color"])
Example #18
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree, disable_remap_alpha=True)

        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]

        # delete existing
        node_tree.nodes.remove(node_tree.nodes[DifSpec.OPACITY_NODE])

        # move existing
        for node in node_tree.nodes:
            if node.location.x > pos_x_shift:
                node.location.x += pos_x_shift

        # node creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = DifSpecMultDifSpec.SEC_GEOM_NODE
        sec_geom_n.label = DifSpecMultDifSpec.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)
        sec_geom_n.uv_layer = _MESH_consts.none_uv

        mult_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        mult_tex_n.name = DifSpecMultDifSpec.MULT_TEX_NODE
        mult_tex_n.label = DifSpecMultDifSpec.MULT_TEX_NODE
        mult_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        mult_base_col_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        mult_base_col_mix_n.name = DifSpecMultDifSpec.MULT_BASE_COL_MIX_NODE
        mult_base_col_mix_n.label = DifSpecMultDifSpec.MULT_BASE_COL_MIX_NODE
        mult_base_col_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                        start_pos_y + 1400)
        mult_base_col_mix_n.blend_type = "MULTIPLY"
        mult_base_col_mix_n.inputs['Fac'].default_value = 1

        mult_base_a_mix_n = node_tree.nodes.new("ShaderNodeMath")
        mult_base_a_mix_n.name = DifSpecMultDifSpec.MULT_BASE_A_MIX_NODE
        mult_base_a_mix_n.label = DifSpecMultDifSpec.MULT_BASE_A_MIX_NODE
        mult_base_a_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                      start_pos_y + 1700)
        mult_base_a_mix_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(mult_tex_n.inputs['Vector'],
                            sec_geom_n.outputs['UV'])

        node_tree.links.new(mult_base_col_mix_n.inputs['Color1'],
                            base_tex_n.outputs['Color'])
        node_tree.links.new(mult_base_col_mix_n.inputs['Color2'],
                            mult_tex_n.outputs['Color'])
        node_tree.links.new(mult_base_a_mix_n.inputs[0],
                            base_tex_n.outputs['Value'])
        node_tree.links.new(mult_base_a_mix_n.inputs[1],
                            mult_tex_n.outputs['Value'])

        node_tree.links.new(vcol_mult_n.inputs['Color2'],
                            mult_base_col_mix_n.outputs['Color'])
        node_tree.links.new(spec_mult_n.inputs['Color2'],
                            mult_base_a_mix_n.outputs['Value'])
Example #19
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        geom_n = node_tree.nodes[DifSpec.GEOM_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_scale_n = node_tree.nodes[DifSpec.VCOLOR_SCALE_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        opacity_mult_n = node_tree.nodes[DifSpec.OPACITY_NODE]
        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]

        # move existing
        geom_n.location.x -= pos_x_shift * 2
        opacity_mult_n.location.y -= 100
        for node in node_tree.nodes:
            if node.location.x > start_pos_x + pos_x_shift:
                node.location.x += pos_x_shift

        # nodes creation
        uv_scale_n = node_tree.nodes.new("ShaderNodeMapping")
        uv_scale_n.name = uv_scale_n.label = DifSpecWeightMult2.UV_SCALE_NODE
        uv_scale_n.location = (start_pos_x - pos_x_shift * 2, start_pos_y + 1200)
        uv_scale_n.vector_type = "POINT"
        uv_scale_n.translation = uv_scale_n.rotation = (0.0,) * 3
        uv_scale_n.scale = (1.0,) * 3
        uv_scale_n.use_min = uv_scale_n.use_max = False

        mult_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        mult_tex_n.name = mult_tex_n.label = DifSpecWeightMult2.MULT_TEX_NODE
        mult_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        mult2_mix_gn = node_tree.nodes.new("ShaderNodeGroup")
        mult2_mix_gn.name = mult2_mix_gn.label = DifSpecWeightMult2.MULT2_MIX_GROUP_NODE
        mult2_mix_gn.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1400)
        mult2_mix_gn.node_tree = mult2_mix.get_node_group()

        spec_vcol_mult_n = node_tree.nodes.new("ShaderNodeMixRGB")
        spec_vcol_mult_n.name = spec_vcol_mult_n.label = DifSpecWeightMult2.SPEC_VCOL_MULT_NODE
        spec_vcol_mult_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1800)
        spec_vcol_mult_n.blend_type = "MULTIPLY"
        spec_vcol_mult_n.inputs["Fac"].default_value = 1.0

        # links creation
        node_tree.links.new(uv_scale_n.inputs["Vector"], geom_n.outputs["UV"])

        node_tree.links.new(mult_tex_n.inputs["Vector"], uv_scale_n.outputs["Vector"])

        # pass 1
        node_tree.links.new(mult2_mix_gn.inputs["Base Alpha"], base_tex_n.outputs["Value"])
        node_tree.links.new(mult2_mix_gn.inputs["Base Color"], base_tex_n.outputs["Color"])
        node_tree.links.new(mult2_mix_gn.inputs["Mult Alpha"], mult_tex_n.outputs["Value"])
        node_tree.links.new(mult2_mix_gn.inputs["Mult Color"], mult_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(spec_mult_n.inputs["Color2"], mult2_mix_gn.outputs["Mix Alpha"])

        node_tree.links.new(opacity_mult_n.inputs[0], mult2_mix_gn.outputs["Mix Alpha"])

        # pass 3
        node_tree.links.new(spec_vcol_mult_n.inputs["Color1"], spec_mult_n.outputs["Color"])
        node_tree.links.new(spec_vcol_mult_n.inputs["Color2"], vcol_scale_n.outputs["Color"])

        node_tree.links.new(vcol_mult_n.inputs["Color2"], mult2_mix_gn.outputs["Mix Color"])

        # pass 4
        node_tree.links.new(out_mat_n.inputs["Spec"], spec_vcol_mult_n.outputs["Color"])
Example #20
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree, disable_remap_alpha=True)

        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]

        # move existing
        for node in node_tree.nodes:
            if node.location.x > start_pos_x + pos_x_shift:
                node.location.x += pos_x_shift * 2

        # node creation
        sec_uvmap_n = node_tree.nodes.new("ShaderNodeUVMap")
        sec_uvmap_n.name = sec_uvmap_n.label = DifSpecOclu.SEC_UVMAP_NODE
        sec_uvmap_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1100)
        sec_uvmap_n.uv_map = _MESH_consts.none_uv

        oclu_tex_n = node_tree.nodes.new("ShaderNodeTexImage")
        oclu_tex_n.name = oclu_tex_n.label = DifSpecOclu.OCLU_TEX_NODE
        oclu_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)
        oclu_tex_n.width = 140

        oclu_sep_rgb_n = node_tree.nodes.new("ShaderNodeSeparateRGB")
        oclu_sep_rgb_n.name = oclu_sep_rgb_n.label = DifSpecOclu.OCLU_SEPARATE_RGB_NODE
        oclu_sep_rgb_n.location = (start_pos_x + pos_x_shift * 3,
                                   start_pos_y + 1200)

        oclu_mix_n = node_tree.nodes.new("ShaderNodeVectorMath")
        oclu_mix_n.name = oclu_mix_n.label = DifSpecOclu.OCLU_MIX_NODE
        oclu_mix_n.location = (start_pos_x + pos_x_shift * 4,
                               start_pos_y + 1400)
        oclu_mix_n.operation = "MULTIPLY"

        oclu_a_mix_n = node_tree.nodes.new("ShaderNodeMath")
        oclu_a_mix_n.name = oclu_a_mix_n.label = DifSpecOclu.OCLU_A_MIX_NODE
        oclu_a_mix_n.location = (start_pos_x + pos_x_shift * 4,
                                 start_pos_y + 1600)
        oclu_a_mix_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(oclu_tex_n.inputs["Vector"],
                            sec_uvmap_n.outputs["UV"])

        # pass 1
        node_tree.links.new(oclu_sep_rgb_n.inputs["Image"],
                            oclu_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(oclu_a_mix_n.inputs[0],
                            base_tex_n.outputs["Alpha"])
        node_tree.links.new(oclu_a_mix_n.inputs[1],
                            oclu_sep_rgb_n.outputs["R"])

        node_tree.links.new(oclu_mix_n.inputs[0], base_tex_n.outputs["Color"])
        node_tree.links.new(oclu_mix_n.inputs[1], oclu_sep_rgb_n.outputs["R"])

        # pass 3
        node_tree.links.new(spec_mult_n.inputs[1],
                            oclu_a_mix_n.outputs["Value"])

        # pass 4
        node_tree.links.new(vcol_mult_n.inputs[1], oclu_mix_n.outputs[0])
Example #21
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        geom_n = node_tree.nodes[DifSpec.GEOM_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_scale_n = node_tree.nodes[DifSpec.VCOLOR_SCALE_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        opacity_mult_n = node_tree.nodes[DifSpec.OPACITY_NODE]
        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]

        # move existing
        geom_n.location.x -= pos_x_shift * 2
        opacity_mult_n.location.y -= 100
        for node in node_tree.nodes:
            if node.location.x > start_pos_x + pos_x_shift:
                node.location.x += pos_x_shift

        # nodes creation
        uv_scale_n = node_tree.nodes.new("ShaderNodeMapping")
        uv_scale_n.name = uv_scale_n.label = DifSpecWeightMult2.UV_SCALE_NODE
        uv_scale_n.location = (start_pos_x - pos_x_shift * 2,
                               start_pos_y + 1200)
        uv_scale_n.vector_type = "POINT"
        uv_scale_n.translation = uv_scale_n.rotation = (0.0, ) * 3
        uv_scale_n.scale = (1.0, ) * 3
        uv_scale_n.use_min = uv_scale_n.use_max = False

        mult_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        mult_tex_n.name = mult_tex_n.label = DifSpecWeightMult2.MULT_TEX_NODE
        mult_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        mult2_mix_gn = node_tree.nodes.new("ShaderNodeGroup")
        mult2_mix_gn.name = mult2_mix_gn.label = DifSpecWeightMult2.MULT2_MIX_GROUP_NODE
        mult2_mix_gn.location = (start_pos_x + pos_x_shift * 3,
                                 start_pos_y + 1400)
        mult2_mix_gn.node_tree = mult2_mix.get_node_group()

        spec_vcol_mult_n = node_tree.nodes.new("ShaderNodeMixRGB")
        spec_vcol_mult_n.name = spec_vcol_mult_n.label = DifSpecWeightMult2.SPEC_VCOL_MULT_NODE
        spec_vcol_mult_n.location = (start_pos_x + pos_x_shift * 5,
                                     start_pos_y + 1800)
        spec_vcol_mult_n.blend_type = "MULTIPLY"
        spec_vcol_mult_n.inputs["Fac"].default_value = 1.0

        # links creation
        node_tree.links.new(uv_scale_n.inputs["Vector"], geom_n.outputs["UV"])

        node_tree.links.new(mult_tex_n.inputs["Vector"],
                            uv_scale_n.outputs["Vector"])

        # pass 1
        node_tree.links.new(mult2_mix_gn.inputs["Base Alpha"],
                            base_tex_n.outputs["Value"])
        node_tree.links.new(mult2_mix_gn.inputs["Base Color"],
                            base_tex_n.outputs["Color"])
        node_tree.links.new(mult2_mix_gn.inputs["Mult Alpha"],
                            mult_tex_n.outputs["Value"])
        node_tree.links.new(mult2_mix_gn.inputs["Mult Color"],
                            mult_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(spec_mult_n.inputs["Color2"],
                            mult2_mix_gn.outputs["Mix Alpha"])

        node_tree.links.new(opacity_mult_n.inputs[0],
                            mult2_mix_gn.outputs["Mix Alpha"])

        # pass 3
        node_tree.links.new(spec_vcol_mult_n.inputs["Color1"],
                            spec_mult_n.outputs["Color"])
        node_tree.links.new(spec_vcol_mult_n.inputs["Color2"],
                            vcol_scale_n.outputs["Color"])

        node_tree.links.new(vcol_mult_n.inputs["Color2"],
                            mult2_mix_gn.outputs["Mix Color"])

        # pass 4
        node_tree.links.new(out_mat_n.inputs["Spec"],
                            spec_vcol_mult_n.outputs["Color"])
Example #22
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree, disable_remap_alpha=True)

        first_uv_n = node_tree.nodes[DifSpec.UVMAP_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]

        # move existing
        for node in node_tree.nodes:
            if node.location.x > start_pos_x + pos_x_shift:
                node.location.x += pos_x_shift

        # node creation
        uv_scale_n = node_tree.nodes.new("ShaderNodeValue")
        uv_scale_n.name = uv_scale_n.label = DifSpecFadeDifSpec.UV_SCALE_NODE
        uv_scale_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)

        detail_uv_scaling_n = node_tree.nodes.new("ShaderNodeVectorMath")
        detail_uv_scaling_n.name = detail_uv_scaling_n.label = DifSpecFadeDifSpec.DETAIL_UV_SCALING_NODE
        detail_uv_scaling_n.location = (start_pos_x, start_pos_y + 1200)
        detail_uv_scaling_n.operation = "MULTIPLY"

        detail_tex_n = node_tree.nodes.new("ShaderNodeTexImage")
        detail_tex_n.name = detail_tex_n.label = DifSpecFadeDifSpec.DETAIL_TEX_NODE
        detail_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)
        detail_tex_n.width = 140

        detail_setup_group_n = node_tree.nodes.new("ShaderNodeGroup")
        detail_setup_group_n.name = detail_setup_group_n.label = DifSpecFadeDifSpec.DETAIL_SETUP_GNODE
        detail_setup_group_n.location = (start_pos_x + pos_x_shift,
                                         start_pos_y + 900)
        detail_setup_group_n.node_tree = detail_setup_ng.get_node_group()

        base_detail_mix_a_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_detail_mix_a_n.name = base_detail_mix_a_n.label = DifSpecFadeDifSpec.BASE_DETAIL_MIX_A_NODE
        base_detail_mix_a_n.location = (start_pos_x + pos_x_shift * 3,
                                        start_pos_y + 1700)
        base_detail_mix_a_n.blend_type = "MIX"

        base_detail_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_detail_mix_n.name = base_detail_mix_n.label = DifSpecFadeDifSpec.BASE_DETAIL_MIX_NODE
        base_detail_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                      start_pos_y + 1400)
        base_detail_mix_n.blend_type = "MIX"

        # links creation
        node_tree.links.new(detail_uv_scaling_n.inputs[0],
                            first_uv_n.outputs['UV'])
        node_tree.links.new(detail_uv_scaling_n.inputs[1],
                            uv_scale_n.outputs[0])

        # geom pass
        node_tree.links.new(detail_tex_n.inputs['Vector'],
                            detail_uv_scaling_n.outputs[0])

        # pass 1
        node_tree.links.new(base_detail_mix_a_n.inputs['Fac'],
                            detail_setup_group_n.outputs['Blend Factor'])
        node_tree.links.new(base_detail_mix_a_n.inputs['Color1'],
                            base_tex_n.outputs['Alpha'])
        node_tree.links.new(base_detail_mix_a_n.inputs['Color2'],
                            detail_tex_n.outputs['Alpha'])

        node_tree.links.new(base_detail_mix_n.inputs['Fac'],
                            detail_setup_group_n.outputs['Blend Factor'])
        node_tree.links.new(base_detail_mix_n.inputs['Color1'],
                            base_tex_n.outputs['Color'])
        node_tree.links.new(base_detail_mix_n.inputs['Color2'],
                            detail_tex_n.outputs['Color'])

        # pass 2
        node_tree.links.new(spec_mult_n.inputs[1],
                            base_detail_mix_a_n.outputs['Color'])

        # pass 3
        node_tree.links.new(vcol_mult_n.inputs[1],
                            base_detail_mix_n.outputs['Color'])
Example #23
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree, disable_remap_alpha=False)

        vcol_group_n = node_tree.nodes[DifSpec.VCOL_GROUP_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_col_n = node_tree.nodes[DifSpec.SPEC_COL_NODE]
        spec_multi_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_scale_n = node_tree.nodes[DifSpec.VCOLOR_SCALE_NODE]
        vcol_multi_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        compose_lighting_n = node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]

        # delete existing
        node_tree.nodes.remove(node_tree.nodes[DifSpec.OPACITY_NODE])

        # move existing
        spec_multi_n.location.x += pos_x_shift
        spec_multi_n.location.y += 100
        out_mat_n.location.x += pos_x_shift
        compose_lighting_n.location.x += pos_x_shift
        output_n.location.x += pos_x_shift

        # node creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = DifSpecWeightWeightDifSpecWeight.SEC_GEOM_NODE
        sec_geom_n.label = DifSpecWeightWeightDifSpecWeight.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)
        sec_geom_n.uv_layer = _MESH_consts.none_uv

        sec_spec_col_n = node_tree.nodes.new("ShaderNodeRGB")
        sec_spec_col_n.name = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_COL_NODE
        sec_spec_col_n.label = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_COL_NODE
        sec_spec_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 2100)

        over_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        over_tex_n.name = DifSpecWeightWeightDifSpecWeight.OVER_TEX_NODE
        over_tex_n.label = DifSpecWeightWeightDifSpecWeight.OVER_TEX_NODE
        over_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        sec_spec_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        sec_spec_mix_n.name = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_MIX_NODE
        sec_spec_mix_n.label = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_MIX_NODE
        sec_spec_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 2100)
        sec_spec_mix_n.blend_type = "MIX"

        base_over_a_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_over_a_mix_n.name = DifSpecWeightWeightDifSpecWeight.BASE_OVER_A_MIX_NODE
        base_over_a_mix_n.label = DifSpecWeightWeightDifSpecWeight.BASE_OVER_A_MIX_NODE
        base_over_a_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1900)
        base_over_a_mix_n.blend_type = "MIX"

        base_over_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_over_mix_n.name = DifSpecWeightWeightDifSpecWeight.BASE_OVER_MIX_NODE
        base_over_mix_n.label = DifSpecWeightWeightDifSpecWeight.BASE_OVER_MIX_NODE
        base_over_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1350)

        vcol_spec_mul_n = node_tree.nodes.new("ShaderNodeMixRGB")
        vcol_spec_mul_n.name = DifSpecWeightWeightDifSpecWeight.VCOL_SPEC_MULT_NODE
        vcol_spec_mul_n.label = DifSpecWeightWeightDifSpecWeight.VCOL_SPEC_MULT_NODE
        vcol_spec_mul_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1900)
        vcol_spec_mul_n.blend_type = "MULTIPLY"
        vcol_spec_mul_n.inputs["Fac"].default_value = 1

        # links creation
        node_tree.links.new(over_tex_n.inputs["Vector"], sec_geom_n.outputs["UV"])

        # pass 1
        node_tree.links.new(sec_spec_mix_n.inputs["Fac"], vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(sec_spec_mix_n.inputs["Color1"], spec_col_n.outputs["Color"])
        node_tree.links.new(sec_spec_mix_n.inputs["Color2"], sec_spec_col_n.outputs["Color"])

        node_tree.links.new(base_over_a_mix_n.inputs["Fac"], vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(base_over_a_mix_n.inputs["Color1"], base_tex_n.outputs["Value"])
        node_tree.links.new(base_over_a_mix_n.inputs["Color2"], over_tex_n.outputs["Value"])

        node_tree.links.new(base_over_mix_n.inputs["Fac"], vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(base_over_mix_n.inputs["Color1"], base_tex_n.outputs["Color"])
        node_tree.links.new(base_over_mix_n.inputs["Color2"], over_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(spec_multi_n.inputs["Color1"], sec_spec_mix_n.outputs["Color"])
        node_tree.links.new(spec_multi_n.inputs["Color2"], base_over_a_mix_n.outputs["Color"])

        node_tree.links.new(vcol_multi_n.inputs["Color2"], base_over_mix_n.outputs["Color"])

        # pass 3
        node_tree.links.new(vcol_spec_mul_n.inputs["Color1"], spec_multi_n.outputs["Color"])
        node_tree.links.new(vcol_spec_mul_n.inputs["Color2"], vcol_scale_n.outputs["Color"])

        # pass 4
        node_tree.links.new(out_mat_n.inputs["Spec"], vcol_spec_mul_n.outputs["Color"])
Example #24
0
    def init(node_tree, init_dif_spec=True, start_pos_x=0, start_pos_y=0):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        :param init_dif_spec should dif spec be initilized, True by default
        :type init_dif_spec bool
        :param start_pos_x: x start position
        :type start_pos_x: int
        :param start_pos_y: y start position
        :type start_pos_y: int
        """

        pos_x_shift = 185

        # init parent
        if init_dif_spec:
            DifSpec.init(node_tree)

        compose_lighting_n = node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]

        # move existing
        output_n.location.x += pos_x_shift * 3

        # nodes creation
        sec_uvmap_n = node_tree.nodes.new("ShaderNodeUVMap")
        sec_uvmap_n.name = sec_uvmap_n.label = Lamp.SEC_UVMAP_NODE
        sec_uvmap_n.location = (start_pos_x - pos_x_shift, start_pos_y + 2300)
        sec_uvmap_n.uv_map = _MESH_consts.none_uv

        mask_tex_n = node_tree.nodes.new("ShaderNodeTexImage")
        mask_tex_n.name = mask_tex_n.label = Lamp.MASK_TEX_NODE
        mask_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 2400)
        mask_tex_n.width = 140

        lampmask_mixer_n = node_tree.nodes.new("ShaderNodeGroup")
        lampmask_mixer_n.name = lampmask_mixer_n.label = Lamp.LAMPMASK_MIX_GROUP_NODE
        lampmask_mixer_n.location = (start_pos_x + pos_x_shift * 3,
                                     start_pos_y + 2300)
        lampmask_mixer_n.node_tree = lampmask_mixer_ng.get_node_group()

        out_add_lampmask_n = node_tree.nodes.new("ShaderNodeVectorMath")
        out_add_lampmask_n.name = out_add_lampmask_n.label = Lamp.OUT_ADD_LAMPMASK_NODE
        out_add_lampmask_n.location = (output_n.location.x - pos_x_shift * 2,
                                       compose_lighting_n.location.y + 200)
        out_add_lampmask_n.operation = "ADD"

        out_a_inv_n = node_tree.nodes.new("ShaderNodeMath")
        out_a_inv_n.name = out_a_inv_n.label = Lamp.OUT_ALPHA_INVERSE_NODE
        out_a_inv_n.location = (output_n.location.x - pos_x_shift * 2,
                                output_n.location.y - 100)
        out_a_inv_n.operation = "SUBTRACT"
        out_a_inv_n.use_clamp = True
        out_a_inv_n.inputs[
            0].default_value = 0.999999  # TODO: change back to 1.0 after bug is fixed: https://developer.blender.org/T71426

        out_mat_n = node_tree.nodes.new("ShaderNodeEeveeSpecular")
        out_mat_n.name = out_mat_n.label = Lamp.OUT_MAT_NODE
        out_mat_n.location = (output_n.location.x - pos_x_shift,
                              output_n.location.y)
        out_mat_n.inputs["Base Color"].default_value = (0.0, ) * 4
        out_mat_n.inputs["Specular"].default_value = (0.0, ) * 4

        # links creation
        node_tree.links.new(mask_tex_n.inputs['Vector'],
                            sec_uvmap_n.outputs["UV"])

        node_tree.links.new(lampmask_mixer_n.inputs['Lampmask Tex Alpha'],
                            mask_tex_n.outputs['Alpha'])
        node_tree.links.new(lampmask_mixer_n.inputs['Lampmask Tex Color'],
                            mask_tex_n.outputs['Color'])
        node_tree.links.new(lampmask_mixer_n.inputs['UV Vector'],
                            sec_uvmap_n.outputs['UV'])

        node_tree.links.new(
            out_add_lampmask_n.inputs[0],
            lampmask_mixer_n.outputs['Lampmask Addition Color'])
        node_tree.links.new(out_add_lampmask_n.inputs[1],
                            compose_lighting_n.outputs['Color'])

        node_tree.links.new(out_a_inv_n.inputs[1],
                            compose_lighting_n.outputs['Alpha'])

        node_tree.links.new(out_mat_n.inputs['Emissive Color'],
                            out_add_lampmask_n.outputs[0])
        node_tree.links.new(out_mat_n.inputs['Transparency'],
                            out_a_inv_n.outputs['Value'])

        node_tree.links.new(output_n.inputs["Surface"],
                            out_mat_n.outputs['BSDF'])
Example #25
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]

        # delete existing
        node_tree.nodes.remove(node_tree.nodes[DifSpec.OPACITY_NODE])

        # move existing
        for node in node_tree.nodes:
            if node.location.x > start_pos_x + pos_x_shift:
                node.location.x += pos_x_shift * 2

        # node creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = sec_geom_n.label = DifSpecOclu.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)
        sec_geom_n.uv_layer = _MESH_consts.none_uv

        oclu_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        oclu_tex_n.name = oclu_tex_n.label = DifSpecOclu.OCLU_TEX_NODE
        oclu_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        oclu_sep_rgb_n = node_tree.nodes.new("ShaderNodeSeparateRGB")
        oclu_sep_rgb_n.name = oclu_sep_rgb_n.label = DifSpecOclu.OCLU_SEPARATE_RGB_NODE
        oclu_sep_rgb_n.location = (start_pos_x + pos_x_shift * 3,
                                   start_pos_y + 1200)

        oclu_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        oclu_mix_n.name = oclu_mix_n.label = DifSpecOclu.OCLU_MIX_NODE
        oclu_mix_n.location = (start_pos_x + pos_x_shift * 4,
                               start_pos_y + 1400)
        oclu_mix_n.blend_type = "MULTIPLY"
        oclu_mix_n.inputs['Fac'].default_value = 1

        oclu_a_mix_n = node_tree.nodes.new("ShaderNodeMath")
        oclu_a_mix_n.name = oclu_a_mix_n.label = DifSpecOclu.OCLU_A_MIX_NODE
        oclu_a_mix_n.location = (start_pos_x + pos_x_shift * 4,
                                 start_pos_y + 1600)
        oclu_a_mix_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(oclu_tex_n.inputs["Vector"],
                            sec_geom_n.outputs["UV"])

        # pass 1
        node_tree.links.new(oclu_sep_rgb_n.inputs["Image"],
                            oclu_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(oclu_a_mix_n.inputs[0],
                            base_tex_n.outputs["Value"])
        node_tree.links.new(oclu_a_mix_n.inputs[1],
                            oclu_sep_rgb_n.outputs["R"])

        node_tree.links.new(oclu_mix_n.inputs["Color1"],
                            base_tex_n.outputs["Color"])
        node_tree.links.new(oclu_mix_n.inputs["Color2"],
                            oclu_sep_rgb_n.outputs["R"])

        # pass 3
        node_tree.links.new(spec_mult_n.inputs["Color2"],
                            oclu_a_mix_n.outputs["Value"])

        # pass 4
        node_tree.links.new(vcol_mult_n.inputs["Color2"],
                            oclu_mix_n.outputs["Color"])
Example #26
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        geometry_n = node_tree.nodes[DifSpec.GEOM_NODE]
        spec_col_n = node_tree.nodes[DifSpec.SPEC_COL_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]

        # move existing
        output_n.location.x += pos_x_shift

        # node creation
        refl_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        refl_tex_n.name = DifSpecAddEnv.REFL_TEX_NODE
        refl_tex_n.label = DifSpecAddEnv.REFL_TEX_NODE
        refl_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 2500)

        env_col_n = node_tree.nodes.new("ShaderNodeRGB")
        env_col_n.name = DifSpecAddEnv.ENV_COLOR_NODE
        env_col_n.label = DifSpecAddEnv.ENV_COLOR_NODE
        env_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 2200)

        add_env_gn = node_tree.nodes.new("ShaderNodeGroup")
        add_env_gn.name = DifSpecAddEnv.ADD_ENV_GROUP_NODE
        add_env_gn.label = DifSpecAddEnv.ADD_ENV_GROUP_NODE
        add_env_gn.location = (start_pos_x + pos_x_shift * 3,
                               start_pos_y + 2300)
        add_env_gn.node_tree = add_env.get_node_group()
        add_env_gn.inputs['Apply Fresnel'].default_value = 1.0
        add_env_gn.inputs['Fresnel Scale'].default_value = 0.9
        add_env_gn.inputs['Fresnel Bias'].default_value = 0.2

        out_add_refl_n = node_tree.nodes.new("ShaderNodeMixRGB")
        out_add_refl_n.name = DifSpecAddEnv.OUT_ADD_REFL_NODE
        out_add_refl_n.label = DifSpecAddEnv.OUT_ADD_REFL_NODE
        out_add_refl_n.location = (output_n.location.x - pos_x_shift,
                                   start_pos_y + 1950)
        out_add_refl_n.blend_type = "ADD"
        out_add_refl_n.inputs['Fac'].default_value = 1

        # geometry links
        node_tree.links.new(add_env_gn.inputs['Normal Vector'],
                            geometry_n.outputs['Normal'])
        node_tree.links.new(add_env_gn.inputs['View Vector'],
                            geometry_n.outputs['View'])
        node_tree.links.new(refl_tex_n.inputs['Vector'],
                            geometry_n.outputs['Normal'])

        node_tree.links.new(add_env_gn.inputs['Env Factor Color'],
                            env_col_n.outputs['Color'])
        node_tree.links.new(add_env_gn.inputs['Reflection Texture Color'],
                            refl_tex_n.outputs['Color'])

        node_tree.links.new(add_env_gn.inputs['Specular Color'],
                            spec_col_n.outputs['Color'])
        node_tree.links.new(add_env_gn.inputs['Base Texture Alpha'],
                            base_tex_n.outputs['Value'])

        # output pass
        node_tree.links.new(out_add_refl_n.inputs['Color1'],
                            add_env_gn.outputs['Environment Addition Color'])
        node_tree.links.new(out_add_refl_n.inputs['Color2'],
                            out_mat_n.outputs['Color'])

        node_tree.links.new(output_n.inputs['Color'],
                            out_add_refl_n.outputs['Color'])
Example #27
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree, disable_remap_alpha=True)

        vcol_gn = node_tree.nodes[DifSpec.VCOL_GROUP_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        compose_lighting_n = node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE]

        # delete existing
        node_tree.nodes.remove(node_tree.nodes[DifSpec.OPACITY_NODE])

        # move existing
        for node in node_tree.nodes:
            if node.location.x > pos_x_shift:
                node.location.x += pos_x_shift

        # node creation
        sec_uvmap_n = node_tree.nodes.new("ShaderNodeUVMap")
        sec_uvmap_n.name = DifSpecMultDifSpec.SEC_UVMAP_NODE
        sec_uvmap_n.label = DifSpecMultDifSpec.SEC_UVMAP_NODE
        sec_uvmap_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)
        sec_uvmap_n.uv_map = _MESH_consts.none_uv

        mult_tex_n = node_tree.nodes.new("ShaderNodeTexImage")
        mult_tex_n.name = DifSpecMultDifSpec.MULT_TEX_NODE
        mult_tex_n.label = DifSpecMultDifSpec.MULT_TEX_NODE
        mult_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)
        mult_tex_n.width = 140

        mult_base_col_mix_n = node_tree.nodes.new("ShaderNodeVectorMath")
        mult_base_col_mix_n.name = DifSpecMultDifSpec.MULT_BASE_COL_MIX_NODE
        mult_base_col_mix_n.label = DifSpecMultDifSpec.MULT_BASE_COL_MIX_NODE
        mult_base_col_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                        start_pos_y + 1400)
        mult_base_col_mix_n.operation = "MULTIPLY"

        mult_base_a_mix_n = node_tree.nodes.new("ShaderNodeMath")
        mult_base_a_mix_n.name = DifSpecMultDifSpec.MULT_BASE_A_MIX_NODE
        mult_base_a_mix_n.label = DifSpecMultDifSpec.MULT_BASE_A_MIX_NODE
        mult_base_a_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                      start_pos_y + 1700)
        mult_base_a_mix_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(mult_tex_n.inputs['Vector'],
                            sec_uvmap_n.outputs['UV'])

        node_tree.links.new(mult_base_col_mix_n.inputs[0],
                            base_tex_n.outputs['Color'])
        node_tree.links.new(mult_base_col_mix_n.inputs[1],
                            mult_tex_n.outputs['Color'])
        node_tree.links.new(mult_base_a_mix_n.inputs[0],
                            base_tex_n.outputs['Alpha'])
        node_tree.links.new(mult_base_a_mix_n.inputs[1],
                            mult_tex_n.outputs['Alpha'])

        node_tree.links.new(vcol_mult_n.inputs[1],
                            mult_base_col_mix_n.outputs[0])
        node_tree.links.new(spec_mult_n.inputs[1],
                            mult_base_a_mix_n.outputs['Value'])

        node_tree.links.new(compose_lighting_n.inputs['Alpha'],
                            vcol_gn.outputs['Vertex Color Alpha'])
Example #28
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        vcol_group_n = node_tree.nodes[DifSpec.VCOL_GROUP_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_col_n = node_tree.nodes[DifSpec.SPEC_COL_NODE]
        spec_multi_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_scale_n = node_tree.nodes[DifSpec.VCOLOR_SCALE_NODE]
        vcol_multi_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]

        # delete existing
        node_tree.nodes.remove(node_tree.nodes[DifSpec.OPACITY_NODE])

        # move existing
        spec_multi_n.location.x += pos_x_shift
        spec_multi_n.location.y += 100
        out_mat_n.location.x += pos_x_shift
        output_n.location.x += pos_x_shift

        # node creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeGeometry")
        sec_geom_n.name = DifSpecWeightWeightDifSpecWeight.SEC_GEOM_NODE
        sec_geom_n.label = DifSpecWeightWeightDifSpecWeight.SEC_GEOM_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)
        sec_geom_n.uv_layer = _MESH_consts.none_uv

        sec_spec_col_n = node_tree.nodes.new("ShaderNodeRGB")
        sec_spec_col_n.name = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_COL_NODE
        sec_spec_col_n.label = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_COL_NODE
        sec_spec_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 2100)

        over_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        over_tex_n.name = DifSpecWeightWeightDifSpecWeight.OVER_TEX_NODE
        over_tex_n.label = DifSpecWeightWeightDifSpecWeight.OVER_TEX_NODE
        over_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        sec_spec_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        sec_spec_mix_n.name = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_MIX_NODE
        sec_spec_mix_n.label = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_MIX_NODE
        sec_spec_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 2100)
        sec_spec_mix_n.blend_type = "MIX"

        base_over_a_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_over_a_mix_n.name = DifSpecWeightWeightDifSpecWeight.BASE_OVER_A_MIX_NODE
        base_over_a_mix_n.label = DifSpecWeightWeightDifSpecWeight.BASE_OVER_A_MIX_NODE
        base_over_a_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1900)
        base_over_a_mix_n.blend_type = "MIX"

        base_over_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_over_mix_n.name = DifSpecWeightWeightDifSpecWeight.BASE_OVER_MIX_NODE
        base_over_mix_n.label = DifSpecWeightWeightDifSpecWeight.BASE_OVER_MIX_NODE
        base_over_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1350)

        vcol_spec_mul_n = node_tree.nodes.new("ShaderNodeMixRGB")
        vcol_spec_mul_n.name = DifSpecWeightWeightDifSpecWeight.VCOL_SPEC_MULT_NODE
        vcol_spec_mul_n.label = DifSpecWeightWeightDifSpecWeight.VCOL_SPEC_MULT_NODE
        vcol_spec_mul_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1900)
        vcol_spec_mul_n.blend_type = "MULTIPLY"
        vcol_spec_mul_n.inputs["Fac"].default_value = 1

        # links creation
        node_tree.links.new(over_tex_n.inputs["Vector"], sec_geom_n.outputs["UV"])

        # pass 1
        node_tree.links.new(sec_spec_mix_n.inputs["Fac"], vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(sec_spec_mix_n.inputs["Color1"], spec_col_n.outputs["Color"])
        node_tree.links.new(sec_spec_mix_n.inputs["Color2"], sec_spec_col_n.outputs["Color"])

        node_tree.links.new(base_over_a_mix_n.inputs["Fac"], vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(base_over_a_mix_n.inputs["Color1"], base_tex_n.outputs["Value"])
        node_tree.links.new(base_over_a_mix_n.inputs["Color2"], over_tex_n.outputs["Value"])

        node_tree.links.new(base_over_mix_n.inputs["Fac"], vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(base_over_mix_n.inputs["Color1"], base_tex_n.outputs["Color"])
        node_tree.links.new(base_over_mix_n.inputs["Color2"], over_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(spec_multi_n.inputs["Color1"], sec_spec_mix_n.outputs["Color"])
        node_tree.links.new(spec_multi_n.inputs["Color2"], base_over_a_mix_n.outputs["Color"])

        node_tree.links.new(vcol_multi_n.inputs["Color2"], base_over_mix_n.outputs["Color"])

        # pass 3
        node_tree.links.new(vcol_spec_mul_n.inputs["Color1"], spec_multi_n.outputs["Color"])
        node_tree.links.new(vcol_spec_mul_n.inputs["Color2"], vcol_scale_n.outputs["Color"])

        # pass 4
        node_tree.links.new(out_mat_n.inputs["Spec"], vcol_spec_mul_n.outputs["Color"])
Example #29
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        geometry_n = node_tree.nodes[DifSpec.GEOM_NODE]
        spec_col_n = node_tree.nodes[DifSpec.SPEC_COL_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        out_mat_n = node_tree.nodes[DifSpec.OUT_MAT_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]

        # move existing
        output_n.location.x += pos_x_shift

        # node creation
        refl_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        refl_tex_n.name = DifSpecAddEnv.REFL_TEX_NODE
        refl_tex_n.label = DifSpecAddEnv.REFL_TEX_NODE
        refl_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 2500)

        env_col_n = node_tree.nodes.new("ShaderNodeRGB")
        env_col_n.name = DifSpecAddEnv.ENV_COLOR_NODE
        env_col_n.label = DifSpecAddEnv.ENV_COLOR_NODE
        env_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 2200)

        add_env_gn = node_tree.nodes.new("ShaderNodeGroup")
        add_env_gn.name = DifSpecAddEnv.ADD_ENV_GROUP_NODE
        add_env_gn.label = DifSpecAddEnv.ADD_ENV_GROUP_NODE
        add_env_gn.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 2300)
        add_env_gn.node_tree = add_env.get_node_group()
        add_env_gn.inputs['Apply Fresnel'].default_value = 1.0
        add_env_gn.inputs['Fresnel Scale'].default_value = 0.9
        add_env_gn.inputs['Fresnel Bias'].default_value = 0.2

        out_add_refl_n = node_tree.nodes.new("ShaderNodeMixRGB")
        out_add_refl_n.name = DifSpecAddEnv.OUT_ADD_REFL_NODE
        out_add_refl_n.label = DifSpecAddEnv.OUT_ADD_REFL_NODE
        out_add_refl_n.location = (output_n.location.x - pos_x_shift, start_pos_y + 1950)
        out_add_refl_n.blend_type = "ADD"
        out_add_refl_n.inputs['Fac'].default_value = 1

        # geometry links
        node_tree.links.new(add_env_gn.inputs['Normal Vector'], geometry_n.outputs['Normal'])
        node_tree.links.new(add_env_gn.inputs['View Vector'], geometry_n.outputs['View'])
        node_tree.links.new(refl_tex_n.inputs['Vector'], geometry_n.outputs['Normal'])

        node_tree.links.new(add_env_gn.inputs['Env Factor Color'], env_col_n.outputs['Color'])
        node_tree.links.new(add_env_gn.inputs['Reflection Texture Color'], refl_tex_n.outputs['Color'])

        node_tree.links.new(add_env_gn.inputs['Specular Color'], spec_col_n.outputs['Color'])
        node_tree.links.new(add_env_gn.inputs['Base Texture Alpha'], base_tex_n.outputs['Value'])

        # output pass
        node_tree.links.new(out_add_refl_n.inputs['Color1'], add_env_gn.outputs['Environment Addition Color'])
        node_tree.links.new(out_add_refl_n.inputs['Color2'], out_mat_n.outputs['Color'])

        node_tree.links.new(output_n.inputs['Color'], out_add_refl_n.outputs['Color'])
Example #30
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree, disable_remap_alpha=False)

        first_uv_map = node_tree.nodes[DifSpec.UVMAP_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_scale_n = node_tree.nodes[DifSpec.VCOLOR_SCALE_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        opacity_mult_n = node_tree.nodes[DifSpec.OPACITY_NODE]
        compose_lighting_n = node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE]

        # move existing
        first_uv_map.location.x -= pos_x_shift * 2
        opacity_mult_n.location.y -= 100
        for node in node_tree.nodes:
            if node.location.x > start_pos_x + pos_x_shift:
                node.location.x += pos_x_shift

        # nodes creation
        uv_scale_n = node_tree.nodes.new("ShaderNodeMapping")
        uv_scale_n.name = uv_scale_n.label = DifSpecWeightMult2.UV_SCALE_NODE
        uv_scale_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1100)
        uv_scale_n.vector_type = "POINT"
        uv_scale_n.inputs['Location'].default_value = uv_scale_n.inputs[
            'Rotation'].default_value = (0.0, ) * 3
        uv_scale_n.inputs['Scale'].default_value = (1.0, ) * 3
        uv_scale_n.width = 140

        mult_tex_n = node_tree.nodes.new("ShaderNodeTexImage")
        mult_tex_n.name = mult_tex_n.label = DifSpecWeightMult2.MULT_TEX_NODE
        mult_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)
        mult_tex_n.width = 140

        mult2_mix_n = node_tree.nodes.new("ShaderNodeGroup")
        mult2_mix_n.name = mult2_mix_n.label = DifSpecWeightMult2.MULT2_MIX_GROUP_NODE
        mult2_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                start_pos_y + 1400)
        mult2_mix_n.node_tree = mult2_mix_ng.get_node_group()

        spec_vcol_mult_n = node_tree.nodes.new("ShaderNodeVectorMath")
        spec_vcol_mult_n.name = spec_vcol_mult_n.label = DifSpecWeightMult2.SPEC_VCOL_MULT_NODE
        spec_vcol_mult_n.location = (start_pos_x + pos_x_shift * 5,
                                     start_pos_y + 1800)
        spec_vcol_mult_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(uv_scale_n.inputs["Vector"],
                            first_uv_map.outputs["UV"])

        node_tree.links.new(mult_tex_n.inputs["Vector"],
                            uv_scale_n.outputs["Vector"])

        # pass 1
        node_tree.links.new(mult2_mix_n.inputs["Base Alpha"],
                            base_tex_n.outputs["Alpha"])
        node_tree.links.new(mult2_mix_n.inputs["Base Color"],
                            base_tex_n.outputs["Color"])
        node_tree.links.new(mult2_mix_n.inputs["Mult Alpha"],
                            mult_tex_n.outputs["Alpha"])
        node_tree.links.new(mult2_mix_n.inputs["Mult Color"],
                            mult_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(spec_mult_n.inputs[1],
                            mult2_mix_n.outputs["Mix Alpha"])

        node_tree.links.new(opacity_mult_n.inputs[0],
                            mult2_mix_n.outputs["Mix Alpha"])

        # pass 3
        node_tree.links.new(spec_vcol_mult_n.inputs[0], spec_mult_n.outputs[0])
        node_tree.links.new(spec_vcol_mult_n.inputs[1],
                            vcol_scale_n.outputs[0])

        node_tree.links.new(vcol_mult_n.inputs[1],
                            mult2_mix_n.outputs["Mix Color"])

        # pass 4
        node_tree.links.new(compose_lighting_n.inputs["Specular Color"],
                            spec_vcol_mult_n.outputs[0])
Example #31
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree)

        geom_n = node_tree.nodes[DifSpec.GEOM_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        opacity_n = node_tree.nodes[DifSpec.OPACITY_NODE]
        spec_mult_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_mult_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]

        # move existing
        for node in node_tree.nodes:
            if node.location.x > start_pos_x + pos_x_shift:
                node.location.x += pos_x_shift

        # node creation
        uv_scale_n = node_tree.nodes.new("ShaderNodeValue")
        uv_scale_n.name = uv_scale_n.label = DifSpecFadeDifSpec.UV_SCALE_NODE
        uv_scale_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1200)

        detail_uv_scaling_n = node_tree.nodes.new("ShaderNodeMixRGB")
        detail_uv_scaling_n.name = detail_uv_scaling_n.label = DifSpecFadeDifSpec.DETAIL_UV_SCALING_NODE
        detail_uv_scaling_n.location = (start_pos_x, start_pos_y + 1200)
        detail_uv_scaling_n.blend_type = "MULTIPLY"
        detail_uv_scaling_n.inputs['Fac'].default_value = 1.0

        detail_tex_n = node_tree.nodes.new("ShaderNodeTexture")
        detail_tex_n.name = detail_tex_n.label = DifSpecFadeDifSpec.DETAIL_TEX_NODE
        detail_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)

        detail_setup_group_n = node_tree.nodes.new("ShaderNodeGroup")
        detail_setup_group_n.name = detail_setup_group_n.label = DifSpecFadeDifSpec.DETAIL_SETUP_GNODE
        detail_setup_group_n.location = (start_pos_x + pos_x_shift, start_pos_y + 900)
        detail_setup_group_n.node_tree = detail_setup_ng.get_node_group()

        base_detail_mix_a_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_detail_mix_a_n.name = base_detail_mix_a_n.label = DifSpecFadeDifSpec.BASE_DETAIL_MIX_A_NODE
        base_detail_mix_a_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1700)
        base_detail_mix_a_n.blend_type = "MIX"

        base_detail_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_detail_mix_n.name = base_detail_mix_n.label = DifSpecFadeDifSpec.BASE_DETAIL_MIX_NODE
        base_detail_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 1400)
        base_detail_mix_n.blend_type = "MIX"

        # links creation
        node_tree.links.new(detail_uv_scaling_n.inputs['Color1'], geom_n.outputs['UV'])
        node_tree.links.new(detail_uv_scaling_n.inputs['Color2'], uv_scale_n.outputs[0])

        # geom pass
        node_tree.links.new(detail_tex_n.inputs['Vector'], detail_uv_scaling_n.outputs['Color'])

        # pass 1
        node_tree.links.new(base_detail_mix_a_n.inputs['Fac'], detail_setup_group_n.outputs['Blend Factor'])
        node_tree.links.new(base_detail_mix_a_n.inputs['Color1'], base_tex_n.outputs['Value'])
        node_tree.links.new(base_detail_mix_a_n.inputs['Color2'], detail_tex_n.outputs['Value'])

        node_tree.links.new(base_detail_mix_n.inputs['Fac'], detail_setup_group_n.outputs['Blend Factor'])
        node_tree.links.new(base_detail_mix_n.inputs['Color1'], base_tex_n.outputs['Color'])
        node_tree.links.new(base_detail_mix_n.inputs['Color2'], detail_tex_n.outputs['Color'])

        # pass 2
        node_tree.links.new(spec_mult_n.inputs['Color2'], base_detail_mix_a_n.outputs['Color'])

        # pass 3
        node_tree.links.new(vcol_mult_n.inputs['Color2'], base_detail_mix_n.outputs['Color'])
Example #32
0
    def init(node_tree):
        """Initialize node tree with links for this shader.

        :param node_tree: node tree on which this shader should be created
        :type node_tree: bpy.types.NodeTree
        """

        start_pos_x = 0
        start_pos_y = 0

        pos_x_shift = 185

        # init parent
        DifSpec.init(node_tree, disable_remap_alpha=False)

        vcol_group_n = node_tree.nodes[DifSpec.VCOL_GROUP_NODE]
        base_tex_n = node_tree.nodes[DifSpec.BASE_TEX_NODE]
        spec_col_n = node_tree.nodes[DifSpec.SPEC_COL_NODE]
        spec_multi_n = node_tree.nodes[DifSpec.SPEC_MULT_NODE]
        vcol_scale_n = node_tree.nodes[DifSpec.VCOLOR_SCALE_NODE]
        vcol_multi_n = node_tree.nodes[DifSpec.VCOLOR_MULT_NODE]
        lighting_eval_n = node_tree.nodes[DifSpec.LIGHTING_EVAL_NODE]
        compose_lighting_n = node_tree.nodes[DifSpec.COMPOSE_LIGHTING_NODE]
        output_n = node_tree.nodes[DifSpec.OUTPUT_NODE]

        # delete existing
        node_tree.nodes.remove(node_tree.nodes[DifSpec.OPACITY_NODE])

        # move existing
        spec_multi_n.location.x += pos_x_shift
        spec_multi_n.location.y += 100
        lighting_eval_n.location.x += pos_x_shift
        compose_lighting_n.location.x += pos_x_shift
        output_n.location.x += pos_x_shift

        # node creation
        sec_geom_n = node_tree.nodes.new("ShaderNodeUVMap")
        sec_geom_n.name = sec_geom_n.label = DifSpecWeightWeightDifSpecWeight.SEC_UVMAP_NODE
        sec_geom_n.location = (start_pos_x - pos_x_shift, start_pos_y + 1100)
        sec_geom_n.uv_map = _MESH_consts.none_uv

        sec_spec_col_n = node_tree.nodes.new("ShaderNodeRGB")
        sec_spec_col_n.name = sec_spec_col_n.label = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_COL_NODE
        sec_spec_col_n.location = (start_pos_x + pos_x_shift,
                                   start_pos_y + 2100)

        over_tex_n = node_tree.nodes.new("ShaderNodeTexImage")
        over_tex_n.name = over_tex_n.label = DifSpecWeightWeightDifSpecWeight.OVER_TEX_NODE
        over_tex_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1200)
        over_tex_n.width = 140

        sec_spec_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        sec_spec_mix_n.name = sec_spec_mix_n.label = DifSpecWeightWeightDifSpecWeight.SEC_SPEC_MIX_NODE
        sec_spec_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                   start_pos_y + 2100)
        sec_spec_mix_n.blend_type = "MIX"

        sec_shininess_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        sec_shininess_mix_n.name = sec_shininess_mix_n.label = DifSpecWeightWeightDifSpecWeight.SEC_SHININESS_MIX_NODE
        sec_shininess_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                        start_pos_y + 2300)
        sec_shininess_mix_n.blend_type = "MIX"

        base_over_a_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_over_a_mix_n.name = base_over_a_mix_n.label = DifSpecWeightWeightDifSpecWeight.BASE_OVER_A_MIX_NODE
        base_over_a_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                      start_pos_y + 1900)
        base_over_a_mix_n.blend_type = "MIX"

        base_over_mix_n = node_tree.nodes.new("ShaderNodeMixRGB")
        base_over_mix_n.name = base_over_mix_n.label = DifSpecWeightWeightDifSpecWeight.BASE_OVER_MIX_NODE
        base_over_mix_n.location = (start_pos_x + pos_x_shift * 3,
                                    start_pos_y + 1350)

        vcol_spec_mul_n = node_tree.nodes.new("ShaderNodeVectorMath")
        vcol_spec_mul_n.name = vcol_spec_mul_n.label = DifSpecWeightWeightDifSpecWeight.VCOL_SPEC_MULT_NODE
        vcol_spec_mul_n.location = (start_pos_x + pos_x_shift * 5,
                                    start_pos_y + 1900)
        vcol_spec_mul_n.operation = "MULTIPLY"

        # links creation
        node_tree.links.new(over_tex_n.inputs["Vector"],
                            sec_geom_n.outputs["UV"])

        # pass 1
        node_tree.links.new(sec_shininess_mix_n.inputs["Fac"],
                            vcol_group_n.outputs["Vertex Color Alpha"])

        node_tree.links.new(sec_spec_mix_n.inputs["Fac"],
                            vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(sec_spec_mix_n.inputs["Color1"],
                            spec_col_n.outputs["Color"])
        node_tree.links.new(sec_spec_mix_n.inputs["Color2"],
                            sec_spec_col_n.outputs["Color"])

        node_tree.links.new(base_over_a_mix_n.inputs["Fac"],
                            vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(base_over_a_mix_n.inputs["Color1"],
                            base_tex_n.outputs["Alpha"])
        node_tree.links.new(base_over_a_mix_n.inputs["Color2"],
                            over_tex_n.outputs["Alpha"])

        node_tree.links.new(base_over_mix_n.inputs["Fac"],
                            vcol_group_n.outputs["Vertex Color Alpha"])
        node_tree.links.new(base_over_mix_n.inputs["Color1"],
                            base_tex_n.outputs["Color"])
        node_tree.links.new(base_over_mix_n.inputs["Color2"],
                            over_tex_n.outputs["Color"])

        # pass 2
        node_tree.links.new(spec_multi_n.inputs[0],
                            sec_spec_mix_n.outputs["Color"])
        node_tree.links.new(spec_multi_n.inputs[1],
                            base_over_a_mix_n.outputs["Color"])

        node_tree.links.new(vcol_multi_n.inputs[1],
                            base_over_mix_n.outputs["Color"])

        # pass 3
        node_tree.links.new(vcol_spec_mul_n.inputs[0], spec_multi_n.outputs[0])
        node_tree.links.new(vcol_spec_mul_n.inputs[1], vcol_scale_n.outputs[0])

        # pass 4
        node_tree.links.new(lighting_eval_n.inputs["Shininess"],
                            sec_shininess_mix_n.outputs["Color"])

        # pass 5
        node_tree.links.new(compose_lighting_n.inputs["Specular Color"],
                            vcol_spec_mul_n.outputs[0])
        node_tree.links.new(compose_lighting_n.inputs['Alpha'],
                            base_tex_n.outputs['Alpha'])