Esempio n. 1
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
        DifSpecWeight.init(node_tree)
        StdAddEnv.add(
            node_tree, DifSpecWeight.GEOM_NODE,
            node_tree.nodes[DifSpecWeight.SPEC_COL_NODE].outputs['Color'],
            node_tree.nodes[
                DifSpecWeight.REMAP_ALPHA_GNODE].outputs['Weighted Alpha'],
            node_tree.nodes[
                DifSpecWeight.LIGHTING_EVAL_NODE].outputs['Normal'],
            node_tree.nodes[
                DifSpecWeight.COMPOSE_LIGHTING_NODE].inputs['Env Color'])

        vcol_scale_n = node_tree.nodes[DifSpecWeight.VCOLOR_SCALE_NODE]
        add_env_gn = node_tree.nodes[StdAddEnv.ADD_ENV_GROUP_NODE]

        # links creation
        node_tree.links.new(add_env_gn.inputs['Weighted Color'],
                            vcol_scale_n.outputs[0])
Esempio n. 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
        """

        # init parents
        DifSpecWeight.init(node_tree)
        StdAddEnv.add(node_tree, DifSpecWeight.GEOM_NODE,
                      DifSpecWeight.SPEC_COL_NODE, DifSpecWeight.BASE_TEX_NODE,
                      DifSpecWeight.OUT_MAT_NODE,
                      DifSpecWeight.COMPOSE_LIGHTING_NODE)
Esempio n. 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 parents
        DifSpecWeight.init(node_tree)
        StdAddEnv.add(node_tree,
                      DifSpecWeight.GEOM_NODE,
                      DifSpecWeight.SPEC_COL_NODE,
                      DifSpecWeight.BASE_TEX_NODE,
                      DifSpecWeight.OUT_MAT_NODE,
                      DifSpecWeight.OUTPUT_NODE)
Esempio n. 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 parents
        DifSpecWeight.init(node_tree)
        StdAddEnv.add(
            node_tree, DifSpecWeight.GEOM_NODE,
            node_tree.nodes[DifSpecWeight.SPEC_COL_NODE].outputs['Color'],
            node_tree.nodes[
                DifSpecWeight.REMAP_ALPHA_GNODE].outputs['Weighted Alpha'],
            node_tree.nodes[DifSpecWeight.OUT_MAT_NODE].outputs['Normal'],
            node_tree.nodes[
                DifSpecWeight.COMPOSE_LIGHTING_NODE].inputs['Env Color'])
Esempio n. 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
        DifSpecWeight.init(node_tree)

        geometry_n = node_tree.nodes[DifSpecWeight.GEOM_NODE]
        spec_col_n = node_tree.nodes[DifSpecWeight.SPEC_COL_NODE]
        base_tex_n = node_tree.nodes[DifSpecWeight.BASE_TEX_NODE]
        out_mat_n = node_tree.nodes[DifSpecWeight.OUT_MAT_NODE]
        output_n = node_tree.nodes[DifSpecWeight.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 = DifSpecWeightAddEnv.REFL_TEX_NODE
        refl_tex_n.label = DifSpecWeightAddEnv.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 = DifSpecWeightAddEnv.ENV_COLOR_NODE
        env_col_n.label = DifSpecWeightAddEnv.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 = DifSpecWeightAddEnv.ADD_ENV_GROUP_NODE
        add_env_gn.label = DifSpecWeightAddEnv.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 = DifSpecWeightAddEnv.OUT_ADD_REFL_NODE
        out_add_refl_n.label = DifSpecWeightAddEnv.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"])
Esempio n. 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
        DifSpecWeight.init(node_tree)

        geometry_n = node_tree.nodes[DifSpecWeight.GEOM_NODE]
        spec_col_n = node_tree.nodes[DifSpecWeight.SPEC_COL_NODE]
        base_tex_n = node_tree.nodes[DifSpecWeight.BASE_TEX_NODE]
        out_mat_n = node_tree.nodes[DifSpecWeight.OUT_MAT_NODE]
        output_n = node_tree.nodes[DifSpecWeight.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 = DifSpecWeightAddEnv.REFL_TEX_NODE
        refl_tex_n.label = DifSpecWeightAddEnv.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 = DifSpecWeightAddEnv.ENV_COLOR_NODE
        env_col_n.label = DifSpecWeightAddEnv.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 = DifSpecWeightAddEnv.ADD_ENV_GROUP_NODE
        add_env_gn.label = DifSpecWeightAddEnv.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 = DifSpecWeightAddEnv.OUT_ADD_REFL_NODE
        out_add_refl_n.label = DifSpecWeightAddEnv.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'])