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])
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)
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 DifSpecMultDifSpec.init(node_tree) StdAddEnv.add(node_tree, DifSpecMultDifSpec.GEOM_NODE, DifSpecMultDifSpec.SPEC_COL_NODE, DifSpecMultDifSpec.BASE_TEX_NODE, DifSpecMultDifSpec.OUT_MAT_NODE, DifSpecMultDifSpec.OUTPUT_NODE)
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'])
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 DifSpecOclu.init(node_tree) StdAddEnv.add( node_tree, DifSpecOclu.GEOM_NODE, node_tree.nodes[DifSpecOclu.SPEC_COL_NODE].outputs['Color'], node_tree.nodes[DifSpecOclu.BASE_TEX_NODE].outputs['Value'], node_tree.nodes[DifSpecOclu.OUT_MAT_NODE].outputs['Normal'], node_tree.nodes[ DifSpecOclu.COMPOSE_LIGHTING_NODE].inputs['Env Color'])
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 DifSpecOclu.init(node_tree) spec_mult_n = node_tree.nodes[DifSpecOclu.SPEC_MULT_NODE] vcol_scale_n = node_tree.nodes[DifSpecOclu.VCOLOR_SCALE_NODE] compose_lighting_n = node_tree.nodes[DifSpecOclu.COMPOSE_LIGHTING_NODE] # init nodes vcol_spec_mult_n = node_tree.nodes.new("ShaderNodeVectorMath") vcol_spec_mult_n.name = vcol_spec_mult_n.label = DifSpecOcluWeightAddEnv.VCOLOR_SPEC_MULT_NODE vcol_spec_mult_n.location = (spec_mult_n.location.x + 185, spec_mult_n.location.y) vcol_spec_mult_n.operation = "MULTIPLY" # make links node_tree.links.new(vcol_spec_mult_n.inputs[0], spec_mult_n.outputs[0]) node_tree.links.new(vcol_spec_mult_n.inputs[1], vcol_scale_n.outputs[0]) node_tree.links.new(compose_lighting_n.inputs['Specular Color'], vcol_spec_mult_n.outputs[0]) # init env pass StdAddEnv.add(node_tree, DifSpecOclu.GEOM_NODE, node_tree.nodes[DifSpecOclu.SPEC_COL_NODE].outputs['Color'], node_tree.nodes[DifSpecOclu.BASE_TEX_NODE].outputs['Alpha'], node_tree.nodes[DifSpecOclu.LIGHTING_EVAL_NODE].outputs['Normal'], node_tree.nodes[DifSpecOclu.COMPOSE_LIGHTING_NODE].inputs['Env Color']) oclu_sep_n = node_tree.nodes[DifSpecOclu.OCLU_SEPARATE_RGB_NODE] vcol_scale_n = node_tree.nodes[DifSpecOclu.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]) node_tree.links.new(add_env_gn.inputs['Strength Multiplier'], oclu_sep_n.outputs['R'])
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 DifSpecOclu.init(node_tree) spec_mult_n = node_tree.nodes[DifSpecOclu.SPEC_MULT_NODE] vcol_scale_n = node_tree.nodes[DifSpecOclu.VCOLOR_SCALE_NODE] out_mat_n = node_tree.nodes[DifSpecOclu.OUT_MAT_NODE] # init nodes vcol_spec_mult_n = node_tree.nodes.new("ShaderNodeMixRGB") vcol_spec_mult_n.name = vcol_spec_mult_n.label = DifSpecOcluWeightAddEnv.VCOLOR_SPEC_MULT_NODE vcol_spec_mult_n.location = (spec_mult_n.location.x + 185, spec_mult_n.location.y) vcol_spec_mult_n.blend_type = "MULTIPLY" vcol_spec_mult_n.inputs['Fac'].default_value = 1 # make links node_tree.links.new(vcol_spec_mult_n.inputs['Color1'], spec_mult_n.outputs['Color']) node_tree.links.new(vcol_spec_mult_n.inputs['Color2'], vcol_scale_n.outputs['Color']) node_tree.links.new(out_mat_n.inputs['Spec'], vcol_spec_mult_n.outputs['Color']) # init env pass StdAddEnv.add( node_tree, DifSpecOclu.GEOM_NODE, node_tree.nodes[DifSpecOclu.SPEC_COL_NODE].outputs['Color'], node_tree.nodes[DifSpecOclu.BASE_TEX_NODE].outputs['Value'], node_tree.nodes[DifSpecOclu.OUT_MAT_NODE].outputs['Normal'], node_tree.nodes[ DifSpecOclu.COMPOSE_LIGHTING_NODE].inputs['Env Color'])
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 DifSpecOclu.init(node_tree) StdAddEnv.add( node_tree, DifSpecOclu.GEOM_NODE, node_tree.nodes[DifSpecOclu.SPEC_COL_NODE].outputs['Color'], node_tree.nodes[DifSpecOclu.BASE_TEX_NODE].outputs['Alpha'], node_tree.nodes[DifSpecOclu.LIGHTING_EVAL_NODE].outputs['Normal'], node_tree.nodes[ DifSpecOclu.COMPOSE_LIGHTING_NODE].inputs['Env Color']) oclu_sep_n = node_tree.nodes[DifSpecOclu.OCLU_SEPARATE_RGB_NODE] add_env_gn = node_tree.nodes[StdAddEnv.ADD_ENV_GROUP_NODE] # links creation node_tree.links.new(add_env_gn.inputs['Strength Multiplier'], oclu_sep_n.outputs['R'])
def init(node_tree): """Initialize node tree with links for this shader. NODE: this is fake representation only to utilize textures :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 Dif.init(node_tree) diff_col_n = node_tree.nodes[Dif.DIFF_COL_NODE] vcol_mult_n = node_tree.nodes[Dif.VCOLOR_MULT_NODE] out_mat_n = node_tree.nodes[Dif.OUT_MAT_NODE] output_n = node_tree.nodes[Dif.OUTPUT_NODE] # delete existing node_tree.nodes.remove(node_tree.nodes[Dif.BASE_TEX_NODE]) node_tree.nodes.remove(node_tree.nodes[Dif.OPACITY_NODE]) node_tree.nodes.remove(node_tree.nodes[Dif.DIFF_MULT_NODE]) # move existing vcol_mult_n.location.y -= 0 out_mat_n.location.x += pos_x_shift * 2 output_n.location.x += pos_x_shift * 2 # nodes creation mix_factor_gn = node_tree.nodes.new("ShaderNodeGroup") mix_factor_gn.name = mix_factor_gn.label = Water.MIX_FACTOR_GNODE mix_factor_gn.location = (start_pos_x + pos_x_shift, start_pos_y + 1500) mix_factor_gn.node_tree = mix_factor_ng.get_node_group() near_col_n = node_tree.nodes.new("ShaderNodeRGB") near_col_n.label = near_col_n.name = Water.NEAR_COLOR_NODE near_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1300) horizon_col_n = node_tree.nodes.new("ShaderNodeRGB") horizon_col_n.label = horizon_col_n.name = Water.HORIZON_COLOR_NODE horizon_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1100) layer0_mat_n = node_tree.nodes.new("ShaderNodeMaterial") layer0_mat_n.name = layer0_mat_n.label = Water.LAYER0_MAT_NODE layer0_mat_n.location = (start_pos_x + pos_x_shift, start_pos_y + 900) layer0_mat_n.use_diffuse = False layer0_mat_n.use_specular = False layer1_mat_n = node_tree.nodes.new("ShaderNodeMaterial") layer1_mat_n.name = layer1_mat_n.label = Water.LAYER1_MAT_NODE layer1_mat_n.location = (start_pos_x + pos_x_shift, start_pos_y + 500) layer1_mat_n.use_diffuse = False layer1_mat_n.use_specular = False lay0_lay1_normal_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") lay0_lay1_normal_mix_n.name = lay0_lay1_normal_mix_n.label = Water.LAY0_LAY1_NORMAL_MIX_NODE lay0_lay1_normal_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 700) lay0_lay1_normal_mix_n.blend_type = "ADD" lay0_lay1_normal_mix_n.inputs["Fac"].default_value = 1.0 normal_normalize_n = node_tree.nodes.new("ShaderNodeVectorMath") normal_normalize_n.name = normal_normalize_n.label = Water.LAY0_LAY1_NORMAL_MIX_NODE normal_normalize_n.location = (start_pos_x + pos_x_shift * 4, start_pos_y + 700) normal_normalize_n.operation = "NORMALIZE" near_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") near_mix_n.name = near_mix_n.label = Water.NEAR_MIX_NODE near_mix_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1400) near_mix_n.blend_type = "MULTIPLY" near_mix_n.inputs["Fac"].default_value = 1.0 horizon_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") horizon_mix_n.name = horizon_mix_n.label = Water.HORIZON_MIX_NODE horizon_mix_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1200) horizon_mix_n.blend_type = "MULTIPLY" horizon_mix_n.inputs["Fac"].default_value = 1.0 near_horizon_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") near_horizon_mix_n.name = near_horizon_mix_n.label = Water.NEAR_HORIZON_MIX_NODE near_horizon_mix_n.location = (start_pos_x + pos_x_shift * 6, start_pos_y + 1700) near_horizon_mix_n.blend_type = "MIX" # add environment pass and normal maps StdAddEnv.add(node_tree, Dif.GEOM_NODE, Dif.SPEC_COL_NODE, "", Water.NEAR_MIX_NODE, Water.NEAR_HORIZON_MIX_NODE) # links creation # pass 1 node_tree.links.new(lay0_lay1_normal_mix_n.inputs["Color1"], layer0_mat_n.outputs["Normal"]) node_tree.links.new(lay0_lay1_normal_mix_n.inputs["Color2"], layer1_mat_n.outputs["Normal"]) # pass 2 node_tree.links.new(normal_normalize_n.inputs[0], lay0_lay1_normal_mix_n.outputs["Color"]) # pass 3 node_tree.links.new(near_mix_n.inputs["Color1"], vcol_mult_n.outputs["Color"]) node_tree.links.new(near_mix_n.inputs["Color2"], near_col_n.outputs["Color"]) node_tree.links.new(horizon_mix_n.inputs["Color1"], vcol_mult_n.outputs["Color"]) node_tree.links.new(horizon_mix_n.inputs["Color2"], horizon_col_n.outputs["Color"]) # pass 4 node_tree.links.new(vcol_mult_n.inputs["Color2"], diff_col_n.outputs["Color"]) # pass 5 node_tree.links.new(near_horizon_mix_n.inputs["Fac"], mix_factor_gn.outputs["Mix Factor"]) node_tree.links.new(near_horizon_mix_n.inputs["Color2"], horizon_mix_n.outputs["Color"]) # material pass node_tree.links.new(out_mat_n.inputs["Color"], near_horizon_mix_n.outputs["Color"]) node_tree.links.new(out_mat_n.inputs["Normal"], normal_normalize_n.outputs["Vector"])
def init(node_tree): """Initialize node tree with links for this shader. NODE: this is fake representation only to utilize textures :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 Dif.init(node_tree) diff_col_n = node_tree.nodes[Dif.DIFF_COL_NODE] vcol_mult_n = node_tree.nodes[Dif.VCOLOR_MULT_NODE] out_mat_n = node_tree.nodes[Dif.OUT_MAT_NODE] output_n = node_tree.nodes[Dif.OUTPUT_NODE] # delete existing node_tree.nodes.remove(node_tree.nodes[Dif.COMPOSE_LIGHTING_NODE]) node_tree.nodes.remove(node_tree.nodes[Dif.BASE_TEX_NODE]) node_tree.nodes.remove(node_tree.nodes[Dif.OPACITY_NODE]) node_tree.nodes.remove(node_tree.nodes[Dif.DIFF_MULT_NODE]) # move existing vcol_mult_n.location.y -= 0 out_mat_n.location.x += pos_x_shift * 2 output_n.location.x += pos_x_shift * 2 # nodes creation mix_factor_gn = node_tree.nodes.new("ShaderNodeGroup") mix_factor_gn.name = mix_factor_gn.label = Water.MIX_FACTOR_GNODE mix_factor_gn.location = (start_pos_x + pos_x_shift, start_pos_y + 1500) mix_factor_gn.node_tree = mix_factor_ng.get_node_group() near_col_n = node_tree.nodes.new("ShaderNodeRGB") near_col_n.label = near_col_n.name = Water.NEAR_COLOR_NODE near_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1300) horizon_col_n = node_tree.nodes.new("ShaderNodeRGB") horizon_col_n.label = horizon_col_n.name = Water.HORIZON_COLOR_NODE horizon_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1100) layer0_mat_n = node_tree.nodes.new("ShaderNodeMaterial") layer0_mat_n.name = layer0_mat_n.label = Water.LAYER0_MAT_NODE layer0_mat_n.location = (start_pos_x + pos_x_shift, start_pos_y + 900) layer0_mat_n.use_diffuse = False layer0_mat_n.use_specular = False layer1_mat_n = node_tree.nodes.new("ShaderNodeMaterial") layer1_mat_n.name = layer1_mat_n.label = Water.LAYER1_MAT_NODE layer1_mat_n.location = (start_pos_x + pos_x_shift, start_pos_y + 500) layer1_mat_n.use_diffuse = False layer1_mat_n.use_specular = False lay0_lay1_normal_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") lay0_lay1_normal_mix_n.name = lay0_lay1_normal_mix_n.label = Water.LAY0_LAY1_NORMAL_MIX_NODE lay0_lay1_normal_mix_n.location = (start_pos_x + pos_x_shift * 3, start_pos_y + 700) lay0_lay1_normal_mix_n.blend_type = "ADD" lay0_lay1_normal_mix_n.inputs['Fac'].default_value = 1.0 normal_normalize_n = node_tree.nodes.new("ShaderNodeVectorMath") normal_normalize_n.name = normal_normalize_n.label = Water.LAY0_LAY1_NORMAL_MIX_NODE normal_normalize_n.location = (start_pos_x + pos_x_shift * 4, start_pos_y + 700) normal_normalize_n.operation = "NORMALIZE" near_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") near_mix_n.name = near_mix_n.label = Water.NEAR_MIX_NODE near_mix_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1400) near_mix_n.blend_type = "MULTIPLY" near_mix_n.inputs['Fac'].default_value = 1.0 horizon_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") horizon_mix_n.name = horizon_mix_n.label = Water.HORIZON_MIX_NODE horizon_mix_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1200) horizon_mix_n.blend_type = "MULTIPLY" horizon_mix_n.inputs['Fac'].default_value = 1.0 add_refl_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") add_refl_mix_n.name = add_refl_mix_n.label = Water.ADD_REFL_MIX_NODE add_refl_mix_n.location = (start_pos_x + pos_x_shift * 6, start_pos_y + 2000) add_refl_mix_n.blend_type = "ADD" add_refl_mix_n.inputs['Fac'].default_value = 1.0 near_horizon_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") near_horizon_mix_n.name = near_horizon_mix_n.label = Water.NEAR_HORIZON_MIX_NODE near_horizon_mix_n.location = (start_pos_x + pos_x_shift * 7, start_pos_y + 1700) near_horizon_mix_n.blend_type = "MIX" # add environment pass and normal maps StdAddEnv.add(node_tree, Dif.GEOM_NODE, node_tree.nodes[Dif.SPEC_COL_NODE].outputs['Color'], None, None, node_tree.nodes[Water.ADD_REFL_MIX_NODE].inputs['Color1']) # links creation # pass 1 node_tree.links.new(lay0_lay1_normal_mix_n.inputs['Color1'], layer0_mat_n.outputs['Normal']) node_tree.links.new(lay0_lay1_normal_mix_n.inputs['Color2'], layer1_mat_n.outputs['Normal']) # pass 2 node_tree.links.new(normal_normalize_n.inputs[0], lay0_lay1_normal_mix_n.outputs['Color']) node_tree.links.new(vcol_mult_n.inputs['Color2'], diff_col_n.outputs['Color']) # pass 3 node_tree.links.new(near_mix_n.inputs['Color1'], vcol_mult_n.outputs['Color']) node_tree.links.new(near_mix_n.inputs['Color2'], near_col_n.outputs['Color']) node_tree.links.new(horizon_mix_n.inputs['Color1'], vcol_mult_n.outputs['Color']) node_tree.links.new(horizon_mix_n.inputs['Color2'], horizon_col_n.outputs['Color']) # pass 4 node_tree.links.new(add_refl_mix_n.inputs['Color2'], near_mix_n.outputs['Color']) # pass 5 node_tree.links.new(near_horizon_mix_n.inputs['Fac'], mix_factor_gn.outputs['Mix Factor']) node_tree.links.new(near_horizon_mix_n.inputs['Color1'], add_refl_mix_n.outputs['Color']) node_tree.links.new(near_horizon_mix_n.inputs['Color2'], horizon_mix_n.outputs['Color']) # material pass node_tree.links.new(out_mat_n.inputs['Color'], near_horizon_mix_n.outputs['Color']) node_tree.links.new(out_mat_n.inputs['Normal'], normal_normalize_n.outputs['Vector']) # output pass node_tree.links.new(output_n.inputs['Color'], out_mat_n.outputs['Color'])
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 Dif.init(node_tree) geom_n = node_tree.nodes[Dif.GEOM_NODE] diff_col_n = node_tree.nodes[Dif.DIFF_COL_NODE] vcol_mult_n = node_tree.nodes[Dif.VCOLOR_MULT_NODE] lighting_eval_n = node_tree.nodes[Dif.LIGHTING_EVAL_NODE] compose_lighting_n = node_tree.nodes[Dif.COMPOSE_LIGHTING_NODE] output_n = node_tree.nodes[Dif.OUTPUT_NODE] # delete existing node_tree.nodes.remove(node_tree.nodes[Dif.BASE_TEX_NODE]) node_tree.nodes.remove(node_tree.nodes[Dif.OPACITY_NODE]) node_tree.nodes.remove(node_tree.nodes[Dif.DIFF_MULT_NODE]) # move existing vcol_mult_n.location.y -= 0 lighting_eval_n.location.x += pos_x_shift * 3 compose_lighting_n.location.x += pos_x_shift * 3 output_n.location.x += pos_x_shift * 3 # nodes creation water_stream_n = node_tree.nodes.new("ShaderNodeGroup") water_stream_n.name = water_stream_n.label = Water.WATER_STREAM_NODE water_stream_n.location = (start_pos_x - pos_x_shift, start_pos_y + 700) water_stream_n.node_tree = water_stream_ng.get_node_group() mix_factor_n = node_tree.nodes.new("ShaderNodeGroup") mix_factor_n.name = mix_factor_n.label = Water.MIX_FACTOR_GNODE mix_factor_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1500) mix_factor_n.node_tree = mix_factor_ng.get_node_group() near_col_n = node_tree.nodes.new("ShaderNodeRGB") near_col_n.label = near_col_n.name = Water.NEAR_COLOR_NODE near_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1300) horizon_col_n = node_tree.nodes.new("ShaderNodeRGB") horizon_col_n.label = horizon_col_n.name = Water.HORIZON_COLOR_NODE horizon_col_n.location = (start_pos_x + pos_x_shift, start_pos_y + 1100) near_mix_n = node_tree.nodes.new("ShaderNodeVectorMath") near_mix_n.name = near_mix_n.label = Water.NEAR_MIX_NODE near_mix_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1400) near_mix_n.operation = "MULTIPLY" horizon_mix_n = node_tree.nodes.new("ShaderNodeVectorMath") horizon_mix_n.name = horizon_mix_n.label = Water.HORIZON_MIX_NODE horizon_mix_n.location = (start_pos_x + pos_x_shift * 5, start_pos_y + 1200) horizon_mix_n.operation = "MULTIPLY" lay0_lay1_normal_mix_n = node_tree.nodes.new("ShaderNodeVectorMath") lay0_lay1_normal_mix_n.name = lay0_lay1_normal_mix_n.label = Water.LAY0_LAY1_NORMAL_MIX_NODE lay0_lay1_normal_mix_n.location = (start_pos_x + pos_x_shift * 6, start_pos_y + 700) lay0_lay1_normal_mix_n.operation = "ADD" normal_normalize_n = node_tree.nodes.new("ShaderNodeVectorMath") normal_normalize_n.name = normal_normalize_n.label = Water.LAY0_LAY1_NORMAL_MIX_NODE normal_normalize_n.location = (start_pos_x + pos_x_shift * 7, start_pos_y + 700) normal_normalize_n.operation = "NORMALIZE" near_horizon_env_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") near_horizon_env_mix_n.name = near_horizon_env_mix_n.label = Water.NEAR_HORIZON_ENV_MIX_NODE near_horizon_env_mix_n.location = (start_pos_x + pos_x_shift * 7, start_pos_y + 2100) near_horizon_env_mix_n.blend_type = "MIX" near_horizon_env_mix_n.inputs['Color2'].default_value = ( 0.0, ) * 4 # far horizon is without env, thus lerp to zero near_horizon_mix_n = node_tree.nodes.new("ShaderNodeMixRGB") near_horizon_mix_n.name = near_horizon_mix_n.label = Water.NEAR_HORIZON_MIX_NODE near_horizon_mix_n.location = (start_pos_x + pos_x_shift * 7, start_pos_y + 1700) near_horizon_mix_n.blend_type = "MIX" normal_scramble_n = node_tree.nodes.new("ShaderNodeMixRGB") normal_scramble_n.name = normal_scramble_n.label = Water.LAY0_LAY1_NORMAL_SCRAMBLE_NODE normal_scramble_n.location = (start_pos_x + pos_x_shift * 8, start_pos_y + 1200) normal_scramble_n.blend_type = "MIX" normal_scramble_n.inputs['Color1'].default_value = (0.0, 0.0, 1.0, 0.0 ) # WATER_V_NORMAL # links creation # pass 2 node_tree.links.new(normal_normalize_n.inputs[0], lay0_lay1_normal_mix_n.outputs[0]) node_tree.links.new(vcol_mult_n.inputs[1], diff_col_n.outputs['Color']) # pass 3 node_tree.links.new(near_mix_n.inputs[0], vcol_mult_n.outputs[0]) node_tree.links.new(near_mix_n.inputs[1], near_col_n.outputs['Color']) node_tree.links.new(horizon_mix_n.inputs[0], vcol_mult_n.outputs[0]) node_tree.links.new(horizon_mix_n.inputs[1], horizon_col_n.outputs['Color']) node_tree.links.new(normal_scramble_n.inputs['Fac'], mix_factor_n.outputs['Scramble Mix Factor']) node_tree.links.new(normal_scramble_n.inputs['Color2'], normal_normalize_n.outputs['Vector']) # pass 5 node_tree.links.new(near_horizon_env_mix_n.inputs['Fac'], mix_factor_n.outputs['Mix Factor']) node_tree.links.new(near_horizon_env_mix_n.inputs['Color1'], near_mix_n.outputs[0]) node_tree.links.new(near_horizon_mix_n.inputs['Fac'], mix_factor_n.outputs['Mix Factor']) node_tree.links.new(near_horizon_mix_n.inputs['Color1'], near_mix_n.outputs[0]) node_tree.links.new(near_horizon_mix_n.inputs['Color2'], horizon_mix_n.outputs[0]) # pass 6 node_tree.links.new(lighting_eval_n.inputs['Normal Vector'], normal_scramble_n.outputs['Color']) # pass 7 node_tree.links.new(compose_lighting_n.inputs['Env Color'], near_horizon_env_mix_n.outputs['Color']) node_tree.links.new(compose_lighting_n.inputs['Diffuse Color'], near_horizon_mix_n.outputs['Color']) # add environment pass and normal maps StdAddEnv.add( node_tree, Dif.GEOM_NODE, node_tree.nodes[Dif.SPEC_COL_NODE].outputs['Color'], None, node_tree.nodes[Water.LIGHTING_EVAL_NODE].outputs['Normal'], node_tree.nodes[Water.NEAR_HORIZON_ENV_MIX_NODE].inputs['Color1']) node_tree.nodes[StdAddEnv.ADD_ENV_GROUP_NODE].inputs[ 'Base Texture Alpha'].default_value = 1 # set full reflection strength Water.__init_nmap__(node_tree, Water.LAYER0_NMAP_UID, (start_pos_x + pos_x_shift, start_pos_y + 800), geom_n.outputs['Position'], water_stream_n.outputs['Stream0'], geom_n.outputs['Normal'], lay0_lay1_normal_mix_n.inputs[0]) Water.__init_nmap__(node_tree, Water.LAYER1_NMAP_UID, (start_pos_x + pos_x_shift, start_pos_y + 500), geom_n.outputs['Position'], water_stream_n.outputs['Stream1'], geom_n.outputs['Normal'], lay0_lay1_normal_mix_n.inputs[1])