diff --git a/model/object/lunar_rock_procgen/geometry.py b/model/object/lunar_rock_procgen/geometry.py index 17e2108..55d34b1 100644 --- a/model/object/lunar_rock_procgen/geometry.py +++ b/model/object/lunar_rock_procgen/geometry.py @@ -1,4 +1,5 @@ import bpy +import mathutils # initialize random__normal_ node group @@ -9,6 +10,7 @@ def random__normal__node_group(): random__normal_.color_tag = "NONE" random__normal_.description = "" + random__normal_.default_group_node_width = 140 # random__normal_ interface # Socket Value @@ -285,6 +287,7 @@ def random__uniform__node_group(): random__uniform_.color_tag = "NONE" random__uniform_.description = "" + random__uniform_.default_group_node_width = 140 # random__uniform_ interface # Socket Value @@ -381,6 +384,7 @@ def lunarrock_node_group(): lunarrock.color_tag = "GEOMETRY" lunarrock.description = "" + lunarrock.default_group_node_width = 140 lunarrock.is_modifier = True @@ -599,6 +603,7 @@ def lunarrock_node_group(): # node Reroute.001 reroute_001 = lunarrock.nodes.new("NodeReroute") reroute_001.name = "Reroute.001" + reroute_001.socket_idname = "NodeSocketFloat" # node Transform Geometry transform_geometry = lunarrock.nodes.new("GeometryNodeTransform") transform_geometry.name = "Transform Geometry" @@ -611,6 +616,7 @@ def lunarrock_node_group(): # node Reroute.002 reroute_002 = lunarrock.nodes.new("NodeReroute") reroute_002.name = "Reroute.002" + reroute_002.socket_idname = "NodeSocketInt" # node Attribute Statistic attribute_statistic = lunarrock.nodes.new("GeometryNodeAttributeStatistic") attribute_statistic.name = "Attribute Statistic" @@ -632,6 +638,7 @@ def lunarrock_node_group(): # node Reroute.003 reroute_003 = lunarrock.nodes.new("NodeReroute") reroute_003.name = "Reroute.003" + reroute_003.socket_idname = "NodeSocketGeometry" # node Vector Math.002 vector_math_002 = lunarrock.nodes.new("ShaderNodeVectorMath") vector_math_002.name = "Vector Math.002" @@ -745,6 +752,7 @@ def lunarrock_node_group(): # node Reroute.005 reroute_005 = lunarrock.nodes.new("NodeReroute") reroute_005.name = "Reroute.005" + reroute_005.socket_idname = "NodeSocketFloat" # node Group.003 group_003 = lunarrock.nodes.new("GeometryNodeGroup") group_003.name = "Group.003" @@ -774,9 +782,11 @@ def lunarrock_node_group(): # node Reroute.006 reroute_006 = lunarrock.nodes.new("NodeReroute") reroute_006.name = "Reroute.006" + reroute_006.socket_idname = "NodeSocketFloat" # node Reroute reroute = lunarrock.nodes.new("NodeReroute") reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketVectorXYZ" # node Group.007 group_007 = lunarrock.nodes.new("GeometryNodeGroup") group_007.name = "Group.007" @@ -979,6 +989,7 @@ def lunarrock_node_group(): # node Reroute.010 reroute_010 = lunarrock.nodes.new("NodeReroute") reroute_010.name = "Reroute.010" + reroute_010.socket_idname = "NodeSocketBool" # node Cube.001 cube_001 = lunarrock.nodes.new("GeometryNodeMeshCube") cube_001.name = "Cube.001" @@ -1002,6 +1013,7 @@ def lunarrock_node_group(): # node Reroute.004 reroute_004 = lunarrock.nodes.new("NodeReroute") reroute_004.name = "Reroute.004" + reroute_004.socket_idname = "NodeSocketGeometry" # node Frame.004 frame_004 = lunarrock.nodes.new("NodeFrame") frame_004.name = "Frame.004" @@ -1011,9 +1023,11 @@ def lunarrock_node_group(): # node Reroute.012 reroute_012 = lunarrock.nodes.new("NodeReroute") reroute_012.name = "Reroute.012" + reroute_012.socket_idname = "NodeSocketFloatDistance" # node Reroute.013 reroute_013 = lunarrock.nodes.new("NodeReroute") reroute_013.name = "Reroute.013" + reroute_013.socket_idname = "NodeSocketFloatDistance" # node Transform Geometry.003 transform_geometry_003 = lunarrock.nodes.new("GeometryNodeTransform") transform_geometry_003.name = "Transform Geometry.003" @@ -1060,6 +1074,7 @@ def lunarrock_node_group(): # node Reroute.015 reroute_015 = lunarrock.nodes.new("NodeReroute") reroute_015.name = "Reroute.015" + reroute_015.socket_idname = "NodeSocketFloat" # node Separate XYZ separate_xyz = lunarrock.nodes.new("ShaderNodeSeparateXYZ") separate_xyz.name = "Separate XYZ" @@ -1071,21 +1086,27 @@ def lunarrock_node_group(): # node Reroute.017 reroute_017 = lunarrock.nodes.new("NodeReroute") reroute_017.name = "Reroute.017" + reroute_017.socket_idname = "NodeSocketVectorXYZ" # node Reroute.018 reroute_018 = lunarrock.nodes.new("NodeReroute") reroute_018.name = "Reroute.018" + reroute_018.socket_idname = "NodeSocketVectorXYZ" # node Reroute.019 reroute_019 = lunarrock.nodes.new("NodeReroute") reroute_019.name = "Reroute.019" + reroute_019.socket_idname = "NodeSocketVectorXYZ" # node Reroute.020 reroute_020 = lunarrock.nodes.new("NodeReroute") reroute_020.name = "Reroute.020" + reroute_020.socket_idname = "NodeSocketFloat" # node Reroute.021 reroute_021 = lunarrock.nodes.new("NodeReroute") reroute_021.name = "Reroute.021" + reroute_021.socket_idname = "NodeSocketBool" # node Reroute.022 reroute_022 = lunarrock.nodes.new("NodeReroute") reroute_022.name = "Reroute.022" + reroute_022.socket_idname = "NodeSocketFloatDistance" # node Frame.005 frame_005 = lunarrock.nodes.new("NodeFrame") frame_005.name = "Frame.005" diff --git a/model/object/lunar_rock_procgen/material.py b/model/object/lunar_rock_procgen/material.py index 37b6697..d6d5b92 100644 --- a/model/object/lunar_rock_procgen/material.py +++ b/model/object/lunar_rock_procgen/material.py @@ -1,4 +1,5 @@ import bpy +import mathutils mat = bpy.data.materials.new(name="LunarRock") mat.use_nodes = True @@ -12,6 +13,7 @@ def random_x4___mat_node_group(): random_x4___mat.color_tag = "NONE" random_x4___mat.description = "" + random_x4___mat.default_group_node_width = 140 # random_x4___mat interface # Socket 0 @@ -176,6 +178,7 @@ def rockshader_node_group(): rockshader.color_tag = "NONE" rockshader.description = "" + rockshader.default_group_node_width = 140 # rockshader interface # Socket BSDF @@ -606,54 +609,56 @@ def rockshader_node_group(): principled_bsdf.inputs[3].default_value = 1.5 # Alpha principled_bsdf.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf.inputs[8].default_value = ( + principled_bsdf.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf.inputs[9].default_value = 0.05000000074505806 + principled_bsdf.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf.inputs[11].default_value = 0.0 + principled_bsdf.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf.inputs[12].default_value = 0.5 + principled_bsdf.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf.inputs[16].default_value = 0.0 # Tangent - principled_bsdf.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf.inputs[19].default_value = 0.029999999329447746 + principled_bsdf.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf.inputs[20].default_value = 1.5 + principled_bsdf.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf.inputs[23].default_value = 0.0 + principled_bsdf.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf.inputs[24].default_value = 0.5 + principled_bsdf.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf.inputs[29].default_value = 1.3300000429153442 + principled_bsdf.inputs[30].default_value = 1.3300000429153442 # node Math math_1 = rockshader.nodes.new("ShaderNodeMath") @@ -999,6 +1004,7 @@ def lunarrock_node_group(): lunarrock.nodes.remove(node) lunarrock.color_tag = "NONE" lunarrock.description = "" + lunarrock.default_group_node_width = 140 # lunarrock interface diff --git a/model/object/martian_rock_procgen/geometry.py b/model/object/martian_rock_procgen/geometry.py index 57705f2..fb37e54 100644 --- a/model/object/martian_rock_procgen/geometry.py +++ b/model/object/martian_rock_procgen/geometry.py @@ -1,4 +1,5 @@ import bpy +import mathutils # initialize random__normal_ node group @@ -9,6 +10,7 @@ def random__normal__node_group(): random__normal_.color_tag = "NONE" random__normal_.description = "" + random__normal_.default_group_node_width = 140 # random__normal_ interface # Socket Value @@ -285,6 +287,7 @@ def random__uniform__node_group(): random__uniform_.color_tag = "NONE" random__uniform_.description = "" + random__uniform_.default_group_node_width = 140 # random__uniform_ interface # Socket Value @@ -381,6 +384,7 @@ def martianrock_node_group(): martianrock.color_tag = "GEOMETRY" martianrock.description = "" + martianrock.default_group_node_width = 140 martianrock.is_modifier = True @@ -599,6 +603,7 @@ def martianrock_node_group(): # node Reroute.001 reroute_001 = martianrock.nodes.new("NodeReroute") reroute_001.name = "Reroute.001" + reroute_001.socket_idname = "NodeSocketFloat" # node Transform Geometry transform_geometry = martianrock.nodes.new("GeometryNodeTransform") transform_geometry.name = "Transform Geometry" @@ -611,6 +616,7 @@ def martianrock_node_group(): # node Reroute.002 reroute_002 = martianrock.nodes.new("NodeReroute") reroute_002.name = "Reroute.002" + reroute_002.socket_idname = "NodeSocketInt" # node Attribute Statistic attribute_statistic = martianrock.nodes.new("GeometryNodeAttributeStatistic") attribute_statistic.name = "Attribute Statistic" @@ -632,6 +638,7 @@ def martianrock_node_group(): # node Reroute.003 reroute_003 = martianrock.nodes.new("NodeReroute") reroute_003.name = "Reroute.003" + reroute_003.socket_idname = "NodeSocketGeometry" # node Vector Math.002 vector_math_002 = martianrock.nodes.new("ShaderNodeVectorMath") vector_math_002.name = "Vector Math.002" @@ -745,6 +752,7 @@ def martianrock_node_group(): # node Reroute.005 reroute_005 = martianrock.nodes.new("NodeReroute") reroute_005.name = "Reroute.005" + reroute_005.socket_idname = "NodeSocketFloat" # node Group.003 group_003 = martianrock.nodes.new("GeometryNodeGroup") group_003.name = "Group.003" @@ -774,9 +782,11 @@ def martianrock_node_group(): # node Reroute.006 reroute_006 = martianrock.nodes.new("NodeReroute") reroute_006.name = "Reroute.006" + reroute_006.socket_idname = "NodeSocketFloat" # node Reroute reroute = martianrock.nodes.new("NodeReroute") reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketVectorXYZ" # node Group.007 group_007 = martianrock.nodes.new("GeometryNodeGroup") group_007.name = "Group.007" @@ -979,6 +989,7 @@ def martianrock_node_group(): # node Reroute.010 reroute_010 = martianrock.nodes.new("NodeReroute") reroute_010.name = "Reroute.010" + reroute_010.socket_idname = "NodeSocketBool" # node Cube.001 cube_001 = martianrock.nodes.new("GeometryNodeMeshCube") cube_001.name = "Cube.001" @@ -1002,6 +1013,7 @@ def martianrock_node_group(): # node Reroute.004 reroute_004 = martianrock.nodes.new("NodeReroute") reroute_004.name = "Reroute.004" + reroute_004.socket_idname = "NodeSocketGeometry" # node Frame.004 frame_004 = martianrock.nodes.new("NodeFrame") frame_004.name = "Frame.004" @@ -1011,9 +1023,11 @@ def martianrock_node_group(): # node Reroute.012 reroute_012 = martianrock.nodes.new("NodeReroute") reroute_012.name = "Reroute.012" + reroute_012.socket_idname = "NodeSocketFloatDistance" # node Reroute.013 reroute_013 = martianrock.nodes.new("NodeReroute") reroute_013.name = "Reroute.013" + reroute_013.socket_idname = "NodeSocketFloatDistance" # node Transform Geometry.003 transform_geometry_003 = martianrock.nodes.new("GeometryNodeTransform") transform_geometry_003.name = "Transform Geometry.003" @@ -1060,6 +1074,7 @@ def martianrock_node_group(): # node Reroute.015 reroute_015 = martianrock.nodes.new("NodeReroute") reroute_015.name = "Reroute.015" + reroute_015.socket_idname = "NodeSocketFloat" # node Separate XYZ separate_xyz = martianrock.nodes.new("ShaderNodeSeparateXYZ") separate_xyz.name = "Separate XYZ" @@ -1071,21 +1086,27 @@ def martianrock_node_group(): # node Reroute.017 reroute_017 = martianrock.nodes.new("NodeReroute") reroute_017.name = "Reroute.017" + reroute_017.socket_idname = "NodeSocketVectorXYZ" # node Reroute.018 reroute_018 = martianrock.nodes.new("NodeReroute") reroute_018.name = "Reroute.018" + reroute_018.socket_idname = "NodeSocketVectorXYZ" # node Reroute.019 reroute_019 = martianrock.nodes.new("NodeReroute") reroute_019.name = "Reroute.019" + reroute_019.socket_idname = "NodeSocketVectorXYZ" # node Reroute.020 reroute_020 = martianrock.nodes.new("NodeReroute") reroute_020.name = "Reroute.020" + reroute_020.socket_idname = "NodeSocketFloat" # node Reroute.021 reroute_021 = martianrock.nodes.new("NodeReroute") reroute_021.name = "Reroute.021" + reroute_021.socket_idname = "NodeSocketBool" # node Reroute.022 reroute_022 = martianrock.nodes.new("NodeReroute") reroute_022.name = "Reroute.022" + reroute_022.socket_idname = "NodeSocketFloatDistance" # node Frame.005 frame_005 = martianrock.nodes.new("NodeFrame") frame_005.name = "Frame.005" diff --git a/model/object/martian_rock_procgen/material.py b/model/object/martian_rock_procgen/material.py index cc7772f..4654302 100644 --- a/model/object/martian_rock_procgen/material.py +++ b/model/object/martian_rock_procgen/material.py @@ -1,4 +1,5 @@ import bpy +import mathutils mat = bpy.data.materials.new(name="MartianRock") mat.use_nodes = True @@ -12,6 +13,7 @@ def random_x2___mat_node_group(): random_x2___mat.color_tag = "NONE" random_x2___mat.description = "" + random_x2___mat.default_group_node_width = 140 # random_x2___mat interface # Socket 0 @@ -123,6 +125,7 @@ def rockshader___3_node_group(): rockshader___3.color_tag = "NONE" rockshader___3.description = "" + rockshader___3.default_group_node_width = 140 # rockshader___3 interface # Socket Shader @@ -391,56 +394,58 @@ def rockshader___3_node_group(): principled_bsdf.inputs[3].default_value = 1.4500000476837158 # Alpha principled_bsdf.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf.inputs[8].default_value = ( + principled_bsdf.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf.inputs[9].default_value = 0.05000000074505806 + principled_bsdf.inputs[10].default_value = 0.05000000074505806 # Subsurface IOR - principled_bsdf.inputs[10].default_value = 1.399999976158142 + principled_bsdf.inputs[11].default_value = 1.399999976158142 # Subsurface Anisotropy - principled_bsdf.inputs[11].default_value = 0.0 + principled_bsdf.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf.inputs[12].default_value = 0.5 + principled_bsdf.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf.inputs[16].default_value = 0.0 # Tangent - principled_bsdf.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf.inputs[19].default_value = 0.029999999329447746 + principled_bsdf.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf.inputs[20].default_value = 1.5 + principled_bsdf.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf.inputs[23].default_value = 0.0 + principled_bsdf.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf.inputs[24].default_value = 0.5 + principled_bsdf.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Color - principled_bsdf.inputs[26].default_value = (0.0, 0.0, 0.0, 1.0) + principled_bsdf.inputs[27].default_value = (0.0, 0.0, 0.0, 1.0) # Emission Strength - principled_bsdf.inputs[27].default_value = 1.0 + principled_bsdf.inputs[28].default_value = 1.0 # Thin Film Thickness - principled_bsdf.inputs[28].default_value = 0.0 + principled_bsdf.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf.inputs[29].default_value = 1.3300000429153442 + principled_bsdf.inputs[30].default_value = 1.3300000429153442 # node Mapping mapping = rockshader___3.nodes.new("ShaderNodeMapping") @@ -740,6 +745,7 @@ def rockshader___4_node_group(): rockshader___4.color_tag = "NONE" rockshader___4.description = "" + rockshader___4.default_group_node_width = 140 # rockshader___4 interface # Socket Shader @@ -958,56 +964,58 @@ def rockshader___4_node_group(): principled_bsdf_1.inputs[3].default_value = 1.4500000476837158 # Alpha principled_bsdf_1.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_1.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_1.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_1.inputs[8].default_value = ( + principled_bsdf_1.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_1.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_1.inputs[10].default_value = 0.05000000074505806 # Subsurface IOR - principled_bsdf_1.inputs[10].default_value = 1.399999976158142 + principled_bsdf_1.inputs[11].default_value = 1.399999976158142 # Subsurface Anisotropy - principled_bsdf_1.inputs[11].default_value = 0.0 + principled_bsdf_1.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_1.inputs[12].default_value = 0.5 + principled_bsdf_1.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_1.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_1.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_1.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_1.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_1.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_1.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_1.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_1.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_1.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_1.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_1.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_1.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_1.inputs[20].default_value = 1.5 + principled_bsdf_1.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_1.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_1.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_1.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_1.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_1.inputs[23].default_value = 0.0 + principled_bsdf_1.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_1.inputs[24].default_value = 0.5 + principled_bsdf_1.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_1.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_1.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Color - principled_bsdf_1.inputs[26].default_value = (0.0, 0.0, 0.0, 1.0) + principled_bsdf_1.inputs[27].default_value = (0.0, 0.0, 0.0, 1.0) # Emission Strength - principled_bsdf_1.inputs[27].default_value = 1.0 + principled_bsdf_1.inputs[28].default_value = 1.0 # Thin Film Thickness - principled_bsdf_1.inputs[28].default_value = 0.0 + principled_bsdf_1.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_1.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_1.inputs[30].default_value = 1.3300000429153442 # node RGB Curves rgb_curves = rockshader___4.nodes.new("ShaderNodeRGBCurve") @@ -1425,6 +1433,7 @@ def random_x4___mat_node_group(): random_x4___mat.color_tag = "NONE" random_x4___mat.description = "" + random_x4___mat.default_group_node_width = 140 # random_x4___mat interface # Socket 0 @@ -1593,6 +1602,7 @@ def rockshader_node_group(): rockshader.color_tag = "NONE" rockshader.description = "" + rockshader.default_group_node_width = 140 # rockshader interface # Socket BSDF @@ -2023,54 +2033,56 @@ def rockshader_node_group(): principled_bsdf_2.inputs[3].default_value = 1.5 # Alpha principled_bsdf_2.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_2.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_2.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_2.inputs[8].default_value = ( + principled_bsdf_2.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_2.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_2.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf_2.inputs[11].default_value = 0.0 + principled_bsdf_2.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_2.inputs[12].default_value = 0.5 + principled_bsdf_2.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_2.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_2.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_2.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_2.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_2.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_2.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_2.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_2.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_2.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_2.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_2.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_2.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_2.inputs[20].default_value = 1.5 + principled_bsdf_2.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_2.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_2.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_2.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_2.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_2.inputs[23].default_value = 0.0 + principled_bsdf_2.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_2.inputs[24].default_value = 0.5 + principled_bsdf_2.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_2.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf_2.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf_2.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf_2.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf_2.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf_2.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_2.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_2.inputs[30].default_value = 1.3300000429153442 # node Math math_2 = rockshader.nodes.new("ShaderNodeMath") @@ -2416,6 +2428,7 @@ def martianrockshader_node_group(): martianrockshader.color_tag = "NONE" martianrockshader.description = "" + martianrockshader.default_group_node_width = 140 # martianrockshader interface # Socket Shader @@ -2880,6 +2893,7 @@ def martianrock_node_group(): martianrock.nodes.remove(node) martianrock.color_tag = "NONE" martianrock.description = "" + martianrock.default_group_node_width = 140 # martianrock interface diff --git a/model/object/peg_in_hole_procgen/geometry_blank_module.py b/model/object/peg_in_hole_procgen/geometry_blank_module.py index a48c631..5c6f2ac 100644 --- a/model/object/peg_in_hole_procgen/geometry_blank_module.py +++ b/model/object/peg_in_hole_procgen/geometry_blank_module.py @@ -1,4 +1,5 @@ import bpy +import mathutils # initialize blankmodule node group @@ -7,6 +8,7 @@ def blankmodule_node_group(): blankmodule.color_tag = "NONE" blankmodule.description = "" + blankmodule.default_group_node_width = 140 blankmodule.is_modifier = True diff --git a/model/object/peg_in_hole_procgen/geometry_peg_and_hole.py b/model/object/peg_in_hole_procgen/geometry_peg_and_hole.py index caedb5a..b81de09 100644 --- a/model/object/peg_in_hole_procgen/geometry_peg_and_hole.py +++ b/model/object/peg_in_hole_procgen/geometry_peg_and_hole.py @@ -1,4 +1,5 @@ import bpy +import mathutils # initialize _get_parallel_vectors node group @@ -9,6 +10,7 @@ def _get_parallel_vectors_node_group(): _get_parallel_vectors.color_tag = "NONE" _get_parallel_vectors.description = "" + _get_parallel_vectors.default_group_node_width = 140 # _get_parallel_vectors interface # Socket output_x @@ -145,6 +147,7 @@ def _decimate_planar_node_group(): _decimate_planar.color_tag = "NONE" _decimate_planar.description = "" + _decimate_planar.default_group_node_width = 140 _decimate_planar.is_modifier = True @@ -241,9 +244,11 @@ def _decimate_planar_node_group(): # node Reroute reroute = _decimate_planar.nodes.new("NodeReroute") reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketGeometry" # node Reroute.001 reroute_001 = _decimate_planar.nodes.new("NodeReroute") reroute_001.name = "Reroute.001" + reroute_001.socket_idname = "NodeSocketGeometry" # node Compare compare = _decimate_planar.nodes.new("FunctionNodeCompare") compare.name = "Compare" @@ -285,6 +290,7 @@ def _decimate_planar_node_group(): # node Reroute.002 reroute_002 = _decimate_planar.nodes.new("NodeReroute") reroute_002.name = "Reroute.002" + reroute_002.socket_idname = "NodeSocketGeometry" # node Mesh Line mesh_line = _decimate_planar.nodes.new("GeometryNodeMeshLine") mesh_line.name = "Mesh Line" @@ -394,12 +400,15 @@ def _decimate_planar_node_group(): # node Reroute.003 reroute_003 = _decimate_planar.nodes.new("NodeReroute") reroute_003.name = "Reroute.003" + reroute_003.socket_idname = "NodeSocketGeometry" # node Reroute.004 reroute_004 = _decimate_planar.nodes.new("NodeReroute") reroute_004.name = "Reroute.004" + reroute_004.socket_idname = "NodeSocketGeometry" # node Reroute.005 reroute_005 = _decimate_planar.nodes.new("NodeReroute") reroute_005.name = "Reroute.005" + reroute_005.socket_idname = "NodeSocketGeometry" # node Evaluate at Index evaluate_at_index = _decimate_planar.nodes.new("GeometryNodeFieldAtIndex") evaluate_at_index.name = "Evaluate at Index" @@ -448,6 +457,7 @@ def _decimate_planar_node_group(): # node Reroute.006 reroute_006 = _decimate_planar.nodes.new("NodeReroute") reroute_006.name = "Reroute.006" + reroute_006.socket_idname = "NodeSocketGeometry" # node Spline Parameter spline_parameter = _decimate_planar.nodes.new("GeometryNodeSplineParameter") spline_parameter.name = "Spline Parameter" @@ -518,6 +528,7 @@ def _decimate_planar_node_group(): # node Reroute.007 reroute_007 = _decimate_planar.nodes.new("NodeReroute") reroute_007.name = "Reroute.007" + reroute_007.socket_idname = "NodeSocketGeometry" # node Math.004 math_004 = _decimate_planar.nodes.new("ShaderNodeMath") math_004.name = "Math.004" @@ -940,6 +951,7 @@ def peg_node_group(): peg.color_tag = "NONE" peg.description = "" + peg.default_group_node_width = 140 peg.is_modifier = True @@ -1074,7 +1086,7 @@ def peg_node_group(): taper_factor_max_socket = peg.interface.new_socket( name="taper_factor_max", in_out="INPUT", socket_type="NodeSocketFloat" ) - taper_factor_max_socket.default_value = 0.25 + taper_factor_max_socket.default_value = 0.0 taper_factor_max_socket.min_value = 0.0 taper_factor_max_socket.max_value = 0.9990000128746033 taper_factor_max_socket.subtype = "FACTOR" @@ -1255,6 +1267,7 @@ def peg_node_group(): reroute_1 = peg.nodes.new("NodeReroute") reroute_1.label = "is_circle" reroute_1.name = "Reroute" + reroute_1.socket_idname = "NodeSocketBool" # node Math math_2 = peg.nodes.new("ShaderNodeMath") math_2.name = "Math" @@ -1543,23 +1556,29 @@ def peg_node_group(): reroute_001_1 = peg.nodes.new("NodeReroute") reroute_001_1.label = "Radius" reroute_001_1.name = "Reroute.001" + reroute_001_1.socket_idname = "NodeSocketFloat" # node Reroute.002 reroute_002_1 = peg.nodes.new("NodeReroute") reroute_002_1.name = "Reroute.002" + reroute_002_1.socket_idname = "NodeSocketInt" # node Reroute.003 reroute_003_1 = peg.nodes.new("NodeReroute") reroute_003_1.label = "Vertices" reroute_003_1.name = "Reroute.003" + reroute_003_1.socket_idname = "NodeSocketInt" # node Reroute.004 reroute_004_1 = peg.nodes.new("NodeReroute") reroute_004_1.label = "Height" reroute_004_1.name = "Reroute.004" + reroute_004_1.socket_idname = "NodeSocketFloat" # node Reroute.005 reroute_005_1 = peg.nodes.new("NodeReroute") reroute_005_1.name = "Reroute.005" + reroute_005_1.socket_idname = "NodeSocketFloat" # node Reroute.006 reroute_006_1 = peg.nodes.new("NodeReroute") reroute_006_1.name = "Reroute.006" + reroute_006_1.socket_idname = "NodeSocketFloat" # node Math.003 math_003_1 = peg.nodes.new("ShaderNodeMath") math_003_1.name = "Math.003" @@ -1634,10 +1653,19 @@ def peg_node_group(): reroute_007_1 = peg.nodes.new("NodeReroute") reroute_007_1.label = "Circumference" reroute_007_1.name = "Reroute.007" + reroute_007_1.socket_idname = "NodeSocketFloat" # node Reroute.008 reroute_008 = peg.nodes.new("NodeReroute") reroute_008.label = "Vertex per meter" reroute_008.name = "Reroute.008" + reroute_008.socket_idname = "NodeSocketFloat" + # node Set Material + set_material = peg.nodes.new("GeometryNodeSetMaterial") + set_material.name = "Set Material" + # Selection + set_material.inputs[1].default_value = True + if "Metal" in bpy.data.materials: + set_material.inputs[2].default_value = bpy.data.materials["Metal"] # Set parents switch.parent = frame_1 @@ -1716,7 +1744,7 @@ def peg_node_group(): group_input_006.location = (-891.415771484375, -528.1066284179688) random_value_003.location = (-645.774658203125, -292.082275390625) group_input_007.location = (-891.415771484375, -39.57568359375) - group_output_2.location = (1099.36865234375, 331.6226806640625) + group_output_2.location = (1192.8258056640625, 334.2099914550781) set_shade_smooth.location = (41.69342041015625, 308.8958740234375) integer_003.location = (-891.415771484375, -433.10662841796875) transform_geometry.location = (-1027.566650390625, -12.72100830078125) @@ -1752,6 +1780,7 @@ def peg_node_group(): math_008.location = (-1586.1864013671875, 121.13839721679688) reroute_007_1.location = (-1719.8779296875, 7.324859619140625) reroute_008.location = (-1394.48095703125, 87.21310424804688) + set_material.location = (1014.396484375, 335.28179931640625) # Set dimensions frame_1.width, frame_1.height = 686.0, 584.0 @@ -1817,6 +1846,7 @@ def peg_node_group(): math_008.width, math_008.height = 140.0, 100.0 reroute_007_1.width, reroute_007_1.height = 16.0, 100.0 reroute_008.width, reroute_008.height = 16.0, 100.0 + set_material.width, set_material.height = 140.0, 100.0 # initialize peg links # group_input_003.random_seed -> random_value_001.Seed @@ -1883,8 +1913,8 @@ def peg_node_group(): peg.links.new(reroute_002_1.outputs[0], cone.inputs[0]) # reroute_006_1.Output -> math_002_1.Value peg.links.new(reroute_006_1.outputs[0], math_002_1.inputs[0]) - # scale_elements.Geometry -> group_output_2.Geometry - peg.links.new(scale_elements.outputs[0], group_output_2.inputs[0]) + # set_material.Geometry -> group_output_2.Geometry + peg.links.new(set_material.outputs[0], group_output_2.inputs[0]) # integer_002.Integer -> random_value_002.ID peg.links.new(integer_002.outputs[0], random_value_002.inputs[7]) # group_input_005.random_seed -> random_value_002.Seed @@ -1959,6 +1989,8 @@ def peg_node_group(): peg.links.new(reroute_004_1.outputs[0], reroute_005_1.inputs[0]) # math_008.Value -> reroute_008.Input peg.links.new(math_008.outputs[0], reroute_008.inputs[0]) + # scale_elements.Geometry -> set_material.Geometry + peg.links.new(scale_elements.outputs[0], set_material.inputs[0]) return peg @@ -1971,6 +2003,7 @@ def hole_node_group(): hole.color_tag = "NONE" hole.description = "" + hole.default_group_node_width = 140 hole.is_modifier = True @@ -2304,28 +2337,35 @@ def hole_node_group(): reroute_2 = hole.nodes.new("NodeReroute") reroute_2.label = "peg_pull_direction" reroute_2.name = "Reroute" + reroute_2.socket_idname = "NodeSocketVector" # node Reroute.001 reroute_001_2 = hole.nodes.new("NodeReroute") reroute_001_2.label = "hole_position" reroute_001_2.name = "Reroute.001" + reroute_001_2.socket_idname = "NodeSocketVector" # node Reroute.002 reroute_002_2 = hole.nodes.new("NodeReroute") reroute_002_2.name = "Reroute.002" + reroute_002_2.socket_idname = "NodeSocketVector" # node Reroute.003 reroute_003_2 = hole.nodes.new("NodeReroute") reroute_003_2.label = "hole_position" reroute_003_2.name = "Reroute.003" + reroute_003_2.socket_idname = "NodeSocketVector" # node Reroute.006 reroute_006_2 = hole.nodes.new("NodeReroute") reroute_006_2.name = "Reroute.006" + reroute_006_2.socket_idname = "NodeSocketVector" # node Reroute.007 reroute_007_2 = hole.nodes.new("NodeReroute") reroute_007_2.label = "peg_insert_direction" reroute_007_2.name = "Reroute.007" + reroute_007_2.socket_idname = "NodeSocketVector" # node Reroute.008 reroute_008_1 = hole.nodes.new("NodeReroute") reroute_008_1.label = "peg_pull_direction" reroute_008_1.name = "Reroute.008" + reroute_008_1.socket_idname = "NodeSocketVector" # node Group Input.001 group_input_001_1 = hole.nodes.new("NodeGroupInput") group_input_001_1.name = "Group Input.001" @@ -2399,6 +2439,7 @@ def hole_node_group(): # node Reroute.009 reroute_009 = hole.nodes.new("NodeReroute") reroute_009.name = "Reroute.009" + reroute_009.socket_idname = "NodeSocketVector" # node Separate XYZ separate_xyz_1 = hole.nodes.new("ShaderNodeSeparateXYZ") separate_xyz_1.name = "Separate XYZ" @@ -2425,6 +2466,7 @@ def hole_node_group(): reroute_010 = hole.nodes.new("NodeReroute") reroute_010.label = "peg_height" reroute_010.name = "Reroute.010" + reroute_010.socket_idname = "NodeSocketFloat" # node Transform Geometry transform_geometry_1 = hole.nodes.new("GeometryNodeTransform") transform_geometry_1.name = "Transform Geometry" @@ -2487,6 +2529,7 @@ def hole_node_group(): # node Reroute.011 reroute_011 = hole.nodes.new("NodeReroute") reroute_011.name = "Reroute.011" + reroute_011.socket_idname = "NodeSocketGeometry" # node Math math_3 = hole.nodes.new("ShaderNodeMath") math_3.name = "Math" @@ -2520,6 +2563,7 @@ def hole_node_group(): # node Reroute.012 reroute_012 = hole.nodes.new("NodeReroute") reroute_012.name = "Reroute.012" + reroute_012.socket_idname = "NodeSocketGeometry" # node Vector Math.003 vector_math_003 = hole.nodes.new("ShaderNodeVectorMath") vector_math_003.name = "Vector Math.003" @@ -2538,6 +2582,7 @@ def hole_node_group(): # node Reroute.013 reroute_013 = hole.nodes.new("NodeReroute") reroute_013.name = "Reroute.013" + reroute_013.socket_idname = "NodeSocketVector" # node Normal.001 normal_001_1 = hole.nodes.new("GeometryNodeInputNormal") normal_001_1.name = "Normal.001" @@ -2609,6 +2654,7 @@ def hole_node_group(): # node Reroute.014 reroute_014 = hole.nodes.new("NodeReroute") reroute_014.name = "Reroute.014" + reroute_014.socket_idname = "NodeSocketVectorEuler" # node Group Input.005 group_input_005_1 = hole.nodes.new("NodeGroupInput") group_input_005_1.name = "Group Input.005" @@ -2823,6 +2869,7 @@ def hole_node_group(): # node Reroute.015 reroute_015 = hole.nodes.new("NodeReroute") reroute_015.name = "Reroute.015" + reroute_015.socket_idname = "NodeSocketVector" # node Group Input.011 group_input_011_1 = hole.nodes.new("NodeGroupInput") group_input_011_1.name = "Group Input.011" @@ -2954,6 +3001,7 @@ def hole_node_group(): # node Reroute.016 reroute_016 = hole.nodes.new("NodeReroute") reroute_016.name = "Reroute.016" + reroute_016.socket_idname = "NodeSocketGeometry" # node Vector Math.014 vector_math_014 = hole.nodes.new("ShaderNodeVectorMath") vector_math_014.name = "Vector Math.014" @@ -2982,6 +3030,7 @@ def hole_node_group(): # node Reroute.017 reroute_017 = hole.nodes.new("NodeReroute") reroute_017.name = "Reroute.017" + reroute_017.socket_idname = "NodeSocketVector" # node Capture Attribute.003 capture_attribute_003 = hole.nodes.new("GeometryNodeCaptureAttribute") capture_attribute_003.name = "Capture Attribute.003" @@ -3225,6 +3274,7 @@ def hole_node_group(): # node Reroute.018 reroute_018 = hole.nodes.new("NodeReroute") reroute_018.name = "Reroute.018" + reroute_018.socket_idname = "NodeSocketVector" # node Attribute Statistic.001 attribute_statistic_001 = hole.nodes.new("GeometryNodeAttributeStatistic") attribute_statistic_001.name = "Attribute Statistic.001" @@ -3289,6 +3339,7 @@ def hole_node_group(): # node Reroute.019 reroute_019 = hole.nodes.new("NodeReroute") reroute_019.name = "Reroute.019" + reroute_019.socket_idname = "NodeSocketVector" # node Group Input.020 group_input_020 = hole.nodes.new("NodeGroupInput") group_input_020.name = "Group Input.020" @@ -3358,6 +3409,7 @@ def hole_node_group(): reroute_020 = hole.nodes.new("NodeReroute") reroute_020.label = "peg_insert_direction" reroute_020.name = "Reroute.020" + reroute_020.socket_idname = "NodeSocketVector" # node Vector Math.020 vector_math_020 = hole.nodes.new("ShaderNodeVectorMath") vector_math_020.name = "Vector Math.020" @@ -3400,6 +3452,7 @@ def hole_node_group(): # node Reroute.021 reroute_021 = hole.nodes.new("NodeReroute") reroute_021.name = "Reroute.021" + reroute_021.socket_idname = "NodeSocketVector" # node Vector Math.021 vector_math_021 = hole.nodes.new("ShaderNodeVectorMath") vector_math_021.name = "Vector Math.021" @@ -3411,13 +3464,16 @@ def hole_node_group(): reroute_022 = hole.nodes.new("NodeReroute") reroute_022.label = "hole_position" reroute_022.name = "Reroute.022" + reroute_022.socket_idname = "NodeSocketVector" # node Reroute.023 reroute_023 = hole.nodes.new("NodeReroute") reroute_023.label = "peg_pull_direction" reroute_023.name = "Reroute.023" + reroute_023.socket_idname = "NodeSocketVector" # node Reroute.024 reroute_024 = hole.nodes.new("NodeReroute") reroute_024.name = "Reroute.024" + reroute_024.socket_idname = "NodeSocketVector" # node Vector Math.002 vector_math_002 = hole.nodes.new("ShaderNodeVectorMath") vector_math_002.name = "Vector Math.002" @@ -3427,13 +3483,16 @@ def hole_node_group(): reroute_005_2 = hole.nodes.new("NodeReroute") reroute_005_2.label = "peg_insert_direction" reroute_005_2.name = "Reroute.005" + reroute_005_2.socket_idname = "NodeSocketVector" # node Reroute.026 reroute_026 = hole.nodes.new("NodeReroute") reroute_026.name = "Reroute.026" + reroute_026.socket_idname = "NodeSocketVector" # node Reroute.004 reroute_004_2 = hole.nodes.new("NodeReroute") reroute_004_2.label = "peg_with_tolerance" reroute_004_2.name = "Reroute.004" + reroute_004_2.socket_idname = "NodeSocketGeometry" # node Switch switch_1 = hole.nodes.new("GeometryNodeSwitch") switch_1.name = "Switch" @@ -3472,10 +3531,12 @@ def hole_node_group(): # node Reroute.025 reroute_025 = hole.nodes.new("NodeReroute") reroute_025.name = "Reroute.025" + reroute_025.socket_idname = "NodeSocketVector" # node Reroute.028 reroute_028 = hole.nodes.new("NodeReroute") reroute_028.name = "Reroute.028" reroute_028.hide = True + reroute_028.socket_idname = "NodeSocketVector" # node Group Output group_output_3 = hole.nodes.new("NodeGroupOutput") group_output_3.name = "Group Output" @@ -3600,7 +3661,7 @@ def hole_node_group(): # Socket_12 group_002.inputs[11].default_value = 0.0 # Socket_13 - group_002.inputs[12].default_value = 0.25 + group_002.inputs[12].default_value = 0.0 # Socket_14 group_002.inputs[13].default_value = False @@ -3615,6 +3676,14 @@ def hole_node_group(): # Scale vector_math_024.inputs[3].default_value = -1.0 + # node Set Material + set_material_1 = hole.nodes.new("GeometryNodeSetMaterial") + set_material_1.name = "Set Material" + # Selection + set_material_1.inputs[1].default_value = True + if "Metal" in bpy.data.materials: + set_material_1.inputs[2].default_value = bpy.data.materials["Metal"] + # Set parents frame_003_2.parent = frame_002_2 frame_004_2.parent = frame_002_2 @@ -3919,7 +3988,7 @@ def hole_node_group(): mesh_boolean_002.location = (-87.98570251464844, -316.8748779296875) reroute_025.location = (37.5357666015625, 1073.1732177734375) reroute_028.location = (-512.5114135742188, -1055.477294921875) - group_output_3.location = (1768.8592529296875, -87.35870361328125) + group_output_3.location = (2515.40380859375, -74.08328247070312) raycast_001.location = (864.0977172851562, 492.8777770996094) align_euler_to_vector_001.location = (1092.785400390625, 194.20965576171875) vector_math_022.location = (795.4451904296875, -892.4864501953125) @@ -3934,6 +4003,7 @@ def hole_node_group(): group_002.location = (-6626.4619140625, -9.70977783203125) group_input_024.location = (-6835.1376953125, -3.41729736328125) vector_math_024.location = (-885.42578125, 103.37994384765625) + set_material_1.location = (1701.5062255859375, -60.55561447143555) # Set dimensions frame_001_2.width, frame_001_2.height = 8388.0, 833.0 @@ -4106,6 +4176,7 @@ def hole_node_group(): group_002.width, group_002.height = 140.0, 100.0 group_input_024.width, group_input_024.height = 140.0, 100.0 vector_math_024.width, vector_math_024.height = 140.0, 100.0 + set_material_1.width, set_material_1.height = 140.0, 100.0 # initialize hole links # group_input_001_1.peg -> object_info.Object @@ -4158,7 +4229,7 @@ def hole_node_group(): hole.links.new(normal_005.outputs[0], capture_attribute_004.inputs[1]) # group_input_015.wall_include_bottom -> switch_002_1.Switch hole.links.new(group_input_015.outputs[16], switch_002_1.inputs[0]) - # mesh_boolean.Mesh -> mesh_boolean_001.Mesh 2 + # mesh_boolean.Mesh -> mesh_boolean_001.Mesh hole.links.new(mesh_boolean.outputs[0], mesh_boolean_001.inputs[1]) # switch_002_1.Output -> mesh_boolean.Mesh 1 hole.links.new(switch_002_1.outputs[0], mesh_boolean.inputs[0]) @@ -4462,8 +4533,8 @@ def hole_node_group(): hole.links.new(vector_math_002.outputs[0], reroute_024.inputs[0]) # reroute_024.Output -> reroute_025.Input hole.links.new(reroute_024.outputs[0], reroute_025.inputs[0]) - # mesh_boolean_002.Mesh -> group_output_3.Geometry - hole.links.new(mesh_boolean_002.outputs[0], group_output_3.inputs[0]) + # set_material_1.Geometry -> group_output_3.Geometry + hole.links.new(set_material_1.outputs[0], group_output_3.inputs[0]) # reroute_022.Output -> vector_math_022.Vector hole.links.new(reroute_022.outputs[0], vector_math_022.inputs[0]) # reroute_023.Output -> reroute_026.Input @@ -4524,7 +4595,9 @@ def hole_node_group(): hole.links.new(reroute_004_2.outputs[0], mesh_boolean_002.inputs[1]) # vector_math_019.Vector -> vector_math_024.Vector hole.links.new(vector_math_019.outputs[0], vector_math_024.inputs[0]) - # group_input_017.Geometry -> mesh_boolean_001.Mesh 2 + # mesh_boolean_002.Mesh -> set_material_1.Geometry + hole.links.new(mesh_boolean_002.outputs[0], set_material_1.inputs[0]) + # group_input_017.Geometry -> mesh_boolean_001.Mesh hole.links.new(group_input_017.outputs[0], mesh_boolean_001.inputs[1]) return hole diff --git a/model/object/peg_in_hole_procgen/material.py b/model/object/peg_in_hole_procgen/material.py index 9382ca6..910746d 100644 --- a/model/object/peg_in_hole_procgen/material.py +++ b/model/object/peg_in_hole_procgen/material.py @@ -1,4 +1,5 @@ import bpy +import mathutils mat = bpy.data.materials.new(name="Metal") mat.use_nodes = True @@ -12,6 +13,7 @@ def random_x4___mat_node_group(): random_x4___mat.color_tag = "NONE" random_x4___mat.description = "" + random_x4___mat.default_group_node_width = 140 # random_x4___mat interface # Socket 0 @@ -187,6 +189,7 @@ def metalshader_node_group(): metalshader.color_tag = "NONE" metalshader.description = "" + metalshader.default_group_node_width = 140 # metalshader interface # Socket BSDF @@ -232,54 +235,56 @@ def metalshader_node_group(): principled_bsdf.inputs[3].default_value = 1.5 # Alpha principled_bsdf.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf.inputs[8].default_value = ( + principled_bsdf.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf.inputs[9].default_value = 0.05000000074505806 + principled_bsdf.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf.inputs[11].default_value = 0.0 + principled_bsdf.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf.inputs[12].default_value = 0.5 + principled_bsdf.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf.inputs[16].default_value = 0.0 # Tangent - principled_bsdf.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf.inputs[19].default_value = 0.029999999329447746 + principled_bsdf.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf.inputs[20].default_value = 1.5 + principled_bsdf.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf.inputs[23].default_value = 0.0 + principled_bsdf.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf.inputs[24].default_value = 0.5 + principled_bsdf.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf.inputs[29].default_value = 1.3300000429153442 + principled_bsdf.inputs[30].default_value = 1.3300000429153442 # node Group.001 group_001 = metalshader.nodes.new("ShaderNodeGroup") @@ -571,6 +576,7 @@ def metal_node_group(): metal.nodes.remove(node) metal.color_tag = "NONE" metal.description = "" + metal.default_group_node_width = 140 # metal interface diff --git a/model/object/solar_panel_procgen/geometry.py b/model/object/solar_panel_procgen/geometry.py new file mode 100644 index 0000000..1fa8e74 --- /dev/null +++ b/model/object/solar_panel_procgen/geometry.py @@ -0,0 +1,517 @@ +import bpy +import mathutils + + +# initialize solarpanel node group +def solarpanel_node_group(): + solarpanel = bpy.data.node_groups.new(type="GeometryNodeTree", name="SolarPanel") + + solarpanel.color_tag = "GEOMETRY" + solarpanel.description = "" + solarpanel.default_group_node_width = 140 + + solarpanel.is_modifier = True + + # solarpanel interface + # Socket Geometry + geometry_socket = solarpanel.interface.new_socket( + name="Geometry", in_out="OUTPUT", socket_type="NodeSocketGeometry" + ) + geometry_socket.attribute_domain = "POINT" + + # Socket seed + seed_socket = solarpanel.interface.new_socket( + name="seed", in_out="INPUT", socket_type="NodeSocketInt" + ) + seed_socket.default_value = 0 + seed_socket.min_value = 0 + seed_socket.max_value = 2147483647 + seed_socket.subtype = "NONE" + seed_socket.attribute_domain = "POINT" + seed_socket.hide_value = True + seed_socket.hide_in_modifier = True + seed_socket.force_non_field = True + + # Socket scale + scale_socket = solarpanel.interface.new_socket( + name="scale", in_out="INPUT", socket_type="NodeSocketVector" + ) + scale_socket.default_value = (1.0, 1.0, 0.05000000074505806) + scale_socket.min_value = 0.0 + scale_socket.max_value = 3.4028234663852886e38 + scale_socket.subtype = "TRANSLATION" + scale_socket.attribute_domain = "POINT" + scale_socket.force_non_field = True + + # Socket border_size + border_size_socket = solarpanel.interface.new_socket( + name="border_size", in_out="INPUT", socket_type="NodeSocketFloat" + ) + border_size_socket.default_value = 0.009999999776482582 + border_size_socket.min_value = 0.0 + border_size_socket.max_value = 3.4028234663852886e38 + border_size_socket.subtype = "DISTANCE" + border_size_socket.attribute_domain = "POINT" + border_size_socket.force_non_field = True + + # Socket panel_depth + panel_depth_socket = solarpanel.interface.new_socket( + name="panel_depth", in_out="INPUT", socket_type="NodeSocketFloat" + ) + panel_depth_socket.default_value = 0.0020000000949949026 + panel_depth_socket.min_value = 0.0 + panel_depth_socket.max_value = 3.4028234663852886e38 + panel_depth_socket.subtype = "DISTANCE" + panel_depth_socket.attribute_domain = "POINT" + panel_depth_socket.force_non_field = True + + # Socket with_back_panel + with_back_panel_socket = solarpanel.interface.new_socket( + name="with_back_panel", in_out="INPUT", socket_type="NodeSocketBool" + ) + with_back_panel_socket.default_value = False + with_back_panel_socket.attribute_domain = "POINT" + + # Socket frame_mat + frame_mat_socket = solarpanel.interface.new_socket( + name="frame_mat", in_out="INPUT", socket_type="NodeSocketMaterial" + ) + frame_mat_socket.attribute_domain = "POINT" + + # Socket cells_mat + cells_mat_socket = solarpanel.interface.new_socket( + name="cells_mat", in_out="INPUT", socket_type="NodeSocketMaterial" + ) + cells_mat_socket.attribute_domain = "POINT" + + # initialize solarpanel nodes + # node Group Input + group_input = solarpanel.nodes.new("NodeGroupInput") + group_input.name = "Group Input" + + # node Group Output + group_output = solarpanel.nodes.new("NodeGroupOutput") + group_output.name = "Group Output" + group_output.is_active_output = True + + # node Set Material + set_material = solarpanel.nodes.new("GeometryNodeSetMaterial") + set_material.name = "Set Material" + + # node Integer.001 + integer_001 = solarpanel.nodes.new("FunctionNodeInputInt") + integer_001.label = "Global Seed Offset" + integer_001.name = "Integer.001" + integer_001.mute = True + integer_001.integer = 0 + + # node Grid + grid = solarpanel.nodes.new("GeometryNodeMeshGrid") + grid.name = "Grid" + # Vertices X + grid.inputs[2].default_value = 2 + # Vertices Y + grid.inputs[3].default_value = 2 + + # node Extrude Mesh + extrude_mesh = solarpanel.nodes.new("GeometryNodeExtrudeMesh") + extrude_mesh.name = "Extrude Mesh" + extrude_mesh.mode = "FACES" + # Selection + extrude_mesh.inputs[1].default_value = True + # Offset + extrude_mesh.inputs[2].default_value = (0.0, 0.0, 0.0) + # Individual + extrude_mesh.inputs[4].default_value = False + + # node Extrude Mesh.001 + extrude_mesh_001 = solarpanel.nodes.new("GeometryNodeExtrudeMesh") + extrude_mesh_001.name = "Extrude Mesh.001" + extrude_mesh_001.mode = "FACES" + # Offset + extrude_mesh_001.inputs[2].default_value = (0.0, 0.0, 0.0) + # Individual + extrude_mesh_001.inputs[4].default_value = False + + # node Extrude Mesh.002 + extrude_mesh_002 = solarpanel.nodes.new("GeometryNodeExtrudeMesh") + extrude_mesh_002.name = "Extrude Mesh.002" + extrude_mesh_002.mode = "FACES" + # Individual + extrude_mesh_002.inputs[4].default_value = False + + # node Vector + vector = solarpanel.nodes.new("FunctionNodeInputVector") + vector.name = "Vector" + vector.vector = (0.0, 0.0, -1.0) + + # node Set Material.002 + set_material_002 = solarpanel.nodes.new("GeometryNodeSetMaterial") + set_material_002.name = "Set Material.002" + # Selection + set_material_002.inputs[1].default_value = True + + # node Capture Attribute + capture_attribute = solarpanel.nodes.new("GeometryNodeCaptureAttribute") + capture_attribute.name = "Capture Attribute" + capture_attribute.active_index = 0 + capture_attribute.capture_items.clear() + capture_attribute.capture_items.new("FLOAT", "Index") + capture_attribute.capture_items["Index"].data_type = "INT" + capture_attribute.domain = "POINT" + + # node Index + index = solarpanel.nodes.new("GeometryNodeInputIndex") + index.name = "Index" + + # node Delete Geometry + delete_geometry = solarpanel.nodes.new("GeometryNodeDeleteGeometry") + delete_geometry.name = "Delete Geometry" + delete_geometry.domain = "POINT" + delete_geometry.mode = "ALL" + + # node Compare + compare = solarpanel.nodes.new("FunctionNodeCompare") + compare.name = "Compare" + compare.data_type = "INT" + compare.mode = "ELEMENT" + compare.operation = "EQUAL" + + # node Mesh to Curve + mesh_to_curve = solarpanel.nodes.new("GeometryNodeMeshToCurve") + mesh_to_curve.name = "Mesh to Curve" + + # node Position + position = solarpanel.nodes.new("GeometryNodeInputPosition") + position.name = "Position" + + # node Separate XYZ + separate_xyz = solarpanel.nodes.new("ShaderNodeSeparateXYZ") + separate_xyz.name = "Separate XYZ" + separate_xyz.outputs[0].hide = True + separate_xyz.outputs[1].hide = True + + # node Compare.001 + compare_001 = solarpanel.nodes.new("FunctionNodeCompare") + compare_001.name = "Compare.001" + compare_001.data_type = "FLOAT" + compare_001.mode = "ELEMENT" + compare_001.operation = "EQUAL" + # B + compare_001.inputs[1].default_value = 0.0 + # Epsilon + compare_001.inputs[12].default_value = 0.0 + + # node Fill Curve + fill_curve = solarpanel.nodes.new("GeometryNodeFillCurve") + fill_curve.name = "Fill Curve" + fill_curve.mode = "NGONS" + # Group ID + fill_curve.inputs[1].default_value = 0 + + # node Join Geometry + join_geometry = solarpanel.nodes.new("GeometryNodeJoinGeometry") + join_geometry.name = "Join Geometry" + + # node Merge by Distance + merge_by_distance = solarpanel.nodes.new("GeometryNodeMergeByDistance") + merge_by_distance.name = "Merge by Distance" + merge_by_distance.mode = "ALL" + # Selection + merge_by_distance.inputs[1].default_value = True + # Distance + merge_by_distance.inputs[2].default_value = 9.999999747378752e-05 + + # node Frame + frame = solarpanel.nodes.new("NodeFrame") + frame.label = "fill bottom face" + frame.name = "Frame" + frame.label_size = 20 + frame.shrink = True + + # node Frame.001 + frame_001 = solarpanel.nodes.new("NodeFrame") + frame_001.label = "base geometry" + frame_001.name = "Frame.001" + frame_001.label_size = 20 + frame_001.shrink = True + + # node Frame.002 + frame_002 = solarpanel.nodes.new("NodeFrame") + frame_002.label = "recede panel" + frame_002.name = "Frame.002" + frame_002.label_size = 20 + frame_002.shrink = True + + # node Reroute + reroute = solarpanel.nodes.new("NodeReroute") + reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketBool" + # node Reroute.001 + reroute_001 = solarpanel.nodes.new("NodeReroute") + reroute_001.name = "Reroute.001" + reroute_001.socket_idname = "NodeSocketBool" + # node Reroute.002 + reroute_002 = solarpanel.nodes.new("NodeReroute") + reroute_002.name = "Reroute.002" + reroute_002.socket_idname = "NodeSocketInt" + # node Reroute.003 + reroute_003 = solarpanel.nodes.new("NodeReroute") + reroute_003.name = "Reroute.003" + reroute_003.socket_idname = "NodeSocketGeometry" + # node Reroute.004 + reroute_004 = solarpanel.nodes.new("NodeReroute") + reroute_004.name = "Reroute.004" + reroute_004.socket_idname = "NodeSocketGeometry" + # node Reroute.005 + reroute_005 = solarpanel.nodes.new("NodeReroute") + reroute_005.name = "Reroute.005" + reroute_005.socket_idname = "NodeSocketGeometry" + # node Switch + switch = solarpanel.nodes.new("GeometryNodeSwitch") + switch.name = "Switch" + switch.input_type = "GEOMETRY" + + # node Integer Math + integer_math = solarpanel.nodes.new("FunctionNodeIntegerMath") + integer_math.name = "Integer Math" + integer_math.mute = True + integer_math.operation = "ADD" + + # node Reroute.006 + reroute_006 = solarpanel.nodes.new("NodeReroute") + reroute_006.label = "seed" + reroute_006.name = "Reroute.006" + reroute_006.mute = True + reroute_006.socket_idname = "NodeSocketInt" + # node Separate XYZ.001 + separate_xyz_001 = solarpanel.nodes.new("ShaderNodeSeparateXYZ") + separate_xyz_001.name = "Separate XYZ.001" + + # node Reroute.007 + reroute_007 = solarpanel.nodes.new("NodeReroute") + reroute_007.name = "Reroute.007" + reroute_007.socket_idname = "NodeSocketFloatDistance" + # node Reroute.008 + reroute_008 = solarpanel.nodes.new("NodeReroute") + reroute_008.name = "Reroute.008" + reroute_008.socket_idname = "NodeSocketFloatDistance" + # node Reroute.009 + reroute_009 = solarpanel.nodes.new("NodeReroute") + reroute_009.name = "Reroute.009" + reroute_009.socket_idname = "NodeSocketBool" + # node Merge by Distance.001 + merge_by_distance_001 = solarpanel.nodes.new("GeometryNodeMergeByDistance") + merge_by_distance_001.name = "Merge by Distance.001" + merge_by_distance_001.mode = "ALL" + # Selection + merge_by_distance_001.inputs[1].default_value = True + # Distance + merge_by_distance_001.inputs[2].default_value = 9.999999747378752e-05 + + # node Switch.001 + switch_001 = solarpanel.nodes.new("GeometryNodeSwitch") + switch_001.name = "Switch.001" + switch_001.input_type = "GEOMETRY" + + # node Compare.002 + compare_002 = solarpanel.nodes.new("FunctionNodeCompare") + compare_002.name = "Compare.002" + compare_002.data_type = "FLOAT" + compare_002.mode = "ELEMENT" + compare_002.operation = "EQUAL" + # B + compare_002.inputs[1].default_value = 0.0 + # Epsilon + compare_002.inputs[12].default_value = 0.0 + + # node Reroute.010 + reroute_010 = solarpanel.nodes.new("NodeReroute") + reroute_010.name = "Reroute.010" + reroute_010.socket_idname = "NodeSocketGeometry" + + # Set parents + grid.parent = frame_001 + extrude_mesh.parent = frame_001 + extrude_mesh_001.parent = frame_001 + extrude_mesh_002.parent = frame_002 + vector.parent = frame_002 + capture_attribute.parent = frame_001 + index.parent = frame_001 + delete_geometry.parent = frame_001 + compare.parent = frame_001 + mesh_to_curve.parent = frame + position.parent = frame + separate_xyz.parent = frame + compare_001.parent = frame + fill_curve.parent = frame + join_geometry.parent = frame + merge_by_distance.parent = frame + reroute.parent = frame_002 + reroute_001.parent = frame_001 + reroute_002.parent = frame_001 + reroute_003.parent = frame + reroute_004.parent = frame + reroute_005.parent = frame + switch.parent = frame + reroute_007.parent = frame_001 + reroute_008.parent = frame_002 + merge_by_distance_001.parent = frame_002 + switch_001.parent = frame_002 + compare_002.parent = frame_002 + reroute_010.parent = frame_002 + + # Set locations + group_input.location = (-2245.719482421875, 154.1492462158203) + group_output.location = (2629.999755859375, 0.0) + set_material.location = (2439.999755859375, 23.5) + integer_001.location = (-2245.719482421875, 248.1492462158203) + grid.location = (-600.000244140625, 45.5) + extrude_mesh.location = (-220.000244140625, 79.49999237060547) + extrude_mesh_001.location = (-30.000244140625, 79.49999237060547) + extrude_mesh_002.location = (2059.999755859375, 79.49998474121094) + vector.location = (1869.999755859375, -84.71499633789062) + set_material_002.location = (2249.999755859375, 53.30263900756836) + capture_attribute.location = (-410.000244140625, 23.5) + index.location = (-600.000244140625, -154.14312744140625) + delete_geometry.location = (349.999755859375, 86.33111572265625) + compare.location = (159.999755859375, -55.73487854003906) + mesh_to_curve.location = (1299.999755859375, 379.2769470214844) + position.location = (729.999755859375, 355.7769470214844) + separate_xyz.location = (919.999755859375, 355.40728759765625) + compare_001.location = (1109.999755859375, 414.7769470214844) + fill_curve.location = (1489.999755859375, 391.2769470214844) + join_geometry.location = (1679.999755859375, 368.2769470214844) + merge_by_distance.location = (1869.999755859375, 402.2769470214844) + frame.location = (-1040.5667724609375, -150.7635498046875) + frame_001.location = (-889.3734130859375, 304.94390869140625) + frame_002.location = (-632.2884521484375, 312.48724365234375) + reroute.location = (1890.416748046875, 127.94869995117188) + reroute_001.location = (-29.37310791015625, 135.49200439453125) + reroute_002.location = (-239.9327392578125, -165.74472045898438) + reroute_003.location = (736.4287719726562, 434.59149169921875) + reroute_004.location = (1261.0093994140625, 434.59149169921875) + reroute_005.location = (1636.045654296875, 434.59149169921875) + switch.location = (2059.999755859375, 543.2854614257812) + integer_math.location = (-2055.719482421875, 270.14923095703125) + reroute_006.location = (-1895.7193603515625, 235.1492462158203) + separate_xyz_001.location = (-1694.7052001953125, 244.05198669433594) + reroute_007.location = (-83.75711059570312, -219.44503784179688) + reroute_008.location = (2013.187255859375, -235.79827880859375) + reroute_009.location = (954.8936767578125, 46.95509338378906) + merge_by_distance_001.location = (2410.55712890625, -138.453125) + switch_001.location = (2610.46142578125, 92.11172485351562) + compare_002.location = (2220.55712890625, -77.42880249023438) + reroute_010.location = (2350.07421875, 15.891845703125) + + # initialize solarpanel links + # set_material.Geometry -> group_output.Geometry + solarpanel.links.new(set_material.outputs[0], group_output.inputs[0]) + # capture_attribute.Geometry -> extrude_mesh.Mesh + solarpanel.links.new(capture_attribute.outputs[0], extrude_mesh.inputs[0]) + # extrude_mesh.Side -> extrude_mesh_001.Selection + solarpanel.links.new(extrude_mesh.outputs[2], extrude_mesh_001.inputs[1]) + # reroute.Output -> extrude_mesh_002.Selection + solarpanel.links.new(reroute.outputs[0], extrude_mesh_002.inputs[1]) + # vector.Vector -> extrude_mesh_002.Offset + solarpanel.links.new(vector.outputs[0], extrude_mesh_002.inputs[2]) + # set_material_002.Geometry -> set_material.Geometry + solarpanel.links.new(set_material_002.outputs[0], set_material.inputs[0]) + # extrude_mesh_002.Top -> set_material.Selection + solarpanel.links.new(extrude_mesh_002.outputs[1], set_material.inputs[1]) + # grid.Mesh -> capture_attribute.Geometry + solarpanel.links.new(grid.outputs[0], capture_attribute.inputs[0]) + # index.Index -> capture_attribute.Index + solarpanel.links.new(index.outputs[0], capture_attribute.inputs[1]) + # reroute_002.Output -> compare.A + solarpanel.links.new(reroute_002.outputs[0], compare.inputs[2]) + # index.Index -> compare.B + solarpanel.links.new(index.outputs[0], compare.inputs[3]) + # compare.Result -> delete_geometry.Selection + solarpanel.links.new(compare.outputs[0], delete_geometry.inputs[1]) + # extrude_mesh.Mesh -> extrude_mesh_001.Mesh + solarpanel.links.new(extrude_mesh.outputs[0], extrude_mesh_001.inputs[0]) + # extrude_mesh_001.Mesh -> delete_geometry.Geometry + solarpanel.links.new(extrude_mesh_001.outputs[0], delete_geometry.inputs[0]) + # position.Position -> separate_xyz.Vector + solarpanel.links.new(position.outputs[0], separate_xyz.inputs[0]) + # separate_xyz.Z -> compare_001.A + solarpanel.links.new(separate_xyz.outputs[2], compare_001.inputs[0]) + # compare_001.Result -> mesh_to_curve.Selection + solarpanel.links.new(compare_001.outputs[0], mesh_to_curve.inputs[1]) + # mesh_to_curve.Curve -> fill_curve.Curve + solarpanel.links.new(mesh_to_curve.outputs[0], fill_curve.inputs[0]) + # join_geometry.Geometry -> merge_by_distance.Geometry + solarpanel.links.new(join_geometry.outputs[0], merge_by_distance.inputs[0]) + # reroute_004.Output -> mesh_to_curve.Mesh + solarpanel.links.new(reroute_004.outputs[0], mesh_to_curve.inputs[0]) + # reroute_001.Output -> reroute.Input + solarpanel.links.new(reroute_001.outputs[0], reroute.inputs[0]) + # extrude_mesh.Top -> reroute_001.Input + solarpanel.links.new(extrude_mesh.outputs[1], reroute_001.inputs[0]) + # capture_attribute.Index -> reroute_002.Input + solarpanel.links.new(capture_attribute.outputs[1], reroute_002.inputs[0]) + # reroute_003.Output -> reroute_004.Input + solarpanel.links.new(reroute_003.outputs[0], reroute_004.inputs[0]) + # reroute_004.Output -> reroute_005.Input + solarpanel.links.new(reroute_004.outputs[0], reroute_005.inputs[0]) + # merge_by_distance.Geometry -> switch.True + solarpanel.links.new(merge_by_distance.outputs[0], switch.inputs[2]) + # switch.Output -> extrude_mesh_002.Mesh + solarpanel.links.new(switch.outputs[0], extrude_mesh_002.inputs[0]) + # reroute_005.Output -> switch.False + solarpanel.links.new(reroute_005.outputs[0], switch.inputs[1]) + # fill_curve.Mesh -> join_geometry.Geometry + solarpanel.links.new(fill_curve.outputs[0], join_geometry.inputs[0]) + # integer_001.Integer -> integer_math.Value + solarpanel.links.new(integer_001.outputs[0], integer_math.inputs[0]) + # group_input.seed -> integer_math.Value + solarpanel.links.new(group_input.outputs[0], integer_math.inputs[1]) + # integer_math.Value -> reroute_006.Input + solarpanel.links.new(integer_math.outputs[0], reroute_006.inputs[0]) + # group_input.scale -> separate_xyz_001.Vector + solarpanel.links.new(group_input.outputs[1], separate_xyz_001.inputs[0]) + # separate_xyz_001.X -> grid.Size X + solarpanel.links.new(separate_xyz_001.outputs[0], grid.inputs[0]) + # separate_xyz_001.Y -> grid.Size Y + solarpanel.links.new(separate_xyz_001.outputs[1], grid.inputs[1]) + # separate_xyz_001.Z -> extrude_mesh.Offset Scale + solarpanel.links.new(separate_xyz_001.outputs[2], extrude_mesh.inputs[3]) + # reroute_007.Output -> extrude_mesh_001.Offset Scale + solarpanel.links.new(reroute_007.outputs[0], extrude_mesh_001.inputs[3]) + # group_input.border_size -> reroute_007.Input + solarpanel.links.new(group_input.outputs[2], reroute_007.inputs[0]) + # group_input.panel_depth -> reroute_008.Input + solarpanel.links.new(group_input.outputs[3], reroute_008.inputs[0]) + # reroute_008.Output -> extrude_mesh_002.Offset Scale + solarpanel.links.new(reroute_008.outputs[0], extrude_mesh_002.inputs[3]) + # group_input.with_back_panel -> reroute_009.Input + solarpanel.links.new(group_input.outputs[4], reroute_009.inputs[0]) + # reroute_008.Output -> compare_002.A + solarpanel.links.new(reroute_008.outputs[0], compare_002.inputs[0]) + # merge_by_distance_001.Geometry -> switch_001.True + solarpanel.links.new(merge_by_distance_001.outputs[0], switch_001.inputs[2]) + # reroute_010.Output -> merge_by_distance_001.Geometry + solarpanel.links.new(reroute_010.outputs[0], merge_by_distance_001.inputs[0]) + # reroute_010.Output -> switch_001.False + solarpanel.links.new(reroute_010.outputs[0], switch_001.inputs[1]) + # switch_001.Output -> set_material_002.Geometry + solarpanel.links.new(switch_001.outputs[0], set_material_002.inputs[0]) + # reroute_009.Output -> switch.Switch + solarpanel.links.new(reroute_009.outputs[0], switch.inputs[0]) + # compare_002.Result -> switch_001.Switch + solarpanel.links.new(compare_002.outputs[0], switch_001.inputs[0]) + # extrude_mesh_002.Mesh -> reroute_010.Input + solarpanel.links.new(extrude_mesh_002.outputs[0], reroute_010.inputs[0]) + # group_input.frame_mat -> set_material_002.Material + solarpanel.links.new(group_input.outputs[5], set_material_002.inputs[2]) + # group_input.cells_mat -> set_material.Material + solarpanel.links.new(group_input.outputs[6], set_material.inputs[2]) + # delete_geometry.Geometry -> reroute_003.Input + solarpanel.links.new(delete_geometry.outputs[0], reroute_003.inputs[0]) + # reroute_005.Output -> join_geometry.Geometry + solarpanel.links.new(reroute_005.outputs[0], join_geometry.inputs[0]) + return solarpanel + + +solarpanel = solarpanel_node_group() diff --git a/model/object/solar_panel_procgen/material0.py b/model/object/solar_panel_procgen/material0.py new file mode 100644 index 0000000..c077b17 --- /dev/null +++ b/model/object/solar_panel_procgen/material0.py @@ -0,0 +1,829 @@ +import bpy +import mathutils + +mat = bpy.data.materials.new(name="ScratchedMetal") +mat.use_nodes = True + + +# initialize ScratchedMetalShader node group +def scratchedmetalshader_node_group(): + scratchedmetalshader = bpy.data.node_groups.new( + type="ShaderNodeTree", name="ScratchedMetalShader" + ) + + scratchedmetalshader.color_tag = "NONE" + scratchedmetalshader.description = "" + scratchedmetalshader.default_group_node_width = 140 + + # scratchedmetalshader interface + # Socket Shader + shader_socket = scratchedmetalshader.interface.new_socket( + name="Shader", in_out="OUTPUT", socket_type="NodeSocketShader" + ) + shader_socket.attribute_domain = "POINT" + + # Socket Scale + scale_socket = scratchedmetalshader.interface.new_socket( + name="Scale", in_out="INPUT", socket_type="NodeSocketFloat" + ) + scale_socket.default_value = 1.0 + scale_socket.min_value = -3.4028234663852886e38 + scale_socket.max_value = 3.4028234663852886e38 + scale_socket.subtype = "NONE" + scale_socket.attribute_domain = "POINT" + + # Socket Metallic + metallic_socket = scratchedmetalshader.interface.new_socket( + name="Metallic", in_out="INPUT", socket_type="NodeSocketFloat" + ) + metallic_socket.default_value = 1.0 + metallic_socket.min_value = 0.0 + metallic_socket.max_value = 1.0 + metallic_socket.subtype = "FACTOR" + metallic_socket.attribute_domain = "POINT" + + # Socket Metal Color 1 + metal_color_1_socket = scratchedmetalshader.interface.new_socket( + name="Metal Color 1", in_out="INPUT", socket_type="NodeSocketColor" + ) + metal_color_1_socket.default_value = ( + 0.17062200605869293, + 0.17062200605869293, + 0.17062200605869293, + 1.0, + ) + metal_color_1_socket.attribute_domain = "POINT" + + # Socket Metal Color 2 + metal_color_2_socket = scratchedmetalshader.interface.new_socket( + name="Metal Color 2", in_out="INPUT", socket_type="NodeSocketColor" + ) + metal_color_2_socket.default_value = ( + 0.03146599978208542, + 0.03146599978208542, + 0.03146599978208542, + 1.0, + ) + metal_color_2_socket.attribute_domain = "POINT" + + # Socket Noise Scale + noise_scale_socket = scratchedmetalshader.interface.new_socket( + name="Noise Scale", in_out="INPUT", socket_type="NodeSocketFloat" + ) + noise_scale_socket.default_value = 1.0 + noise_scale_socket.min_value = -3.4028234663852886e38 + noise_scale_socket.max_value = 3.4028234663852886e38 + noise_scale_socket.subtype = "NONE" + noise_scale_socket.attribute_domain = "POINT" + + # Socket Scratches Scale + scratches_scale_socket = scratchedmetalshader.interface.new_socket( + name="Scratches Scale", in_out="INPUT", socket_type="NodeSocketFloat" + ) + scratches_scale_socket.default_value = 1.0 + scratches_scale_socket.min_value = -3.4028234663852886e38 + scratches_scale_socket.max_value = 3.4028234663852886e38 + scratches_scale_socket.subtype = "NONE" + scratches_scale_socket.attribute_domain = "POINT" + + # Socket Scratches Color + scratches_color_socket = scratchedmetalshader.interface.new_socket( + name="Scratches Color", in_out="INPUT", socket_type="NodeSocketColor" + ) + scratches_color_socket.default_value = ( + 0.10046499967575073, + 0.10046499967575073, + 0.10046499967575073, + 1.0, + ) + scratches_color_socket.attribute_domain = "POINT" + + # Socket Roughness + roughness_socket = scratchedmetalshader.interface.new_socket( + name="Roughness", in_out="INPUT", socket_type="NodeSocketFloat" + ) + roughness_socket.default_value = 1.0 + roughness_socket.min_value = 0.0 + roughness_socket.max_value = 2.0 + roughness_socket.subtype = "NONE" + roughness_socket.attribute_domain = "POINT" + + # Socket Noise Bump Strength + noise_bump_strength_socket = scratchedmetalshader.interface.new_socket( + name="Noise Bump Strength", in_out="INPUT", socket_type="NodeSocketFloat" + ) + noise_bump_strength_socket.default_value = 0.05000000074505806 + noise_bump_strength_socket.min_value = 0.0 + noise_bump_strength_socket.max_value = 1.0 + noise_bump_strength_socket.subtype = "FACTOR" + noise_bump_strength_socket.attribute_domain = "POINT" + + # Socket Scratches Bump Strength + scratches_bump_strength_socket = scratchedmetalshader.interface.new_socket( + name="Scratches Bump Strength", in_out="INPUT", socket_type="NodeSocketFloat" + ) + scratches_bump_strength_socket.default_value = 0.10000000149011612 + scratches_bump_strength_socket.min_value = 0.0 + scratches_bump_strength_socket.max_value = 1.0 + scratches_bump_strength_socket.subtype = "FACTOR" + scratches_bump_strength_socket.attribute_domain = "POINT" + + # initialize scratchedmetalshader nodes + # node Frame + frame = scratchedmetalshader.nodes.new("NodeFrame") + frame.label = "Mapping" + frame.name = "Frame" + frame.label_size = 20 + frame.shrink = True + + # node Frame.002 + frame_002 = scratchedmetalshader.nodes.new("NodeFrame") + frame_002.label = "Base Texture" + frame_002.name = "Frame.002" + frame_002.label_size = 20 + frame_002.shrink = True + + # node Frame.003 + frame_003 = scratchedmetalshader.nodes.new("NodeFrame") + frame_003.label = "Base Color" + frame_003.name = "Frame.003" + frame_003.label_size = 20 + frame_003.shrink = True + + # node Frame.004 + frame_004 = scratchedmetalshader.nodes.new("NodeFrame") + frame_004.label = "Roughness" + frame_004.name = "Frame.004" + frame_004.label_size = 20 + frame_004.shrink = True + + # node Frame.001 + frame_001 = scratchedmetalshader.nodes.new("NodeFrame") + frame_001.label = "Scratches" + frame_001.name = "Frame.001" + frame_001.label_size = 20 + frame_001.shrink = True + + # node Frame.005 + frame_005 = scratchedmetalshader.nodes.new("NodeFrame") + frame_005.label = "Bump" + frame_005.name = "Frame.005" + frame_005.label_size = 20 + frame_005.shrink = True + + # node Group Output + group_output = scratchedmetalshader.nodes.new("NodeGroupOutput") + group_output.name = "Group Output" + group_output.is_active_output = True + + # node Texture Coordinate + texture_coordinate = scratchedmetalshader.nodes.new("ShaderNodeTexCoord") + texture_coordinate.name = "Texture Coordinate" + texture_coordinate.from_instancer = False + + # node Noise Texture.002 + noise_texture_002 = scratchedmetalshader.nodes.new("ShaderNodeTexNoise") + noise_texture_002.name = "Noise Texture.002" + noise_texture_002.noise_dimensions = "3D" + noise_texture_002.noise_type = "FBM" + noise_texture_002.normalize = True + # Scale + noise_texture_002.inputs[2].default_value = 15.0 + # Detail + noise_texture_002.inputs[3].default_value = 15.0 + # Roughness + noise_texture_002.inputs[4].default_value = 0.5 + # Lacunarity + noise_texture_002.inputs[5].default_value = 2.0 + # Distortion + noise_texture_002.inputs[8].default_value = 0.0 + + # node Color Ramp.004 + color_ramp_004 = scratchedmetalshader.nodes.new("ShaderNodeValToRGB") + color_ramp_004.name = "Color Ramp.004" + color_ramp_004.color_ramp.color_mode = "RGB" + color_ramp_004.color_ramp.hue_interpolation = "NEAR" + color_ramp_004.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + color_ramp_004.color_ramp.elements.remove(color_ramp_004.color_ramp.elements[0]) + color_ramp_004_cre_0 = color_ramp_004.color_ramp.elements[0] + color_ramp_004_cre_0.position = 0.3718593120574951 + color_ramp_004_cre_0.alpha = 1.0 + color_ramp_004_cre_0.color = ( + 0.502767026424408, + 0.502767026424408, + 0.502767026424408, + 1.0, + ) + + color_ramp_004_cre_1 = color_ramp_004.color_ramp.elements.new(0.6457287073135376) + color_ramp_004_cre_1.alpha = 1.0 + color_ramp_004_cre_1.color = (1.0, 1.0, 1.0, 1.0) + + # node Color Ramp.005 + color_ramp_005 = scratchedmetalshader.nodes.new("ShaderNodeValToRGB") + color_ramp_005.name = "Color Ramp.005" + color_ramp_005.color_ramp.color_mode = "RGB" + color_ramp_005.color_ramp.hue_interpolation = "NEAR" + color_ramp_005.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + color_ramp_005.color_ramp.elements.remove(color_ramp_005.color_ramp.elements[0]) + color_ramp_005_cre_0 = color_ramp_005.color_ramp.elements[0] + color_ramp_005_cre_0.position = 0.14824114739894867 + color_ramp_005_cre_0.alpha = 1.0 + color_ramp_005_cre_0.color = (0.0, 0.0, 0.0, 1.0) + + color_ramp_005_cre_1 = color_ramp_005.color_ramp.elements.new(0.8040200471878052) + color_ramp_005_cre_1.alpha = 1.0 + color_ramp_005_cre_1.color = (1.0, 1.0, 1.0, 1.0) + + # node Mix.003 + mix_003 = scratchedmetalshader.nodes.new("ShaderNodeMix") + mix_003.name = "Mix.003" + mix_003.blend_type = "MIX" + mix_003.clamp_factor = True + mix_003.clamp_result = False + mix_003.data_type = "RGBA" + mix_003.factor_mode = "UNIFORM" + + # node Color Ramp.006 + color_ramp_006 = scratchedmetalshader.nodes.new("ShaderNodeValToRGB") + color_ramp_006.name = "Color Ramp.006" + color_ramp_006.color_ramp.color_mode = "RGB" + color_ramp_006.color_ramp.hue_interpolation = "NEAR" + color_ramp_006.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + color_ramp_006.color_ramp.elements.remove(color_ramp_006.color_ramp.elements[0]) + color_ramp_006_cre_0 = color_ramp_006.color_ramp.elements[0] + color_ramp_006_cre_0.position = 0.0 + color_ramp_006_cre_0.alpha = 1.0 + color_ramp_006_cre_0.color = ( + 0.2911059856414795, + 0.2911059856414795, + 0.2911059856414795, + 1.0, + ) + + color_ramp_006_cre_1 = color_ramp_006.color_ramp.elements.new(1.0) + color_ramp_006_cre_1.alpha = 1.0 + color_ramp_006_cre_1.color = ( + 0.596705973148346, + 0.596705973148346, + 0.596705973148346, + 1.0, + ) + + # node Voronoi Texture + voronoi_texture = scratchedmetalshader.nodes.new("ShaderNodeTexVoronoi") + voronoi_texture.name = "Voronoi Texture" + voronoi_texture.distance = "EUCLIDEAN" + voronoi_texture.feature = "DISTANCE_TO_EDGE" + voronoi_texture.normalize = False + voronoi_texture.voronoi_dimensions = "3D" + # Scale + voronoi_texture.inputs[2].default_value = 50.0 + # Detail + voronoi_texture.inputs[3].default_value = 15.0 + # Roughness + voronoi_texture.inputs[4].default_value = 0.75 + # Lacunarity + voronoi_texture.inputs[5].default_value = 2.0 + # Randomness + voronoi_texture.inputs[8].default_value = 1.0 + + # node Voronoi Texture.001 + voronoi_texture_001 = scratchedmetalshader.nodes.new("ShaderNodeTexVoronoi") + voronoi_texture_001.name = "Voronoi Texture.001" + voronoi_texture_001.distance = "EUCLIDEAN" + voronoi_texture_001.feature = "DISTANCE_TO_EDGE" + voronoi_texture_001.normalize = False + voronoi_texture_001.voronoi_dimensions = "3D" + # Scale + voronoi_texture_001.inputs[2].default_value = 114.0 + # Detail + voronoi_texture_001.inputs[3].default_value = 15.0 + # Roughness + voronoi_texture_001.inputs[4].default_value = 0.75 + # Lacunarity + voronoi_texture_001.inputs[5].default_value = 2.0 + # Randomness + voronoi_texture_001.inputs[8].default_value = 1.0 + + # node Color Ramp + color_ramp = scratchedmetalshader.nodes.new("ShaderNodeValToRGB") + color_ramp.name = "Color Ramp" + color_ramp.color_ramp.color_mode = "RGB" + color_ramp.color_ramp.hue_interpolation = "NEAR" + color_ramp.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + color_ramp.color_ramp.elements.remove(color_ramp.color_ramp.elements[0]) + color_ramp_cre_0 = color_ramp.color_ramp.elements[0] + color_ramp_cre_0.position = 0.0 + color_ramp_cre_0.alpha = 1.0 + color_ramp_cre_0.color = (0.0, 0.0, 0.0, 1.0) + + color_ramp_cre_1 = color_ramp.color_ramp.elements.new(0.037688400596380234) + color_ramp_cre_1.alpha = 1.0 + color_ramp_cre_1.color = (1.0, 1.0, 1.0, 1.0) + + # node Noise Texture + noise_texture = scratchedmetalshader.nodes.new("ShaderNodeTexNoise") + noise_texture.name = "Noise Texture" + noise_texture.noise_dimensions = "3D" + noise_texture.noise_type = "FBM" + noise_texture.normalize = True + # Scale + noise_texture.inputs[2].default_value = 35.0 + # Detail + noise_texture.inputs[3].default_value = 15.0 + # Roughness + noise_texture.inputs[4].default_value = 0.7300000190734863 + # Lacunarity + noise_texture.inputs[5].default_value = 2.0 + # Distortion + noise_texture.inputs[8].default_value = 0.0 + + # node Color Ramp.001 + color_ramp_001 = scratchedmetalshader.nodes.new("ShaderNodeValToRGB") + color_ramp_001.name = "Color Ramp.001" + color_ramp_001.color_ramp.color_mode = "RGB" + color_ramp_001.color_ramp.hue_interpolation = "NEAR" + color_ramp_001.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + color_ramp_001.color_ramp.elements.remove(color_ramp_001.color_ramp.elements[0]) + color_ramp_001_cre_0 = color_ramp_001.color_ramp.elements[0] + color_ramp_001_cre_0.position = 0.0 + color_ramp_001_cre_0.alpha = 1.0 + color_ramp_001_cre_0.color = (0.0, 0.0, 0.0, 1.0) + + color_ramp_001_cre_1 = color_ramp_001.color_ramp.elements.new(0.037688400596380234) + color_ramp_001_cre_1.alpha = 1.0 + color_ramp_001_cre_1.color = (1.0, 1.0, 1.0, 1.0) + + # node Mix + mix = scratchedmetalshader.nodes.new("ShaderNodeMix") + mix.name = "Mix" + mix.blend_type = "DARKEN" + mix.clamp_factor = True + mix.clamp_result = False + mix.data_type = "RGBA" + mix.factor_mode = "UNIFORM" + # Factor_Float + mix.inputs[0].default_value = 1.0 + + # node Mix.001 + mix_001 = scratchedmetalshader.nodes.new("ShaderNodeMix") + mix_001.name = "Mix.001" + mix_001.blend_type = "LIGHTEN" + mix_001.clamp_factor = True + mix_001.clamp_result = False + mix_001.data_type = "RGBA" + mix_001.factor_mode = "UNIFORM" + # B_Color + mix_001.inputs[7].default_value = (1.0, 1.0, 1.0, 1.0) + + # node Color Ramp.002 + color_ramp_002 = scratchedmetalshader.nodes.new("ShaderNodeValToRGB") + color_ramp_002.name = "Color Ramp.002" + color_ramp_002.color_ramp.color_mode = "RGB" + color_ramp_002.color_ramp.hue_interpolation = "NEAR" + color_ramp_002.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + color_ramp_002.color_ramp.elements.remove(color_ramp_002.color_ramp.elements[0]) + color_ramp_002_cre_0 = color_ramp_002.color_ramp.elements[0] + color_ramp_002_cre_0.position = 0.40703511238098145 + color_ramp_002_cre_0.alpha = 1.0 + color_ramp_002_cre_0.color = (0.0, 0.0, 0.0, 1.0) + + color_ramp_002_cre_1 = color_ramp_002.color_ramp.elements.new(0.6532663106918335) + color_ramp_002_cre_1.alpha = 1.0 + color_ramp_002_cre_1.color = (1.0, 1.0, 1.0, 1.0) + + # node Color Ramp.003 + color_ramp_003 = scratchedmetalshader.nodes.new("ShaderNodeValToRGB") + color_ramp_003.name = "Color Ramp.003" + color_ramp_003.color_ramp.color_mode = "RGB" + color_ramp_003.color_ramp.hue_interpolation = "NEAR" + color_ramp_003.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + color_ramp_003.color_ramp.elements.remove(color_ramp_003.color_ramp.elements[0]) + color_ramp_003_cre_0 = color_ramp_003.color_ramp.elements[0] + color_ramp_003_cre_0.position = 0.0 + color_ramp_003_cre_0.alpha = 1.0 + color_ramp_003_cre_0.color = (0.0, 0.0, 0.0, 1.0) + + color_ramp_003_cre_1 = color_ramp_003.color_ramp.elements.new(0.4321606159210205) + color_ramp_003_cre_1.alpha = 1.0 + color_ramp_003_cre_1.color = (1.0, 1.0, 1.0, 1.0) + + # node Mapping + mapping = scratchedmetalshader.nodes.new("ShaderNodeMapping") + mapping.name = "Mapping" + mapping.vector_type = "POINT" + # Location + mapping.inputs[1].default_value = (0.0, 0.0, 0.0) + # Rotation + mapping.inputs[2].default_value = (0.0, 0.0, 0.0) + + # node Principled BSDF + principled_bsdf = scratchedmetalshader.nodes.new("ShaderNodeBsdfPrincipled") + principled_bsdf.name = "Principled BSDF" + principled_bsdf.distribution = "MULTI_GGX" + principled_bsdf.subsurface_method = "RANDOM_WALK" + # IOR + principled_bsdf.inputs[3].default_value = 1.4500000476837158 + # Alpha + principled_bsdf.inputs[4].default_value = 1.0 + # Diffuse Roughness + principled_bsdf.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf.inputs[8].default_value = 0.0 + # Subsurface Radius + principled_bsdf.inputs[9].default_value = ( + 1.0, + 0.20000000298023224, + 0.10000000149011612, + ) + # Subsurface Scale + principled_bsdf.inputs[10].default_value = 0.05000000074505806 + # Subsurface Anisotropy + principled_bsdf.inputs[12].default_value = 0.0 + # Specular IOR Level + principled_bsdf.inputs[13].default_value = 0.5 + # Specular Tint + principled_bsdf.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) + # Anisotropic + principled_bsdf.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf.inputs[16].default_value = 0.0 + # Tangent + principled_bsdf.inputs[17].default_value = (0.0, 0.0, 0.0) + # Transmission Weight + principled_bsdf.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf.inputs[19].default_value = 0.0 + # Coat Roughness + principled_bsdf.inputs[20].default_value = 0.029999999329447746 + # Coat IOR + principled_bsdf.inputs[21].default_value = 1.5 + # Coat Tint + principled_bsdf.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) + # Coat Normal + principled_bsdf.inputs[23].default_value = (0.0, 0.0, 0.0) + # Sheen Weight + principled_bsdf.inputs[24].default_value = 0.0 + # Sheen Roughness + principled_bsdf.inputs[25].default_value = 0.5 + # Sheen Tint + principled_bsdf.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Strength + principled_bsdf.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf.inputs[29].default_value = 0.0 + # Thin Film IOR + principled_bsdf.inputs[30].default_value = 1.3300000429153442 + + # node Mix.002 + mix_002 = scratchedmetalshader.nodes.new("ShaderNodeMix") + mix_002.name = "Mix.002" + mix_002.blend_type = "MIX" + mix_002.clamp_factor = True + mix_002.clamp_result = False + mix_002.data_type = "RGBA" + mix_002.factor_mode = "UNIFORM" + + # node Reroute + reroute = scratchedmetalshader.nodes.new("NodeReroute") + reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketVector" + # node Reroute.001 + reroute_001 = scratchedmetalshader.nodes.new("NodeReroute") + reroute_001.name = "Reroute.001" + reroute_001.socket_idname = "NodeSocketVector" + # node Mapping.002 + mapping_002 = scratchedmetalshader.nodes.new("ShaderNodeMapping") + mapping_002.name = "Mapping.002" + mapping_002.vector_type = "POINT" + # Location + mapping_002.inputs[1].default_value = (0.0, 0.0, 0.0) + # Rotation + mapping_002.inputs[2].default_value = (0.0, 0.0, 0.0) + + # node Mapping.001 + mapping_001 = scratchedmetalshader.nodes.new("ShaderNodeMapping") + mapping_001.name = "Mapping.001" + mapping_001.vector_type = "POINT" + # Location + mapping_001.inputs[1].default_value = (0.0, 0.0, 0.0) + # Rotation + mapping_001.inputs[2].default_value = (0.0, 0.0, 0.0) + + # node Hue/Saturation/Value + hue_saturation_value = scratchedmetalshader.nodes.new("ShaderNodeHueSaturation") + hue_saturation_value.name = "Hue/Saturation/Value" + # Hue + hue_saturation_value.inputs[0].default_value = 0.5 + # Saturation + hue_saturation_value.inputs[1].default_value = 1.0 + # Fac + hue_saturation_value.inputs[3].default_value = 1.0 + + # node Bump + bump = scratchedmetalshader.nodes.new("ShaderNodeBump") + bump.name = "Bump" + bump.invert = False + # Distance + bump.inputs[1].default_value = 1.0 + # Normal + bump.inputs[3].default_value = (0.0, 0.0, 0.0) + + # node Bump.001 + bump_001 = scratchedmetalshader.nodes.new("ShaderNodeBump") + bump_001.name = "Bump.001" + bump_001.invert = False + # Distance + bump_001.inputs[1].default_value = 1.0 + + # node Group Input + group_input = scratchedmetalshader.nodes.new("NodeGroupInput") + group_input.name = "Group Input" + + # node Noise Texture.001 + noise_texture_001 = scratchedmetalshader.nodes.new("ShaderNodeTexNoise") + noise_texture_001.name = "Noise Texture.001" + noise_texture_001.noise_dimensions = "3D" + noise_texture_001.noise_type = "FBM" + noise_texture_001.normalize = True + # Scale + noise_texture_001.inputs[2].default_value = 15.0 + # Detail + noise_texture_001.inputs[3].default_value = 15.0 + # Lacunarity + noise_texture_001.inputs[5].default_value = 2.0 + # Distortion + noise_texture_001.inputs[8].default_value = 0.0 + + # node Clamp + clamp = scratchedmetalshader.nodes.new("ShaderNodeClamp") + clamp.name = "Clamp" + clamp.hide = True + clamp.clamp_type = "MINMAX" + # Min + clamp.inputs[1].default_value = 0.0 + # Max + clamp.inputs[2].default_value = 1.0 + + # Set parents + texture_coordinate.parent = frame + noise_texture_002.parent = frame_002 + color_ramp_004.parent = frame_002 + color_ramp_005.parent = frame_002 + mix_003.parent = frame_003 + color_ramp_006.parent = frame_004 + voronoi_texture.parent = frame_001 + voronoi_texture_001.parent = frame_001 + color_ramp.parent = frame_001 + noise_texture.parent = frame_001 + color_ramp_001.parent = frame_001 + mix.parent = frame_001 + mix_001.parent = frame_001 + color_ramp_002.parent = frame_001 + color_ramp_003.parent = frame_001 + mapping.parent = frame + mix_002.parent = frame_003 + reroute.parent = frame_002 + hue_saturation_value.parent = frame_004 + bump.parent = frame_005 + bump_001.parent = frame_005 + noise_texture_001.parent = frame_002 + clamp.parent = frame_002 + + # Set locations + frame.location = (-310.99957275390625, -579.0892333984375) + frame_002.location = (-24.571781158447266, -435.270263671875) + frame_003.location = (116.4566650390625, -421.54803466796875) + frame_004.location = (121.9600830078125, -446.01263427734375) + frame_001.location = (31.0347843170166, -436.55230712890625) + frame_005.location = (112.49017333984375, -449.3189392089844) + group_output.location = (1811.4449462890625, 0.0) + texture_coordinate.location = (-1054.174560546875, 343.1857604980469) + noise_texture_002.location = (-676.170166015625, -35.39590835571289) + color_ramp_004.location = (-457.3351745605469, -58.90477752685547) + color_ramp_005.location = (115.84701538085938, -55.83916473388672) + mix_003.location = (631.3408813476562, 664.2621459960938) + color_ramp_006.location = (885.1354370117188, 590.399658203125) + voronoi_texture.location = (-684.4620971679688, 342.4783020019531) + voronoi_texture_001.location = (-683.689453125, 613.7161865234375) + color_ramp.location = (-497.3431701660156, 335.38128662109375) + noise_texture.location = (-694.7215576171875, 891.0049438476562) + color_ramp_001.location = (-513.7548217773438, 600.724853515625) + mix.location = (-230.14846801757812, 553.0309448242188) + mix_001.location = (-36.52252197265625, 764.796630859375) + color_ramp_002.location = (-498.09423828125, 853.9265747070312) + color_ramp_003.location = (133.2479705810547, 763.3596801757812) + mapping.location = (-874.1744995117188, 343.1857604980469) + principled_bsdf.location = (1521.4449462890625, 252.1475830078125) + mix_002.location = (465.5040283203125, 670.1427001953125) + reroute.location = (-697.7589111328125, -16.104949951171875) + reroute_001.location = (-740.7999267578125, 70.80003356933594) + mapping_002.location = (-953.9867553710938, -258.3983459472656) + mapping_001.location = (-935.9235229492188, 130.87722778320312) + hue_saturation_value.location = (1151.3807373046875, 580.0084228515625) + bump.location = (964.6862182617188, 298.7779541015625) + bump_001.location = (1160.601318359375, 307.0071105957031) + group_input.location = (-1404.9974365234375, -562.6101684570312) + noise_texture_001.location = (-129.48410034179688, -33.153560638427734) + clamp.location = (-129.48410034179688, -333.153564453125) + + # initialize scratchedmetalshader links + # mix_003.Result -> principled_bsdf.Base Color + scratchedmetalshader.links.new(mix_003.outputs[2], principled_bsdf.inputs[0]) + # mix_003.Result -> color_ramp_006.Fac + scratchedmetalshader.links.new(mix_003.outputs[2], color_ramp_006.inputs[0]) + # noise_texture.Fac -> color_ramp_002.Fac + scratchedmetalshader.links.new(noise_texture.outputs[0], color_ramp_002.inputs[0]) + # reroute_001.Output -> voronoi_texture.Vector + scratchedmetalshader.links.new(reroute_001.outputs[0], voronoi_texture.inputs[0]) + # bump.Normal -> bump_001.Normal + scratchedmetalshader.links.new(bump.outputs[0], bump_001.inputs[3]) + # mix.Result -> mix_001.A + scratchedmetalshader.links.new(mix.outputs[2], mix_001.inputs[6]) + # reroute_001.Output -> noise_texture.Vector + scratchedmetalshader.links.new(reroute_001.outputs[0], noise_texture.inputs[0]) + # color_ramp_003.Color -> mix_003.Factor + scratchedmetalshader.links.new(color_ramp_003.outputs[0], mix_003.inputs[0]) + # reroute.Output -> noise_texture_002.Vector + scratchedmetalshader.links.new(reroute.outputs[0], noise_texture_002.inputs[0]) + # voronoi_texture_001.Distance -> color_ramp_001.Fac + scratchedmetalshader.links.new( + voronoi_texture_001.outputs[0], color_ramp_001.inputs[0] + ) + # texture_coordinate.Object -> mapping.Vector + scratchedmetalshader.links.new(texture_coordinate.outputs[3], mapping.inputs[0]) + # color_ramp_002.Color -> mix_001.Factor + scratchedmetalshader.links.new(color_ramp_002.outputs[0], mix_001.inputs[0]) + # voronoi_texture.Distance -> color_ramp.Fac + scratchedmetalshader.links.new(voronoi_texture.outputs[0], color_ramp.inputs[0]) + # noise_texture_002.Fac -> color_ramp_004.Fac + scratchedmetalshader.links.new( + noise_texture_002.outputs[0], color_ramp_004.inputs[0] + ) + # color_ramp_001.Color -> mix.A + scratchedmetalshader.links.new(color_ramp_001.outputs[0], mix.inputs[6]) + # bump_001.Normal -> principled_bsdf.Normal + scratchedmetalshader.links.new(bump_001.outputs[0], principled_bsdf.inputs[5]) + # reroute_001.Output -> voronoi_texture_001.Vector + scratchedmetalshader.links.new( + reroute_001.outputs[0], voronoi_texture_001.inputs[0] + ) + # noise_texture_001.Fac -> color_ramp_005.Fac + scratchedmetalshader.links.new( + noise_texture_001.outputs[0], color_ramp_005.inputs[0] + ) + # color_ramp_005.Color -> mix_002.Factor + scratchedmetalshader.links.new(color_ramp_005.outputs[0], mix_002.inputs[0]) + # color_ramp_006.Color -> hue_saturation_value.Color + scratchedmetalshader.links.new( + color_ramp_006.outputs[0], hue_saturation_value.inputs[4] + ) + # noise_texture_001.Fac -> bump.Height + scratchedmetalshader.links.new(noise_texture_001.outputs[0], bump.inputs[2]) + # mix_002.Result -> mix_003.B + scratchedmetalshader.links.new(mix_002.outputs[2], mix_003.inputs[7]) + # reroute.Output -> noise_texture_001.Vector + scratchedmetalshader.links.new(reroute.outputs[0], noise_texture_001.inputs[0]) + # mix_001.Result -> color_ramp_003.Fac + scratchedmetalshader.links.new(mix_001.outputs[2], color_ramp_003.inputs[0]) + # color_ramp.Color -> mix.B + scratchedmetalshader.links.new(color_ramp.outputs[0], mix.inputs[7]) + # hue_saturation_value.Color -> principled_bsdf.Roughness + scratchedmetalshader.links.new( + hue_saturation_value.outputs[0], principled_bsdf.inputs[2] + ) + # color_ramp_003.Color -> bump_001.Height + scratchedmetalshader.links.new(color_ramp_003.outputs[0], bump_001.inputs[2]) + # principled_bsdf.BSDF -> group_output.Shader + scratchedmetalshader.links.new(principled_bsdf.outputs[0], group_output.inputs[0]) + # group_input.Scale -> mapping.Scale + scratchedmetalshader.links.new(group_input.outputs[0], mapping.inputs[3]) + # group_input.Metallic -> principled_bsdf.Metallic + scratchedmetalshader.links.new(group_input.outputs[1], principled_bsdf.inputs[1]) + # group_input.Metal Color 1 -> mix_002.A + scratchedmetalshader.links.new(group_input.outputs[2], mix_002.inputs[6]) + # group_input.Metal Color 2 -> mix_002.B + scratchedmetalshader.links.new(group_input.outputs[3], mix_002.inputs[7]) + # mapping_002.Vector -> reroute.Input + scratchedmetalshader.links.new(mapping_002.outputs[0], reroute.inputs[0]) + # mapping_001.Vector -> reroute_001.Input + scratchedmetalshader.links.new(mapping_001.outputs[0], reroute_001.inputs[0]) + # mapping.Vector -> mapping_001.Vector + scratchedmetalshader.links.new(mapping.outputs[0], mapping_001.inputs[0]) + # mapping.Vector -> mapping_002.Vector + scratchedmetalshader.links.new(mapping.outputs[0], mapping_002.inputs[0]) + # group_input.Noise Scale -> mapping_002.Scale + scratchedmetalshader.links.new(group_input.outputs[4], mapping_002.inputs[3]) + # group_input.Scratches Scale -> mapping_001.Scale + scratchedmetalshader.links.new(group_input.outputs[5], mapping_001.inputs[3]) + # group_input.Scratches Color -> mix_003.A + scratchedmetalshader.links.new(group_input.outputs[6], mix_003.inputs[6]) + # group_input.Roughness -> hue_saturation_value.Value + scratchedmetalshader.links.new( + group_input.outputs[7], hue_saturation_value.inputs[2] + ) + # group_input.Noise Bump Strength -> bump.Strength + scratchedmetalshader.links.new(group_input.outputs[8], bump.inputs[0]) + # group_input.Scratches Bump Strength -> bump_001.Strength + scratchedmetalshader.links.new(group_input.outputs[9], bump_001.inputs[0]) + # color_ramp_004.Color -> clamp.Value + scratchedmetalshader.links.new(color_ramp_004.outputs[0], clamp.inputs[0]) + # clamp.Result -> noise_texture_001.Roughness + scratchedmetalshader.links.new(clamp.outputs[0], noise_texture_001.inputs[4]) + return scratchedmetalshader + + +scratchedmetalshader = scratchedmetalshader_node_group() + + +# initialize ScratchedMetal node group +def scratchedmetal_node_group(): + scratchedmetal = mat.node_tree + # start with a clean node tree + for node in scratchedmetal.nodes: + scratchedmetal.nodes.remove(node) + scratchedmetal.color_tag = "NONE" + scratchedmetal.description = "" + scratchedmetal.default_group_node_width = 140 + + # scratchedmetal interface + + # initialize scratchedmetal nodes + # node Material Output + material_output = scratchedmetal.nodes.new("ShaderNodeOutputMaterial") + material_output.name = "Material Output" + material_output.is_active_output = True + material_output.target = "ALL" + # Displacement + material_output.inputs[2].default_value = (0.0, 0.0, 0.0) + # Thickness + material_output.inputs[3].default_value = 0.0 + + # node Group + group = scratchedmetal.nodes.new("ShaderNodeGroup") + group.name = "Group" + group.node_tree = scratchedmetalshader + # Socket_1 + group.inputs[0].default_value = 1.0 + # Socket_2 + group.inputs[1].default_value = 1.0 + # Socket_3 + group.inputs[2].default_value = ( + 0.17062200605869293, + 0.17062200605869293, + 0.17062200605869293, + 1.0, + ) + # Socket_4 + group.inputs[3].default_value = ( + 0.03146599978208542, + 0.03146599978208542, + 0.03146599978208542, + 1.0, + ) + # Socket_5 + group.inputs[4].default_value = 1.0 + # Socket_6 + group.inputs[5].default_value = 1.0 + # Socket_7 + group.inputs[6].default_value = ( + 0.10046499967575073, + 0.10046499967575073, + 0.10046499967575073, + 1.0, + ) + # Socket_8 + group.inputs[7].default_value = 1.0 + # Socket_9 + group.inputs[8].default_value = 0.009999999776482582 + # Socket_10 + group.inputs[9].default_value = 0.02500000037252903 + + # Set locations + material_output.location = (1656.2716064453125, 672.1256713867188) + group.location = (1350.748291015625, 675.5988159179688) + + # initialize scratchedmetal links + # group.Shader -> material_output.Surface + scratchedmetal.links.new(group.outputs[0], material_output.inputs[0]) + return scratchedmetal + + +scratchedmetal = scratchedmetal_node_group() diff --git a/model/object/solar_panel_procgen/material1.py b/model/object/solar_panel_procgen/material1.py new file mode 100644 index 0000000..539cdc5 --- /dev/null +++ b/model/object/solar_panel_procgen/material1.py @@ -0,0 +1,826 @@ +import bpy +import mathutils + +mat = bpy.data.materials.new(name="SolarPanel") +mat.use_nodes = True + + +# initialize Random x4 | Mat node group +def random_x4___mat_node_group(): + random_x4___mat = bpy.data.node_groups.new( + type="ShaderNodeTree", name="Random x4 | Mat" + ) + + random_x4___mat.color_tag = "NONE" + random_x4___mat.description = "" + random_x4___mat.default_group_node_width = 140 + + # random_x4___mat interface + # Socket 0 + _0_socket = random_x4___mat.interface.new_socket( + name="0", in_out="OUTPUT", socket_type="NodeSocketFloat" + ) + _0_socket.default_value = 0.0 + _0_socket.min_value = 0.0 + _0_socket.max_value = 1.0 + _0_socket.subtype = "NONE" + _0_socket.attribute_domain = "POINT" + + # Socket 1 + _1_socket = random_x4___mat.interface.new_socket( + name="1", in_out="OUTPUT", socket_type="NodeSocketFloat" + ) + _1_socket.default_value = 0.0 + _1_socket.min_value = 0.0 + _1_socket.max_value = 1.0 + _1_socket.subtype = "NONE" + _1_socket.attribute_domain = "POINT" + + # Socket 2 + _2_socket = random_x4___mat.interface.new_socket( + name="2", in_out="OUTPUT", socket_type="NodeSocketFloat" + ) + _2_socket.default_value = 0.0 + _2_socket.min_value = 0.0 + _2_socket.max_value = 1.0 + _2_socket.subtype = "NONE" + _2_socket.attribute_domain = "POINT" + + # Socket 3 + _3_socket = random_x4___mat.interface.new_socket( + name="3", in_out="OUTPUT", socket_type="NodeSocketFloat" + ) + _3_socket.default_value = 0.0 + _3_socket.min_value = 0.0 + _3_socket.max_value = 1.0 + _3_socket.subtype = "NONE" + _3_socket.attribute_domain = "POINT" + + # Socket 4 + _4_socket = random_x4___mat.interface.new_socket( + name="4", in_out="OUTPUT", socket_type="NodeSocketFloat" + ) + _4_socket.default_value = 0.0 + _4_socket.min_value = -3.4028234663852886e38 + _4_socket.max_value = 3.4028234663852886e38 + _4_socket.subtype = "NONE" + _4_socket.attribute_domain = "POINT" + + # Socket Seed + seed_socket = random_x4___mat.interface.new_socket( + name="Seed", in_out="INPUT", socket_type="NodeSocketFloat" + ) + seed_socket.default_value = 0.0 + seed_socket.min_value = 0.0 + seed_socket.max_value = 1.0 + seed_socket.subtype = "NONE" + seed_socket.attribute_domain = "POINT" + + # initialize random_x4___mat nodes + # node Group Output + group_output = random_x4___mat.nodes.new("NodeGroupOutput") + group_output.name = "Group Output" + group_output.is_active_output = True + + # node Group Input + group_input = random_x4___mat.nodes.new("NodeGroupInput") + group_input.name = "Group Input" + + # node Object Info + object_info = random_x4___mat.nodes.new("ShaderNodeObjectInfo") + object_info.name = "Object Info" + + # node Math + math = random_x4___mat.nodes.new("ShaderNodeMath") + math.name = "Math" + math.operation = "ADD" + math.use_clamp = False + + # node White Noise Texture + white_noise_texture = random_x4___mat.nodes.new("ShaderNodeTexWhiteNoise") + white_noise_texture.name = "White Noise Texture" + white_noise_texture.noise_dimensions = "4D" + + # node Separate Color + separate_color = random_x4___mat.nodes.new("ShaderNodeSeparateColor") + separate_color.name = "Separate Color" + separate_color.mode = "RGB" + + # node Math.001 + math_001 = random_x4___mat.nodes.new("ShaderNodeMath") + math_001.name = "Math.001" + math_001.operation = "ADD" + math_001.use_clamp = False + + # node White Noise Texture.001 + white_noise_texture_001 = random_x4___mat.nodes.new("ShaderNodeTexWhiteNoise") + white_noise_texture_001.name = "White Noise Texture.001" + white_noise_texture_001.noise_dimensions = "4D" + + # node Separate Color.001 + separate_color_001 = random_x4___mat.nodes.new("ShaderNodeSeparateColor") + separate_color_001.name = "Separate Color.001" + separate_color_001.mode = "RGB" + + # Set locations + group_output.location = (689.6586303710938, -17.691898345947266) + group_input.location = (-490.65618896484375, 343.00933837890625) + object_info.location = (-490.65618896484375, 63.65891647338867) + math.location = (-280.6562194824219, 343.00933837890625) + white_noise_texture.location = (-70.65621948242188, 343.00933837890625) + separate_color.location = (139.34378051757812, 343.00933837890625) + math_001.location = (-280.6562194824219, 63.65891647338867) + white_noise_texture_001.location = (-70.65621948242188, 63.65891647338867) + separate_color_001.location = (139.34378051757812, 63.65891647338867) + + # initialize random_x4___mat links + # object_info.Random -> white_noise_texture.W + random_x4___mat.links.new(object_info.outputs[5], white_noise_texture.inputs[1]) + # math.Value -> white_noise_texture.Vector + random_x4___mat.links.new(math.outputs[0], white_noise_texture.inputs[0]) + # white_noise_texture.Color -> separate_color.Color + random_x4___mat.links.new(white_noise_texture.outputs[1], separate_color.inputs[0]) + # object_info.Object Index -> math.Value + random_x4___mat.links.new(object_info.outputs[3], math.inputs[1]) + # group_input.Seed -> math.Value + random_x4___mat.links.new(group_input.outputs[0], math.inputs[0]) + # separate_color.Red -> group_output.0 + random_x4___mat.links.new(separate_color.outputs[0], group_output.inputs[0]) + # separate_color.Green -> group_output.1 + random_x4___mat.links.new(separate_color.outputs[1], group_output.inputs[1]) + # math_001.Value -> white_noise_texture_001.Vector + random_x4___mat.links.new(math_001.outputs[0], white_noise_texture_001.inputs[0]) + # white_noise_texture_001.Color -> separate_color_001.Color + random_x4___mat.links.new( + white_noise_texture_001.outputs[1], separate_color_001.inputs[0] + ) + # separate_color.Blue -> math_001.Value + random_x4___mat.links.new(separate_color.outputs[2], math_001.inputs[1]) + # math.Value -> math_001.Value + random_x4___mat.links.new(math.outputs[0], math_001.inputs[0]) + # separate_color_001.Red -> group_output.2 + random_x4___mat.links.new(separate_color_001.outputs[0], group_output.inputs[2]) + # separate_color_001.Green -> group_output.3 + random_x4___mat.links.new(separate_color_001.outputs[1], group_output.inputs[3]) + # object_info.Random -> white_noise_texture_001.W + random_x4___mat.links.new(object_info.outputs[5], white_noise_texture_001.inputs[1]) + # separate_color_001.Blue -> group_output.4 + random_x4___mat.links.new(separate_color_001.outputs[2], group_output.inputs[4]) + return random_x4___mat + + +random_x4___mat = random_x4___mat_node_group() + + +# initialize SolarPanelShader node group +def solarpanelshader_node_group(): + solarpanelshader = bpy.data.node_groups.new( + type="ShaderNodeTree", name="SolarPanelShader" + ) + + solarpanelshader.color_tag = "NONE" + solarpanelshader.description = "" + solarpanelshader.default_group_node_width = 140 + + # solarpanelshader interface + # Socket BSDF + bsdf_socket = solarpanelshader.interface.new_socket( + name="BSDF", in_out="OUTPUT", socket_type="NodeSocketShader" + ) + bsdf_socket.attribute_domain = "POINT" + + # initialize solarpanelshader nodes + # node Group Output + group_output_1 = solarpanelshader.nodes.new("NodeGroupOutput") + group_output_1.name = "Group Output" + group_output_1.is_active_output = True + + # node Frame.002 + frame_002 = solarpanelshader.nodes.new("NodeFrame") + frame_002.label = "Roughness" + frame_002.name = "Frame.002" + frame_002.label_size = 20 + frame_002.shrink = True + + # node Frame.003 + frame_003 = solarpanelshader.nodes.new("NodeFrame") + frame_003.label = "Bump" + frame_003.name = "Frame.003" + frame_003.label_size = 20 + frame_003.shrink = True + + # node Frame.001 + frame_001 = solarpanelshader.nodes.new("NodeFrame") + frame_001.label = "Blue Texture" + frame_001.name = "Frame.001" + frame_001.label_size = 20 + frame_001.shrink = True + + # node Frame + frame = solarpanelshader.nodes.new("NodeFrame") + frame.label = "Grid Texture" + frame.name = "Frame" + frame.label_size = 20 + frame.shrink = True + + # node Noise Texture + noise_texture = solarpanelshader.nodes.new("ShaderNodeTexNoise") + noise_texture.name = "Noise Texture" + noise_texture.noise_dimensions = "4D" + noise_texture.noise_type = "FBM" + noise_texture.normalize = True + # Scale + noise_texture.inputs[2].default_value = 6.0 + # Detail + noise_texture.inputs[3].default_value = 14.999999046325684 + # Roughness + noise_texture.inputs[4].default_value = 0.550000011920929 + # Lacunarity + noise_texture.inputs[5].default_value = 2.0 + # Distortion + noise_texture.inputs[8].default_value = 0.0 + + # node Mix.001 + mix_001 = solarpanelshader.nodes.new("ShaderNodeMix") + mix_001.name = "Mix.001" + mix_001.blend_type = "DARKEN" + mix_001.clamp_factor = True + mix_001.clamp_result = False + mix_001.data_type = "RGBA" + mix_001.factor_mode = "UNIFORM" + # B_Color + mix_001.inputs[7].default_value = (0.0, 0.0, 0.0, 1.0) + + # node Bump.001 + bump_001 = solarpanelshader.nodes.new("ShaderNodeBump") + bump_001.name = "Bump.001" + bump_001.invert = True + # Distance + bump_001.inputs[1].default_value = 1.0 + # Normal + bump_001.inputs[3].default_value = (0.0, 0.0, 0.0) + + # node ColorRamp.004 + colorramp_004 = solarpanelshader.nodes.new("ShaderNodeValToRGB") + colorramp_004.name = "ColorRamp.004" + colorramp_004.color_ramp.color_mode = "RGB" + colorramp_004.color_ramp.hue_interpolation = "NEAR" + colorramp_004.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + colorramp_004.color_ramp.elements.remove(colorramp_004.color_ramp.elements[0]) + colorramp_004_cre_0 = colorramp_004.color_ramp.elements[0] + colorramp_004_cre_0.position = 0.24025972187519073 + colorramp_004_cre_0.alpha = 1.0 + colorramp_004_cre_0.color = ( + 0.20731863379478455, + 0.20731863379478455, + 0.20731863379478455, + 1.0, + ) + + colorramp_004_cre_1 = colorramp_004.color_ramp.elements.new(0.8545454740524292) + colorramp_004_cre_1.alpha = 1.0 + colorramp_004_cre_1.color = ( + 0.9054436087608337, + 0.9054436087608337, + 0.9054436087608337, + 1.0, + ) + + # node Reroute.001 + reroute_001 = solarpanelshader.nodes.new("NodeReroute") + reroute_001.name = "Reroute.001" + reroute_001.socket_idname = "NodeSocketVector" + # node Reroute + reroute = solarpanelshader.nodes.new("NodeReroute") + reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketVector" + # node ColorRamp.001 + colorramp_001 = solarpanelshader.nodes.new("ShaderNodeValToRGB") + colorramp_001.name = "ColorRamp.001" + colorramp_001.color_ramp.color_mode = "RGB" + colorramp_001.color_ramp.hue_interpolation = "NEAR" + colorramp_001.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + colorramp_001.color_ramp.elements.remove(colorramp_001.color_ramp.elements[0]) + colorramp_001_cre_0 = colorramp_001.color_ramp.elements[0] + colorramp_001_cre_0.position = 0.4724999964237213 + colorramp_001_cre_0.alpha = 1.0 + colorramp_001_cre_0.color = (0.0, 0.0, 0.0, 1.0) + + colorramp_001_cre_1 = colorramp_001.color_ramp.elements.new(0.48500001430511475) + colorramp_001_cre_1.alpha = 1.0 + colorramp_001_cre_1.color = (1.0, 1.0, 1.0, 1.0) + + # node Voronoi Texture + voronoi_texture = solarpanelshader.nodes.new("ShaderNodeTexVoronoi") + voronoi_texture.name = "Voronoi Texture" + voronoi_texture.distance = "CHEBYCHEV" + voronoi_texture.feature = "F1" + voronoi_texture.normalize = False + voronoi_texture.voronoi_dimensions = "3D" + # Scale + voronoi_texture.inputs[2].default_value = 2.0 + # Detail + voronoi_texture.inputs[3].default_value = 0.0 + # Roughness + voronoi_texture.inputs[4].default_value = 0.5 + # Lacunarity + voronoi_texture.inputs[5].default_value = 2.0 + # Randomness + voronoi_texture.inputs[8].default_value = 0.0 + + # node Voronoi Texture.001 + voronoi_texture_001 = solarpanelshader.nodes.new("ShaderNodeTexVoronoi") + voronoi_texture_001.name = "Voronoi Texture.001" + voronoi_texture_001.distance = "MANHATTAN" + voronoi_texture_001.feature = "F1" + voronoi_texture_001.normalize = False + voronoi_texture_001.voronoi_dimensions = "3D" + # Scale + voronoi_texture_001.inputs[2].default_value = 2.0 + # Detail + voronoi_texture_001.inputs[3].default_value = 0.0 + # Roughness + voronoi_texture_001.inputs[4].default_value = 0.5 + # Lacunarity + voronoi_texture_001.inputs[5].default_value = 2.0 + # Randomness + voronoi_texture_001.inputs[8].default_value = 0.0 + + # node ColorRamp + colorramp = solarpanelshader.nodes.new("ShaderNodeValToRGB") + colorramp.name = "ColorRamp" + colorramp.color_ramp.color_mode = "RGB" + colorramp.color_ramp.hue_interpolation = "NEAR" + colorramp.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + colorramp.color_ramp.elements.remove(colorramp.color_ramp.elements[0]) + colorramp_cre_0 = colorramp.color_ramp.elements[0] + colorramp_cre_0.position = 0.4749999940395355 + colorramp_cre_0.alpha = 1.0 + colorramp_cre_0.color = (1.0, 1.0, 1.0, 1.0) + + colorramp_cre_1 = colorramp.color_ramp.elements.new(0.48500001430511475) + colorramp_cre_1.alpha = 1.0 + colorramp_cre_1.color = (0.0, 0.0, 0.0, 1.0) + + # node Vector Math + vector_math = solarpanelshader.nodes.new("ShaderNodeVectorMath") + vector_math.name = "Vector Math" + vector_math.operation = "ADD" + # Vector_001 + vector_math.inputs[1].default_value = (0.75, 0.75, 0.0) + + # node Mix + mix = solarpanelshader.nodes.new("ShaderNodeMix") + mix.name = "Mix" + mix.blend_type = "DARKEN" + mix.clamp_factor = True + mix.clamp_result = False + mix.data_type = "RGBA" + mix.factor_mode = "UNIFORM" + # Factor_Float + mix.inputs[0].default_value = 1.0 + + # node Voronoi Texture.002 + voronoi_texture_002 = solarpanelshader.nodes.new("ShaderNodeTexVoronoi") + voronoi_texture_002.name = "Voronoi Texture.002" + voronoi_texture_002.distance = "EUCLIDEAN" + voronoi_texture_002.feature = "F1" + voronoi_texture_002.normalize = False + voronoi_texture_002.voronoi_dimensions = "4D" + # Scale + voronoi_texture_002.inputs[2].default_value = 130.0 + # Detail + voronoi_texture_002.inputs[3].default_value = 0.0 + # Roughness + voronoi_texture_002.inputs[4].default_value = 0.5 + # Lacunarity + voronoi_texture_002.inputs[5].default_value = 2.0 + # Randomness + voronoi_texture_002.inputs[8].default_value = 1.0 + + # node Noise Texture.001 + noise_texture_001 = solarpanelshader.nodes.new("ShaderNodeTexNoise") + noise_texture_001.name = "Noise Texture.001" + noise_texture_001.noise_dimensions = "4D" + noise_texture_001.noise_type = "FBM" + noise_texture_001.normalize = True + # Scale + noise_texture_001.inputs[2].default_value = 2.0 + # Detail + noise_texture_001.inputs[3].default_value = 15.0 + # Roughness + noise_texture_001.inputs[4].default_value = 0.5 + # Lacunarity + noise_texture_001.inputs[5].default_value = 2.0 + # Distortion + noise_texture_001.inputs[8].default_value = 0.0 + + # node ColorRamp.006 + colorramp_006 = solarpanelshader.nodes.new("ShaderNodeValToRGB") + colorramp_006.name = "ColorRamp.006" + colorramp_006.color_ramp.color_mode = "RGB" + colorramp_006.color_ramp.hue_interpolation = "NEAR" + colorramp_006.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + colorramp_006.color_ramp.elements.remove(colorramp_006.color_ramp.elements[0]) + colorramp_006_cre_0 = colorramp_006.color_ramp.elements[0] + colorramp_006_cre_0.position = 0.002597402548417449 + colorramp_006_cre_0.alpha = 1.0 + colorramp_006_cre_0.color = (0.0, 0.027247177436947823, 0.2644347846508026, 1.0) + + colorramp_006_cre_1 = colorramp_006.color_ramp.elements.new(1.0) + colorramp_006_cre_1.alpha = 1.0 + colorramp_006_cre_1.color = (0.0, 0.04002053663134575, 0.19306129217147827, 1.0) + + # node Brick Texture + brick_texture = solarpanelshader.nodes.new("ShaderNodeTexBrick") + brick_texture.name = "Brick Texture" + brick_texture.offset = 0.0 + brick_texture.offset_frequency = 2 + brick_texture.squash = 1.0 + brick_texture.squash_frequency = 2 + # Color1 + brick_texture.inputs[1].default_value = (0.0, 0.0, 0.0, 1.0) + # Color2 + brick_texture.inputs[2].default_value = (0.0, 0.0, 0.0, 1.0) + # Mortar + brick_texture.inputs[3].default_value = (1.0, 1.0, 1.0, 1.0) + # Scale + brick_texture.inputs[4].default_value = 5.0 + # Mortar Size + brick_texture.inputs[5].default_value = 0.009999999776482582 + # Mortar Smooth + brick_texture.inputs[6].default_value = 0.49000000953674316 + # Bias + brick_texture.inputs[7].default_value = 0.0 + # Brick Width + brick_texture.inputs[8].default_value = 0.625 + # Row Height + brick_texture.inputs[9].default_value = 0.20000000298023224 + + # node Mix.003 + mix_003 = solarpanelshader.nodes.new("ShaderNodeMix") + mix_003.name = "Mix.003" + mix_003.blend_type = "LIGHTEN" + mix_003.clamp_factor = True + mix_003.clamp_result = False + mix_003.data_type = "RGBA" + mix_003.factor_mode = "UNIFORM" + # B_Color + mix_003.inputs[7].default_value = ( + 0.22322650253772736, + 0.22322815656661987, + 0.2232280671596527, + 1.0, + ) + + # node Mix.002 + mix_002 = solarpanelshader.nodes.new("ShaderNodeMix") + mix_002.name = "Mix.002" + mix_002.blend_type = "MIX" + mix_002.clamp_factor = True + mix_002.clamp_result = False + mix_002.data_type = "RGBA" + mix_002.factor_mode = "UNIFORM" + # A_Color + mix_002.inputs[6].default_value = ( + 0.22322650253772736, + 0.22322815656661987, + 0.2232280671596527, + 1.0, + ) + + # node ColorRamp.003 + colorramp_003 = solarpanelshader.nodes.new("ShaderNodeValToRGB") + colorramp_003.name = "ColorRamp.003" + colorramp_003.color_ramp.color_mode = "RGB" + colorramp_003.color_ramp.hue_interpolation = "NEAR" + colorramp_003.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + colorramp_003.color_ramp.elements.remove(colorramp_003.color_ramp.elements[0]) + colorramp_003_cre_0 = colorramp_003.color_ramp.elements[0] + colorramp_003_cre_0.position = 0.14025971293449402 + colorramp_003_cre_0.alpha = 1.0 + colorramp_003_cre_0.color = (0.0, 0.0, 0.0, 1.0) + + colorramp_003_cre_1 = colorramp_003.color_ramp.elements.new(0.8181816935539246) + colorramp_003_cre_1.alpha = 1.0 + colorramp_003_cre_1.color = (1.0, 1.0, 1.0, 1.0) + + # node Reroute.002 + reroute_002 = solarpanelshader.nodes.new("NodeReroute") + reroute_002.name = "Reroute.002" + reroute_002.socket_idname = "NodeSocketVector" + # node Texture Coordinate + texture_coordinate = solarpanelshader.nodes.new("ShaderNodeTexCoord") + texture_coordinate.name = "Texture Coordinate" + texture_coordinate.from_instancer = False + + # node Mapping + mapping = solarpanelshader.nodes.new("ShaderNodeMapping") + mapping.name = "Mapping" + mapping.vector_type = "POINT" + # Location + mapping.inputs[1].default_value = (0.0, 0.0, 0.0) + # Rotation + mapping.inputs[2].default_value = (0.0, 0.0, 0.0) + + # node Value + value = solarpanelshader.nodes.new("ShaderNodeValue") + value.name = "Value" + + value.outputs[0].default_value = 3.5 + # node Mix.004 + mix_004 = solarpanelshader.nodes.new("ShaderNodeMix") + mix_004.name = "Mix.004" + mix_004.blend_type = "DARKEN" + mix_004.clamp_factor = True + mix_004.clamp_result = False + mix_004.data_type = "RGBA" + mix_004.factor_mode = "UNIFORM" + # B_Color + mix_004.inputs[7].default_value = ( + 0.00655383663251996, + 0.009497265331447124, + 0.024171071127057076, + 1.0, + ) + + # node Vector Math.001 + vector_math_001 = solarpanelshader.nodes.new("ShaderNodeVectorMath") + vector_math_001.name = "Vector Math.001" + vector_math_001.operation = "MULTIPLY" + # Vector_001 + vector_math_001.inputs[1].default_value = (1.0, 0.6399999856948853, 1.0) + + # node Group + group = solarpanelshader.nodes.new("ShaderNodeGroup") + group.name = "Group" + group.node_tree = random_x4___mat + # Socket_5 + group.inputs[0].default_value = 0.521340012550354 + + # node Principled BSDF.001 + principled_bsdf_001 = solarpanelshader.nodes.new("ShaderNodeBsdfPrincipled") + principled_bsdf_001.name = "Principled BSDF.001" + principled_bsdf_001.distribution = "MULTI_GGX" + principled_bsdf_001.subsurface_method = "RANDOM_WALK" + # Metallic + principled_bsdf_001.inputs[1].default_value = 1.0 + # IOR + principled_bsdf_001.inputs[3].default_value = 1.5 + # Alpha + principled_bsdf_001.inputs[4].default_value = 1.0 + # Diffuse Roughness + principled_bsdf_001.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_001.inputs[8].default_value = 0.0 + # Subsurface Radius + principled_bsdf_001.inputs[9].default_value = ( + 1.0, + 0.20000000298023224, + 0.10000000149011612, + ) + # Subsurface Scale + principled_bsdf_001.inputs[10].default_value = 0.05000000074505806 + # Subsurface Anisotropy + principled_bsdf_001.inputs[12].default_value = 0.0 + # Specular IOR Level + principled_bsdf_001.inputs[13].default_value = 0.5 + # Specular Tint + principled_bsdf_001.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) + # Anisotropic + principled_bsdf_001.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_001.inputs[16].default_value = 0.0 + # Tangent + principled_bsdf_001.inputs[17].default_value = (0.0, 0.0, 0.0) + # Transmission Weight + principled_bsdf_001.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_001.inputs[19].default_value = 0.0 + # Coat Roughness + principled_bsdf_001.inputs[20].default_value = 0.029999999329447746 + # Coat IOR + principled_bsdf_001.inputs[21].default_value = 1.5 + # Coat Tint + principled_bsdf_001.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) + # Coat Normal + principled_bsdf_001.inputs[23].default_value = (0.0, 0.0, 0.0) + # Sheen Weight + principled_bsdf_001.inputs[24].default_value = 0.0 + # Sheen Roughness + principled_bsdf_001.inputs[25].default_value = 0.5 + # Sheen Tint + principled_bsdf_001.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf_001.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Strength + principled_bsdf_001.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf_001.inputs[29].default_value = 0.0 + # Thin Film IOR + principled_bsdf_001.inputs[30].default_value = 1.3300000429153442 + + # node Map Range + map_range = solarpanelshader.nodes.new("ShaderNodeMapRange") + map_range.name = "Map Range" + map_range.clamp = True + map_range.data_type = "FLOAT" + map_range.interpolation_type = "LINEAR" + # From Min + map_range.inputs[1].default_value = 0.0 + # From Max + map_range.inputs[2].default_value = 1.0 + # To Min + map_range.inputs[3].default_value = 0.25 + # To Max + map_range.inputs[4].default_value = 0.550000011920929 + + # Set parents + noise_texture.parent = frame_002 + mix_001.parent = frame_003 + bump_001.parent = frame_003 + colorramp_004.parent = frame_002 + reroute_001.parent = frame_002 + reroute.parent = frame_001 + colorramp_001.parent = frame + voronoi_texture.parent = frame + voronoi_texture_001.parent = frame + colorramp.parent = frame + vector_math.parent = frame + mix.parent = frame + voronoi_texture_002.parent = frame_001 + noise_texture_001.parent = frame_001 + colorramp_006.parent = frame_001 + brick_texture.parent = frame_001 + mix_003.parent = frame_001 + colorramp_003.parent = frame_001 + mix_004.parent = frame_001 + vector_math_001.parent = frame_001 + + # Set locations + group_output_1.location = (1357.573974609375, 281.4519958496094) + frame_002.location = (502.4304504394531, -261.6494140625) + frame_003.location = (264.04486083984375, 122.45939636230469) + frame_001.location = (280.5555419921875, -20.9512939453125) + frame.location = (242.02996826171875, -47.79149627685547) + noise_texture.location = (-571.0491943359375, -530.0728759765625) + mix_001.location = (335.08056640625, -152.2129669189453) + bump_001.location = (527.4110717773438, -169.958984375) + colorramp_004.location = (-354.1903076171875, -536.6217041015625) + reroute_001.location = (-891.3917236328125, -639.0899047851562) + reroute.location = (-813.19140625, 522.2021484375) + colorramp_001.location = (-375.8592224121094, -148.3482208251953) + voronoi_texture.location = (-549.3483276367188, 80.37715911865234) + voronoi_texture_001.location = (-550.72802734375, -264.6904296875) + colorramp.location = (-379.7568359375, 76.08872985839844) + vector_math.location = (-734.3638305664062, -159.66159057617188) + mix.location = (16.777664184570312, 10.651435852050781) + voronoi_texture_002.location = (-680.0263671875, 497.43084716796875) + noise_texture_001.location = (-676.8555297851562, 818.863525390625) + colorramp_006.location = (-490.3884582519531, 539.2119140625) + brick_texture.location = (-49.788970947265625, 533.8572998046875) + mix_003.location = (246.53334045410156, 706.5650634765625) + mix_002.location = (810.5228271484375, 304.9632263183594) + colorramp_003.location = (-493.606201171875, 779.6920166015625) + reroute_002.location = (-665.6483154296875, -141.8559112548828) + texture_coordinate.location = (-1040.4798583984375, -104.36219024658203) + mapping.location = (-854.9619140625, -109.00749206542969) + value.location = (-1038.7108154296875, -353.26104736328125) + mix_004.location = (-225.9229736328125, 734.1510620117188) + vector_math_001.location = (-228.8770751953125, 434.66876220703125) + group.location = (-1440.6337890625, -138.20118713378906) + principled_bsdf_001.location = (1045.4649658203125, 280.4210205078125) + map_range.location = (454.1365051269531, -315.53240966796875) + + # initialize solarpanelshader links + # noise_texture.Fac -> colorramp_004.Fac + solarpanelshader.links.new(noise_texture.outputs[0], colorramp_004.inputs[0]) + # texture_coordinate.Object -> mapping.Vector + solarpanelshader.links.new(texture_coordinate.outputs[3], mapping.inputs[0]) + # voronoi_texture_001.Distance -> colorramp_001.Fac + solarpanelshader.links.new(voronoi_texture_001.outputs[0], colorramp_001.inputs[0]) + # reroute.Output -> voronoi_texture_002.Vector + solarpanelshader.links.new(reroute.outputs[0], voronoi_texture_002.inputs[0]) + # value.Value -> mapping.Scale + solarpanelshader.links.new(value.outputs[0], mapping.inputs[3]) + # colorramp.Color -> mix.A + solarpanelshader.links.new(colorramp.outputs[0], mix.inputs[6]) + # mix.Result -> mix_002.Factor + solarpanelshader.links.new(mix.outputs[2], mix_002.inputs[0]) + # reroute.Output -> noise_texture_001.Vector + solarpanelshader.links.new(reroute.outputs[0], noise_texture_001.inputs[0]) + # colorramp_001.Color -> mix.B + solarpanelshader.links.new(colorramp_001.outputs[0], mix.inputs[7]) + # brick_texture.Color -> mix_003.Factor + solarpanelshader.links.new(brick_texture.outputs[0], mix_003.inputs[0]) + # colorramp_003.Color -> mix_004.Factor + solarpanelshader.links.new(colorramp_003.outputs[0], mix_004.inputs[0]) + # mix_003.Result -> mix_002.B + solarpanelshader.links.new(mix_003.outputs[2], mix_002.inputs[7]) + # colorramp_006.Color -> mix_004.A + solarpanelshader.links.new(colorramp_006.outputs[0], mix_004.inputs[6]) + # voronoi_texture_002.Color -> colorramp_006.Fac + solarpanelshader.links.new(voronoi_texture_002.outputs[1], colorramp_006.inputs[0]) + # noise_texture_001.Fac -> colorramp_003.Fac + solarpanelshader.links.new(noise_texture_001.outputs[0], colorramp_003.inputs[0]) + # vector_math_001.Vector -> brick_texture.Vector + solarpanelshader.links.new(vector_math_001.outputs[0], brick_texture.inputs[0]) + # mix_004.Result -> mix_003.A + solarpanelshader.links.new(mix_004.outputs[2], mix_003.inputs[6]) + # mapping.Vector -> reroute_002.Input + solarpanelshader.links.new(mapping.outputs[0], reroute_002.inputs[0]) + # reroute_002.Output -> voronoi_texture.Vector + solarpanelshader.links.new(reroute_002.outputs[0], voronoi_texture.inputs[0]) + # reroute_001.Output -> noise_texture.Vector + solarpanelshader.links.new(reroute_001.outputs[0], noise_texture.inputs[0]) + # mix_001.Result -> bump_001.Height + solarpanelshader.links.new(mix_001.outputs[2], bump_001.inputs[2]) + # vector_math.Vector -> voronoi_texture_001.Vector + solarpanelshader.links.new(vector_math.outputs[0], voronoi_texture_001.inputs[0]) + # reroute_002.Output -> reroute.Input + solarpanelshader.links.new(reroute_002.outputs[0], reroute.inputs[0]) + # brick_texture.Color -> mix_001.Factor + solarpanelshader.links.new(brick_texture.outputs[0], mix_001.inputs[0]) + # voronoi_texture.Distance -> colorramp.Fac + solarpanelshader.links.new(voronoi_texture.outputs[0], colorramp.inputs[0]) + # reroute_002.Output -> reroute_001.Input + solarpanelshader.links.new(reroute_002.outputs[0], reroute_001.inputs[0]) + # mix.Result -> mix_001.A + solarpanelshader.links.new(mix.outputs[2], mix_001.inputs[6]) + # reroute_002.Output -> vector_math.Vector + solarpanelshader.links.new(reroute_002.outputs[0], vector_math.inputs[0]) + # reroute.Output -> vector_math_001.Vector + solarpanelshader.links.new(reroute.outputs[0], vector_math_001.inputs[0]) + # group.0 -> noise_texture_001.W + solarpanelshader.links.new(group.outputs[0], noise_texture_001.inputs[1]) + # group.1 -> voronoi_texture_002.W + solarpanelshader.links.new(group.outputs[1], voronoi_texture_002.inputs[1]) + # principled_bsdf_001.BSDF -> group_output_1.BSDF + solarpanelshader.links.new(principled_bsdf_001.outputs[0], group_output_1.inputs[0]) + # mix_002.Result -> principled_bsdf_001.Base Color + solarpanelshader.links.new(mix_002.outputs[2], principled_bsdf_001.inputs[0]) + # colorramp_004.Color -> principled_bsdf_001.Roughness + solarpanelshader.links.new(colorramp_004.outputs[0], principled_bsdf_001.inputs[2]) + # bump_001.Normal -> principled_bsdf_001.Normal + solarpanelshader.links.new(bump_001.outputs[0], principled_bsdf_001.inputs[5]) + # group.2 -> noise_texture.W + solarpanelshader.links.new(group.outputs[2], noise_texture.inputs[1]) + # group.3 -> map_range.Value + solarpanelshader.links.new(group.outputs[3], map_range.inputs[0]) + # map_range.Result -> bump_001.Strength + solarpanelshader.links.new(map_range.outputs[0], bump_001.inputs[0]) + return solarpanelshader + + +solarpanelshader = solarpanelshader_node_group() + + +# initialize SolarPanel node group +def solarpanel_node_group(): + solarpanel = mat.node_tree + # start with a clean node tree + for node in solarpanel.nodes: + solarpanel.nodes.remove(node) + solarpanel.color_tag = "NONE" + solarpanel.description = "" + solarpanel.default_group_node_width = 140 + + # solarpanel interface + + # initialize solarpanel nodes + # node Material Output + material_output = solarpanel.nodes.new("ShaderNodeOutputMaterial") + material_output.name = "Material Output" + material_output.is_active_output = True + material_output.target = "ALL" + # Displacement + material_output.inputs[2].default_value = (0.0, 0.0, 0.0) + # Thickness + material_output.inputs[3].default_value = 0.0 + + # node Group + group_1 = solarpanel.nodes.new("ShaderNodeGroup") + group_1.name = "Group" + group_1.node_tree = solarpanelshader + + # Set locations + material_output.location = (1170.1507568359375, 376.55419921875) + group_1.location = (796.747802734375, 443.9368896484375) + + # initialize solarpanel links + # group_1.BSDF -> material_output.Surface + solarpanel.links.new(group_1.outputs[0], material_output.inputs[0]) + return solarpanel + + +solarpanel = solarpanel_node_group() diff --git a/model/object/solar_panel_procgen/material2.py b/model/object/solar_panel_procgen/material2.py new file mode 100644 index 0000000..b06b491 --- /dev/null +++ b/model/object/solar_panel_procgen/material2.py @@ -0,0 +1,500 @@ +import bpy +import mathutils + +mat = bpy.data.materials.new(name="SolarPanelGold") +mat.use_nodes = True + + +# initialize SolarPanelGoldShader node group +def solarpanelgoldshader_node_group(): + solarpanelgoldshader = bpy.data.node_groups.new( + type="ShaderNodeTree", name="SolarPanelGoldShader" + ) + + solarpanelgoldshader.color_tag = "NONE" + solarpanelgoldshader.description = "" + solarpanelgoldshader.default_group_node_width = 140 + + # solarpanelgoldshader interface + # Socket Shader + shader_socket = solarpanelgoldshader.interface.new_socket( + name="Shader", in_out="OUTPUT", socket_type="NodeSocketShader" + ) + shader_socket.attribute_domain = "POINT" + + # Socket Scale + scale_socket = solarpanelgoldshader.interface.new_socket( + name="Scale", in_out="INPUT", socket_type="NodeSocketFloat" + ) + scale_socket.default_value = 1.0 + scale_socket.min_value = -3.4028234663852886e38 + scale_socket.max_value = 3.4028234663852886e38 + scale_socket.subtype = "NONE" + scale_socket.attribute_domain = "POINT" + + # Socket Metallic + metallic_socket = solarpanelgoldshader.interface.new_socket( + name="Metallic", in_out="INPUT", socket_type="NodeSocketFloat" + ) + metallic_socket.default_value = 1.0 + metallic_socket.min_value = 0.0 + metallic_socket.max_value = 1.0 + metallic_socket.subtype = "FACTOR" + metallic_socket.attribute_domain = "POINT" + + # Socket Color 1 + color_1_socket = solarpanelgoldshader.interface.new_socket( + name="Color 1", in_out="INPUT", socket_type="NodeSocketColor" + ) + color_1_socket.default_value = (1.0, 0.3528609871864319, 0.06422899663448334, 1.0) + color_1_socket.attribute_domain = "POINT" + + # Socket Color 2 + color_2_socket = solarpanelgoldshader.interface.new_socket( + name="Color 2", in_out="INPUT", socket_type="NodeSocketColor" + ) + color_2_socket.default_value = ( + 0.01960499957203865, + 0.01960499957203865, + 0.01960499957203865, + 1.0, + ) + color_2_socket.attribute_domain = "POINT" + + # Socket Grid Visibility + grid_visibility_socket = solarpanelgoldshader.interface.new_socket( + name="Grid Visibility", in_out="INPUT", socket_type="NodeSocketFloat" + ) + grid_visibility_socket.default_value = 0.30000001192092896 + grid_visibility_socket.min_value = 0.0 + grid_visibility_socket.max_value = 1.0 + grid_visibility_socket.subtype = "FACTOR" + grid_visibility_socket.attribute_domain = "POINT" + + # Socket Roughness + roughness_socket = solarpanelgoldshader.interface.new_socket( + name="Roughness", in_out="INPUT", socket_type="NodeSocketFloat" + ) + roughness_socket.default_value = 1.0 + roughness_socket.min_value = 0.0 + roughness_socket.max_value = 2.0 + roughness_socket.subtype = "NONE" + roughness_socket.attribute_domain = "POINT" + + # Socket Bump Strength + bump_strength_socket = solarpanelgoldshader.interface.new_socket( + name="Bump Strength", in_out="INPUT", socket_type="NodeSocketFloat" + ) + bump_strength_socket.default_value = 0.20000000298023224 + bump_strength_socket.min_value = 0.0 + bump_strength_socket.max_value = 1.0 + bump_strength_socket.subtype = "FACTOR" + bump_strength_socket.attribute_domain = "POINT" + + # initialize solarpanelgoldshader nodes + # node Group Output + group_output = solarpanelgoldshader.nodes.new("NodeGroupOutput") + group_output.name = "Group Output" + group_output.is_active_output = True + + # node Group Input + group_input = solarpanelgoldshader.nodes.new("NodeGroupInput") + group_input.name = "Group Input" + + # node Principled BSDF + principled_bsdf = solarpanelgoldshader.nodes.new("ShaderNodeBsdfPrincipled") + principled_bsdf.name = "Principled BSDF" + principled_bsdf.distribution = "MULTI_GGX" + principled_bsdf.subsurface_method = "RANDOM_WALK" + # IOR + principled_bsdf.inputs[3].default_value = 1.5 + # Alpha + principled_bsdf.inputs[4].default_value = 1.0 + # Diffuse Roughness + principled_bsdf.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf.inputs[8].default_value = 0.0 + # Subsurface Radius + principled_bsdf.inputs[9].default_value = ( + 1.0, + 0.20000000298023224, + 0.10000000149011612, + ) + # Subsurface Scale + principled_bsdf.inputs[10].default_value = 0.05000000074505806 + # Subsurface Anisotropy + principled_bsdf.inputs[12].default_value = 0.0 + # Specular IOR Level + principled_bsdf.inputs[13].default_value = 0.5 + # Specular Tint + principled_bsdf.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) + # Anisotropic + principled_bsdf.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf.inputs[16].default_value = 0.0 + # Tangent + principled_bsdf.inputs[17].default_value = (0.0, 0.0, 0.0) + # Transmission Weight + principled_bsdf.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf.inputs[19].default_value = 0.0 + # Coat Roughness + principled_bsdf.inputs[20].default_value = 0.029999999329447746 + # Coat IOR + principled_bsdf.inputs[21].default_value = 1.5 + # Coat Tint + principled_bsdf.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) + # Coat Normal + principled_bsdf.inputs[23].default_value = (0.0, 0.0, 0.0) + # Sheen Weight + principled_bsdf.inputs[24].default_value = 0.0 + # Sheen Roughness + principled_bsdf.inputs[25].default_value = 0.5 + # Sheen Tint + principled_bsdf.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Strength + principled_bsdf.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf.inputs[29].default_value = 0.0 + # Thin Film IOR + principled_bsdf.inputs[30].default_value = 1.3300000429153442 + + # node Brick Texture + brick_texture = solarpanelgoldshader.nodes.new("ShaderNodeTexBrick") + brick_texture.name = "Brick Texture" + brick_texture.offset = 1.0 + brick_texture.offset_frequency = 2 + brick_texture.squash = 1.0 + brick_texture.squash_frequency = 2 + # Color1 + brick_texture.inputs[1].default_value = (1.0, 1.0, 1.0, 1.0) + # Color2 + brick_texture.inputs[2].default_value = (1.0, 1.0, 1.0, 1.0) + # Mortar + brick_texture.inputs[3].default_value = (0.0, 0.0, 0.0, 1.0) + # Scale + brick_texture.inputs[4].default_value = 5.0 + # Mortar Size + brick_texture.inputs[5].default_value = 0.019999999552965164 + # Mortar Smooth + brick_texture.inputs[6].default_value = 0.10000000149011612 + # Bias + brick_texture.inputs[7].default_value = 0.0 + # Brick Width + brick_texture.inputs[8].default_value = 0.5 + # Row Height + brick_texture.inputs[9].default_value = 0.25 + + # node Mapping + mapping = solarpanelgoldshader.nodes.new("ShaderNodeMapping") + mapping.name = "Mapping" + mapping.vector_type = "POINT" + # Location + mapping.inputs[1].default_value = (0.0, 0.0, 0.0) + # Rotation + mapping.inputs[2].default_value = (0.0, 0.0, 0.0) + + # node Texture Coordinate + texture_coordinate = solarpanelgoldshader.nodes.new("ShaderNodeTexCoord") + texture_coordinate.name = "Texture Coordinate" + texture_coordinate.from_instancer = False + + # node Brick Texture.001 + brick_texture_001 = solarpanelgoldshader.nodes.new("ShaderNodeTexBrick") + brick_texture_001.name = "Brick Texture.001" + brick_texture_001.offset = 1.0 + brick_texture_001.offset_frequency = 2 + brick_texture_001.squash = 1.0 + brick_texture_001.squash_frequency = 2 + # Color1 + brick_texture_001.inputs[1].default_value = (1.0, 1.0, 1.0, 1.0) + # Color2 + brick_texture_001.inputs[2].default_value = (1.0, 1.0, 1.0, 1.0) + # Mortar + brick_texture_001.inputs[3].default_value = (0.0, 0.0, 0.0, 1.0) + # Scale + brick_texture_001.inputs[4].default_value = 20.0 + # Mortar Size + brick_texture_001.inputs[5].default_value = 0.019999999552965164 + # Mortar Smooth + brick_texture_001.inputs[6].default_value = 0.4000000059604645 + # Bias + brick_texture_001.inputs[7].default_value = 0.0 + # Brick Width + brick_texture_001.inputs[8].default_value = 0.5 + # Row Height + brick_texture_001.inputs[9].default_value = 0.25 + + # node Brick Texture.002 + brick_texture_002 = solarpanelgoldshader.nodes.new("ShaderNodeTexBrick") + brick_texture_002.name = "Brick Texture.002" + brick_texture_002.offset = 1.0 + brick_texture_002.offset_frequency = 2 + brick_texture_002.squash = 1.0 + brick_texture_002.squash_frequency = 2 + # Color1 + brick_texture_002.inputs[1].default_value = (1.0, 1.0, 1.0, 1.0) + # Color2 + brick_texture_002.inputs[2].default_value = (1.0, 1.0, 1.0, 1.0) + # Mortar + brick_texture_002.inputs[3].default_value = (0.0, 0.0, 0.0, 1.0) + # Scale + brick_texture_002.inputs[4].default_value = 120.0 + # Mortar Size + brick_texture_002.inputs[5].default_value = 0.17000000178813934 + # Mortar Smooth + brick_texture_002.inputs[6].default_value = 0.0 + # Bias + brick_texture_002.inputs[7].default_value = 0.0 + # Brick Width + brick_texture_002.inputs[8].default_value = 0.5 + # Row Height + brick_texture_002.inputs[9].default_value = 0.5 + + # node Mix + mix = solarpanelgoldshader.nodes.new("ShaderNodeMix") + mix.name = "Mix" + mix.blend_type = "DARKEN" + mix.clamp_factor = True + mix.clamp_result = False + mix.data_type = "RGBA" + mix.factor_mode = "UNIFORM" + + # node Mix.001 + mix_001 = solarpanelgoldshader.nodes.new("ShaderNodeMix") + mix_001.name = "Mix.001" + mix_001.blend_type = "DARKEN" + mix_001.clamp_factor = True + mix_001.clamp_result = False + mix_001.data_type = "RGBA" + mix_001.factor_mode = "UNIFORM" + # B_Color + mix_001.inputs[7].default_value = (0.0, 0.0, 0.0, 1.0) + + # node Mix.002 + mix_002 = solarpanelgoldshader.nodes.new("ShaderNodeMix") + mix_002.name = "Mix.002" + mix_002.blend_type = "MIX" + mix_002.clamp_factor = True + mix_002.clamp_result = False + mix_002.data_type = "RGBA" + mix_002.factor_mode = "UNIFORM" + + # node Bump + bump = solarpanelgoldshader.nodes.new("ShaderNodeBump") + bump.name = "Bump" + bump.invert = False + # Distance + bump.inputs[1].default_value = 1.0 + # Normal + bump.inputs[3].default_value = (0.0, 0.0, 0.0) + + # node Noise Texture + noise_texture = solarpanelgoldshader.nodes.new("ShaderNodeTexNoise") + noise_texture.name = "Noise Texture" + noise_texture.noise_dimensions = "3D" + noise_texture.noise_type = "FBM" + noise_texture.normalize = True + # Scale + noise_texture.inputs[2].default_value = 50.0 + # Detail + noise_texture.inputs[3].default_value = 15.0 + # Roughness + noise_texture.inputs[4].default_value = 0.6000000238418579 + # Lacunarity + noise_texture.inputs[5].default_value = 2.0 + # Distortion + noise_texture.inputs[8].default_value = 0.0 + + # node Color Ramp + color_ramp = solarpanelgoldshader.nodes.new("ShaderNodeValToRGB") + color_ramp.name = "Color Ramp" + color_ramp.color_ramp.color_mode = "RGB" + color_ramp.color_ramp.hue_interpolation = "NEAR" + color_ramp.color_ramp.interpolation = "LINEAR" + + # initialize color ramp elements + color_ramp.color_ramp.elements.remove(color_ramp.color_ramp.elements[0]) + color_ramp_cre_0 = color_ramp.color_ramp.elements[0] + color_ramp_cre_0.position = 0.26633164286613464 + color_ramp_cre_0.alpha = 1.0 + color_ramp_cre_0.color = (0.0, 0.0, 0.0, 1.0) + + color_ramp_cre_1 = color_ramp.color_ramp.elements.new(1.0) + color_ramp_cre_1.alpha = 1.0 + color_ramp_cre_1.color = ( + 0.47251400351524353, + 0.47251400351524353, + 0.47251400351524353, + 1.0, + ) + + # node Hue/Saturation/Value + hue_saturation_value = solarpanelgoldshader.nodes.new("ShaderNodeHueSaturation") + hue_saturation_value.name = "Hue/Saturation/Value" + # Hue + hue_saturation_value.inputs[0].default_value = 0.5 + # Saturation + hue_saturation_value.inputs[1].default_value = 1.0 + # Fac + hue_saturation_value.inputs[3].default_value = 1.0 + + # node Reroute + reroute = solarpanelgoldshader.nodes.new("NodeReroute") + reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketVector" + # node Mapping.001 + mapping_001 = solarpanelgoldshader.nodes.new("ShaderNodeMapping") + mapping_001.name = "Mapping.001" + mapping_001.vector_type = "POINT" + # Location + mapping_001.inputs[1].default_value = (0.0, 0.0, 0.0) + # Rotation + mapping_001.inputs[2].default_value = (0.0, 0.0, 0.0) + # Scale + mapping_001.inputs[3].default_value = (0.5, 0.5, 0.5) + + # Set locations + group_output.location = (1036.668701171875, 90.20903778076172) + group_input.location = (-832.8428344726562, -371.71112060546875) + principled_bsdf.location = (783.4300537109375, 97.9495620727539) + brick_texture.location = (-265.26287841796875, -376.85113525390625) + mapping.location = (-674.0972290039062, -135.64739990234375) + texture_coordinate.location = (-833.2088012695312, -138.69146728515625) + brick_texture_001.location = (-263.9830322265625, 1.7639760971069336) + brick_texture_002.location = (-265.26287841796875, 382.56854248046875) + mix.location = (-79.95376586914062, -107.19638061523438) + mix_001.location = (81.97224426269531, 102.55508422851562) + mix_002.location = (614.9027709960938, 230.31039428710938) + bump.location = (608.4172973632812, -172.93162536621094) + noise_texture.location = (73.22274017333984, -150.87039184570312) + color_ramp.location = (235.66050720214844, -118.16915893554688) + hue_saturation_value.location = (602.0847778320312, -1.08966064453125) + reroute.location = (-360.4981994628906, -170.269287109375) + mapping_001.location = (-517.1841430664062, -138.0630340576172) + + # initialize solarpanelgoldshader links + # reroute.Output -> brick_texture_002.Vector + solarpanelgoldshader.links.new(reroute.outputs[0], brick_texture_002.inputs[0]) + # brick_texture_001.Color -> mix.A + solarpanelgoldshader.links.new(brick_texture_001.outputs[0], mix.inputs[6]) + # mix_001.Result -> mix_002.Factor + solarpanelgoldshader.links.new(mix_001.outputs[2], mix_002.inputs[0]) + # brick_texture.Color -> mix.B + solarpanelgoldshader.links.new(brick_texture.outputs[0], mix.inputs[7]) + # bump.Normal -> principled_bsdf.Normal + solarpanelgoldshader.links.new(bump.outputs[0], principled_bsdf.inputs[5]) + # mix.Result -> mix_001.A + solarpanelgoldshader.links.new(mix.outputs[2], mix_001.inputs[6]) + # reroute.Output -> noise_texture.Vector + solarpanelgoldshader.links.new(reroute.outputs[0], noise_texture.inputs[0]) + # brick_texture_002.Color -> mix_001.Factor + solarpanelgoldshader.links.new(brick_texture_002.outputs[0], mix_001.inputs[0]) + # mix_001.Result -> bump.Height + solarpanelgoldshader.links.new(mix_001.outputs[2], bump.inputs[2]) + # mix_002.Result -> principled_bsdf.Base Color + solarpanelgoldshader.links.new(mix_002.outputs[2], principled_bsdf.inputs[0]) + # color_ramp.Color -> hue_saturation_value.Color + solarpanelgoldshader.links.new( + color_ramp.outputs[0], hue_saturation_value.inputs[4] + ) + # reroute.Output -> brick_texture.Vector + solarpanelgoldshader.links.new(reroute.outputs[0], brick_texture.inputs[0]) + # hue_saturation_value.Color -> principled_bsdf.Roughness + solarpanelgoldshader.links.new( + hue_saturation_value.outputs[0], principled_bsdf.inputs[2] + ) + # texture_coordinate.Object -> mapping.Vector + solarpanelgoldshader.links.new(texture_coordinate.outputs[3], mapping.inputs[0]) + # noise_texture.Fac -> color_ramp.Fac + solarpanelgoldshader.links.new(noise_texture.outputs[0], color_ramp.inputs[0]) + # reroute.Output -> brick_texture_001.Vector + solarpanelgoldshader.links.new(reroute.outputs[0], brick_texture_001.inputs[0]) + # principled_bsdf.BSDF -> group_output.Shader + solarpanelgoldshader.links.new(principled_bsdf.outputs[0], group_output.inputs[0]) + # group_input.Scale -> mapping.Scale + solarpanelgoldshader.links.new(group_input.outputs[0], mapping.inputs[3]) + # group_input.Metallic -> principled_bsdf.Metallic + solarpanelgoldshader.links.new(group_input.outputs[1], principled_bsdf.inputs[1]) + # group_input.Color 1 -> mix_002.A + solarpanelgoldshader.links.new(group_input.outputs[2], mix_002.inputs[6]) + # group_input.Color 2 -> mix_002.B + solarpanelgoldshader.links.new(group_input.outputs[3], mix_002.inputs[7]) + # group_input.Grid Visibility -> mix.Factor + solarpanelgoldshader.links.new(group_input.outputs[4], mix.inputs[0]) + # group_input.Roughness -> hue_saturation_value.Value + solarpanelgoldshader.links.new( + group_input.outputs[5], hue_saturation_value.inputs[2] + ) + # group_input.Bump Strength -> bump.Strength + solarpanelgoldshader.links.new(group_input.outputs[6], bump.inputs[0]) + # mapping_001.Vector -> reroute.Input + solarpanelgoldshader.links.new(mapping_001.outputs[0], reroute.inputs[0]) + # mapping.Vector -> mapping_001.Vector + solarpanelgoldshader.links.new(mapping.outputs[0], mapping_001.inputs[0]) + return solarpanelgoldshader + + +solarpanelgoldshader = solarpanelgoldshader_node_group() + + +# initialize SolarPanelGold node group +def solarpanelgold_node_group(): + solarpanelgold = mat.node_tree + # start with a clean node tree + for node in solarpanelgold.nodes: + solarpanelgold.nodes.remove(node) + solarpanelgold.color_tag = "NONE" + solarpanelgold.description = "" + solarpanelgold.default_group_node_width = 140 + + # solarpanelgold interface + + # initialize solarpanelgold nodes + # node Material Output + material_output = solarpanelgold.nodes.new("ShaderNodeOutputMaterial") + material_output.name = "Material Output" + material_output.is_active_output = True + material_output.target = "ALL" + # Displacement + material_output.inputs[2].default_value = (0.0, 0.0, 0.0) + # Thickness + material_output.inputs[3].default_value = 0.0 + + # node Group + group = solarpanelgold.nodes.new("ShaderNodeGroup") + group.name = "Group" + group.node_tree = solarpanelgoldshader + # Socket_1 + group.inputs[0].default_value = 1.0 + # Socket_2 + group.inputs[1].default_value = 1.0 + # Socket_3 + group.inputs[2].default_value = (1.0, 0.3528609871864319, 0.06422899663448334, 1.0) + # Socket_4 + group.inputs[3].default_value = ( + 0.01960499957203865, + 0.01960499957203865, + 0.01960499957203865, + 1.0, + ) + # Socket_5 + group.inputs[4].default_value = 0.30000001192092896 + # Socket_6 + group.inputs[5].default_value = 1.0 + # Socket_7 + group.inputs[6].default_value = 0.20000000298023224 + + # Set locations + material_output.location = (989.0977172851562, 506.0550231933594) + group.location = (735.8889770507812, 512.1011962890625) + + # initialize solarpanelgold links + # group.Shader -> material_output.Surface + solarpanelgold.links.new(group.outputs[0], material_output.inputs[0]) + return solarpanelgold + + +solarpanelgold = solarpanelgold_node_group() diff --git a/model/terrain/lunar_surface_procgen/geometry.py b/model/terrain/lunar_surface_procgen/geometry.py index e3a6a6b..c0a67e7 100644 --- a/model/terrain/lunar_surface_procgen/geometry.py +++ b/model/terrain/lunar_surface_procgen/geometry.py @@ -1,4 +1,5 @@ import bpy +import mathutils # initialize random__uniform_ node group @@ -9,6 +10,7 @@ def random__uniform__node_group(): random__uniform_.color_tag = "NONE" random__uniform_.description = "" + random__uniform_.default_group_node_width = 140 # random__uniform_ interface # Socket Value @@ -107,6 +109,7 @@ def random__normal__node_group(): random__normal_.color_tag = "NONE" random__normal_.description = "" + random__normal_.default_group_node_width = 140 # random__normal_ interface # Socket Value @@ -381,6 +384,7 @@ def lunarrock_node_group(): lunarrock.color_tag = "GEOMETRY" lunarrock.description = "" + lunarrock.default_group_node_width = 140 lunarrock.is_modifier = True @@ -599,6 +603,7 @@ def lunarrock_node_group(): # node Reroute.001 reroute_001 = lunarrock.nodes.new("NodeReroute") reroute_001.name = "Reroute.001" + reroute_001.socket_idname = "NodeSocketFloat" # node Transform Geometry transform_geometry = lunarrock.nodes.new("GeometryNodeTransform") transform_geometry.name = "Transform Geometry" @@ -611,6 +616,7 @@ def lunarrock_node_group(): # node Reroute.002 reroute_002 = lunarrock.nodes.new("NodeReroute") reroute_002.name = "Reroute.002" + reroute_002.socket_idname = "NodeSocketInt" # node Attribute Statistic attribute_statistic = lunarrock.nodes.new("GeometryNodeAttributeStatistic") attribute_statistic.name = "Attribute Statistic" @@ -632,6 +638,7 @@ def lunarrock_node_group(): # node Reroute.003 reroute_003 = lunarrock.nodes.new("NodeReroute") reroute_003.name = "Reroute.003" + reroute_003.socket_idname = "NodeSocketGeometry" # node Vector Math.002 vector_math_002 = lunarrock.nodes.new("ShaderNodeVectorMath") vector_math_002.name = "Vector Math.002" @@ -745,6 +752,7 @@ def lunarrock_node_group(): # node Reroute.005 reroute_005 = lunarrock.nodes.new("NodeReroute") reroute_005.name = "Reroute.005" + reroute_005.socket_idname = "NodeSocketFloat" # node Group.003 group_003 = lunarrock.nodes.new("GeometryNodeGroup") group_003.name = "Group.003" @@ -774,9 +782,11 @@ def lunarrock_node_group(): # node Reroute.006 reroute_006 = lunarrock.nodes.new("NodeReroute") reroute_006.name = "Reroute.006" + reroute_006.socket_idname = "NodeSocketFloat" # node Reroute reroute = lunarrock.nodes.new("NodeReroute") reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketVectorXYZ" # node Group.007 group_007 = lunarrock.nodes.new("GeometryNodeGroup") group_007.name = "Group.007" @@ -979,6 +989,7 @@ def lunarrock_node_group(): # node Reroute.010 reroute_010 = lunarrock.nodes.new("NodeReroute") reroute_010.name = "Reroute.010" + reroute_010.socket_idname = "NodeSocketBool" # node Cube.001 cube_001 = lunarrock.nodes.new("GeometryNodeMeshCube") cube_001.name = "Cube.001" @@ -1002,6 +1013,7 @@ def lunarrock_node_group(): # node Reroute.004 reroute_004 = lunarrock.nodes.new("NodeReroute") reroute_004.name = "Reroute.004" + reroute_004.socket_idname = "NodeSocketGeometry" # node Frame.004 frame_004 = lunarrock.nodes.new("NodeFrame") frame_004.name = "Frame.004" @@ -1011,9 +1023,11 @@ def lunarrock_node_group(): # node Reroute.012 reroute_012 = lunarrock.nodes.new("NodeReroute") reroute_012.name = "Reroute.012" + reroute_012.socket_idname = "NodeSocketFloatDistance" # node Reroute.013 reroute_013 = lunarrock.nodes.new("NodeReroute") reroute_013.name = "Reroute.013" + reroute_013.socket_idname = "NodeSocketFloatDistance" # node Transform Geometry.003 transform_geometry_003 = lunarrock.nodes.new("GeometryNodeTransform") transform_geometry_003.name = "Transform Geometry.003" @@ -1060,6 +1074,7 @@ def lunarrock_node_group(): # node Reroute.015 reroute_015 = lunarrock.nodes.new("NodeReroute") reroute_015.name = "Reroute.015" + reroute_015.socket_idname = "NodeSocketFloat" # node Separate XYZ separate_xyz = lunarrock.nodes.new("ShaderNodeSeparateXYZ") separate_xyz.name = "Separate XYZ" @@ -1071,21 +1086,27 @@ def lunarrock_node_group(): # node Reroute.017 reroute_017 = lunarrock.nodes.new("NodeReroute") reroute_017.name = "Reroute.017" + reroute_017.socket_idname = "NodeSocketVectorXYZ" # node Reroute.018 reroute_018 = lunarrock.nodes.new("NodeReroute") reroute_018.name = "Reroute.018" + reroute_018.socket_idname = "NodeSocketVectorXYZ" # node Reroute.019 reroute_019 = lunarrock.nodes.new("NodeReroute") reroute_019.name = "Reroute.019" + reroute_019.socket_idname = "NodeSocketVectorXYZ" # node Reroute.020 reroute_020 = lunarrock.nodes.new("NodeReroute") reroute_020.name = "Reroute.020" + reroute_020.socket_idname = "NodeSocketFloat" # node Reroute.021 reroute_021 = lunarrock.nodes.new("NodeReroute") reroute_021.name = "Reroute.021" + reroute_021.socket_idname = "NodeSocketBool" # node Reroute.022 reroute_022 = lunarrock.nodes.new("NodeReroute") reroute_022.name = "Reroute.022" + reroute_022.socket_idname = "NodeSocketFloatDistance" # node Frame.005 frame_005 = lunarrock.nodes.new("NodeFrame") frame_005.name = "Frame.005" @@ -1481,6 +1502,7 @@ def crater_profile_node_group(): crater_profile.color_tag = "NONE" crater_profile.description = "" + crater_profile.default_group_node_width = 140 # crater_profile interface # Socket Value @@ -1619,6 +1641,7 @@ def crater_profile_node_group(): # node Reroute.002 reroute_002_1 = crater_profile.nodes.new("NodeReroute") reroute_002_1.name = "Reroute.002" + reroute_002_1.socket_idname = "NodeSocketInt" # node Integer integer_1 = crater_profile.nodes.new("FunctionNodeInputInt") integer_1.label = "Max N" @@ -1836,6 +1859,7 @@ def crater_profile_node_group(): # node Reroute.003 reroute_003_1 = crater_profile.nodes.new("NodeReroute") reroute_003_1.name = "Reroute.003" + reroute_003_1.socket_idname = "NodeSocketFloat" # node Math.005 math_005_1 = crater_profile.nodes.new("ShaderNodeMath") math_005_1.name = "Math.005" @@ -2029,6 +2053,7 @@ def lunarterrain_node_group(): lunarterrain.color_tag = "NONE" lunarterrain.description = "" + lunarterrain.default_group_node_width = 140 lunarterrain.is_modifier = True @@ -2203,6 +2228,7 @@ def lunarterrain_node_group(): # node Reroute.001 reroute_001_1 = lunarterrain.nodes.new("NodeReroute") reroute_001_1.name = "Reroute.001" + reroute_001_1.socket_idname = "NodeSocketGeometry" # node Vector Math.002 vector_math_002_1 = lunarterrain.nodes.new("ShaderNodeVectorMath") vector_math_002_1.name = "Vector Math.002" @@ -2235,6 +2261,7 @@ def lunarterrain_node_group(): # node Reroute.003 reroute_003_2 = lunarterrain.nodes.new("NodeReroute") reroute_003_2.name = "Reroute.003" + reroute_003_2.socket_idname = "NodeSocketFloat" # node Compare compare_1 = lunarterrain.nodes.new("FunctionNodeCompare") compare_1.name = "Compare" @@ -2262,6 +2289,7 @@ def lunarterrain_node_group(): # node Reroute.005 reroute_005_1 = lunarterrain.nodes.new("NodeReroute") reroute_005_1.name = "Reroute.005" + reroute_005_1.socket_idname = "NodeSocketVectorXYZ" # node Float to Integer float_to_integer_1 = lunarterrain.nodes.new("FunctionNodeFloatToInt") float_to_integer_1.name = "Float to Integer" @@ -2302,6 +2330,7 @@ def lunarterrain_node_group(): # node Reroute.007 reroute_007 = lunarterrain.nodes.new("NodeReroute") reroute_007.name = "Reroute.007" + reroute_007.socket_idname = "NodeSocketGeometry" # node Vector Math.028 vector_math_028 = lunarterrain.nodes.new("ShaderNodeVectorMath") vector_math_028.name = "Vector Math.028" @@ -2317,12 +2346,15 @@ def lunarterrain_node_group(): # node Reroute.008 reroute_008 = lunarterrain.nodes.new("NodeReroute") reroute_008.name = "Reroute.008" + reroute_008.socket_idname = "NodeSocketVectorXYZ" # node Reroute.006 reroute_006_1 = lunarterrain.nodes.new("NodeReroute") reroute_006_1.name = "Reroute.006" + reroute_006_1.socket_idname = "NodeSocketFloat" # node Reroute.004 reroute_004_1 = lunarterrain.nodes.new("NodeReroute") reroute_004_1.name = "Reroute.004" + reroute_004_1.socket_idname = "NodeSocketFloat" # node Noise Texture.009 noise_texture_009 = lunarterrain.nodes.new("ShaderNodeTexNoise") noise_texture_009.name = "Noise Texture.009" @@ -2348,6 +2380,7 @@ def lunarterrain_node_group(): # node Reroute.009 reroute_009 = lunarterrain.nodes.new("NodeReroute") reroute_009.name = "Reroute.009" + reroute_009.socket_idname = "NodeSocketInt" # node Group group_2 = lunarterrain.nodes.new("GeometryNodeGroup") group_2.name = "Group" @@ -2433,6 +2466,7 @@ def lunarterrain_node_group(): # node Reroute.010 reroute_010_1 = lunarterrain.nodes.new("NodeReroute") reroute_010_1.name = "Reroute.010" + reroute_010_1.socket_idname = "NodeSocketInt" # node Group.018 group_018 = lunarterrain.nodes.new("GeometryNodeGroup") group_018.name = "Group.018" @@ -2505,6 +2539,7 @@ def lunarterrain_node_group(): # node Reroute.011 reroute_011 = lunarterrain.nodes.new("NodeReroute") reroute_011.name = "Reroute.011" + reroute_011.socket_idname = "NodeSocketInt" # node Group.022 group_022_1 = lunarterrain.nodes.new("GeometryNodeGroup") group_022_1.name = "Group.022" @@ -2645,6 +2680,7 @@ def lunarterrain_node_group(): # node Reroute reroute_1 = lunarterrain.nodes.new("NodeReroute") reroute_1.name = "Reroute" + reroute_1.socket_idname = "NodeSocketVectorXYZ" # node Frame.007 frame_007 = lunarterrain.nodes.new("NodeFrame") frame_007.label = "Surface displacement" @@ -2655,6 +2691,7 @@ def lunarterrain_node_group(): # node Reroute.012 reroute_012_1 = lunarterrain.nodes.new("NodeReroute") reroute_012_1.name = "Reroute.012" + reroute_012_1.socket_idname = "NodeSocketInt" # node Transform Geometry.002 transform_geometry_002_1 = lunarterrain.nodes.new("GeometryNodeTransform") transform_geometry_002_1.name = "Transform Geometry.002" @@ -2690,6 +2727,7 @@ def lunarterrain_node_group(): # node Reroute.013 reroute_013_1 = lunarterrain.nodes.new("NodeReroute") reroute_013_1.name = "Reroute.013" + reroute_013_1.socket_idname = "NodeSocketGeometry" # node Vector Math.030 vector_math_030 = lunarterrain.nodes.new("ShaderNodeVectorMath") vector_math_030.name = "Vector Math.030" @@ -2764,12 +2802,15 @@ def lunarterrain_node_group(): # node Reroute.002 reroute_002_2 = lunarterrain.nodes.new("NodeReroute") reroute_002_2.name = "Reroute.002" + reroute_002_2.socket_idname = "NodeSocketInt" # node Reroute.014 reroute_014 = lunarterrain.nodes.new("NodeReroute") reroute_014.name = "Reroute.014" + reroute_014.socket_idname = "NodeSocketInt" # node Reroute.015 reroute_015_1 = lunarterrain.nodes.new("NodeReroute") reroute_015_1.name = "Reroute.015" + reroute_015_1.socket_idname = "NodeSocketFloat" # node Group.002 group_002_1 = lunarterrain.nodes.new("GeometryNodeGroup") group_002_1.name = "Group.002" @@ -2825,6 +2866,7 @@ def lunarterrain_node_group(): # node Reroute.016 reroute_016 = lunarterrain.nodes.new("NodeReroute") reroute_016.name = "Reroute.016" + reroute_016.socket_idname = "NodeSocketInt" # node Group.001 group_001_1 = lunarterrain.nodes.new("GeometryNodeGroup") group_001_1.name = "Group.001" @@ -2933,10 +2975,12 @@ def lunarterrain_node_group(): reroute_018_1 = lunarterrain.nodes.new("NodeReroute") reroute_018_1.label = "Index" reroute_018_1.name = "Reroute.018" + reroute_018_1.socket_idname = "NodeSocketFloat" # node Reroute.019 reroute_019_1 = lunarterrain.nodes.new("NodeReroute") reroute_019_1.label = "Seed" reroute_019_1.name = "Reroute.019" + reroute_019_1.socket_idname = "NodeSocketFloat" # node Group.007 group_007_1 = lunarterrain.nodes.new("GeometryNodeGroup") group_007_1.name = "Group.007" @@ -3291,18 +3335,23 @@ def lunarterrain_node_group(): # node Reroute.017 reroute_017_1 = lunarterrain.nodes.new("NodeReroute") reroute_017_1.name = "Reroute.017" + reroute_017_1.socket_idname = "NodeSocketGeometry" # node Reroute.020 reroute_020_1 = lunarterrain.nodes.new("NodeReroute") reroute_020_1.name = "Reroute.020" + reroute_020_1.socket_idname = "NodeSocketGeometry" # node Reroute.021 reroute_021_1 = lunarterrain.nodes.new("NodeReroute") reroute_021_1.name = "Reroute.021" + reroute_021_1.socket_idname = "NodeSocketFloat" # node Reroute.022 reroute_022_1 = lunarterrain.nodes.new("NodeReroute") reroute_022_1.name = "Reroute.022" + reroute_022_1.socket_idname = "NodeSocketVector" # node Reroute.023 reroute_023 = lunarterrain.nodes.new("NodeReroute") reroute_023.name = "Reroute.023" + reroute_023.socket_idname = "NodeSocketFloat" # node Store Named Attribute store_named_attribute = lunarterrain.nodes.new("GeometryNodeStoreNamedAttribute") store_named_attribute.name = "Store Named Attribute" @@ -3368,9 +3417,11 @@ def lunarterrain_node_group(): # node Reroute.025 reroute_025 = lunarterrain.nodes.new("NodeReroute") reroute_025.name = "Reroute.025" + reroute_025.socket_idname = "NodeSocketFloat" # node Reroute.026 reroute_026 = lunarterrain.nodes.new("NodeReroute") reroute_026.name = "Reroute.026" + reroute_026.socket_idname = "NodeSocketInt" # node Position.007 position_007 = lunarterrain.nodes.new("GeometryNodeInputPosition") position_007.name = "Position.007" @@ -3383,6 +3434,7 @@ def lunarterrain_node_group(): # node Reroute.027 reroute_027 = lunarterrain.nodes.new("NodeReroute") reroute_027.name = "Reroute.027" + reroute_027.socket_idname = "NodeSocketFloat" # node Math.024 math_024 = lunarterrain.nodes.new("ShaderNodeMath") math_024.name = "Math.024" @@ -3414,21 +3466,27 @@ def lunarterrain_node_group(): # node Reroute.028 reroute_028 = lunarterrain.nodes.new("NodeReroute") reroute_028.name = "Reroute.028" + reroute_028.socket_idname = "NodeSocketGeometry" # node Reroute.031 reroute_031 = lunarterrain.nodes.new("NodeReroute") reroute_031.name = "Reroute.031" + reroute_031.socket_idname = "NodeSocketInt" # node Reroute.033 reroute_033 = lunarterrain.nodes.new("NodeReroute") reroute_033.name = "Reroute.033" + reroute_033.socket_idname = "NodeSocketGeometry" # node Reroute.032 reroute_032 = lunarterrain.nodes.new("NodeReroute") reroute_032.name = "Reroute.032" + reroute_032.socket_idname = "NodeSocketVectorXYZ" # node Reroute.029 reroute_029 = lunarterrain.nodes.new("NodeReroute") reroute_029.name = "Reroute.029" + reroute_029.socket_idname = "NodeSocketInt" # node Reroute.030 reroute_030 = lunarterrain.nodes.new("NodeReroute") reroute_030.name = "Reroute.030" + reroute_030.socket_idname = "NodeSocketInt" # node Frame.009 frame_009 = lunarterrain.nodes.new("NodeFrame") frame_009.name = "Frame.009" @@ -3448,6 +3506,7 @@ def lunarterrain_node_group(): # node Reroute.024 reroute_024 = lunarterrain.nodes.new("NodeReroute") reroute_024.name = "Reroute.024" + reroute_024.socket_idname = "NodeSocketFloat" # node Frame.019 frame_019 = lunarterrain.nodes.new("NodeFrame") frame_019.label = "Max crater size" @@ -3458,6 +3517,7 @@ def lunarterrain_node_group(): # node Reroute.035 reroute_035 = lunarterrain.nodes.new("NodeReroute") reroute_035.name = "Reroute.035" + reroute_035.socket_idname = "NodeSocketFloat" # node Boolean Math.001 boolean_math_001 = lunarterrain.nodes.new("FunctionNodeBooleanMath") boolean_math_001.name = "Boolean Math.001" @@ -3485,6 +3545,7 @@ def lunarterrain_node_group(): # node Reroute.034 reroute_034 = lunarterrain.nodes.new("NodeReroute") reroute_034.name = "Reroute.034" + reroute_034.socket_idname = "NodeSocketFloat" # node Mix.002 mix_002 = lunarterrain.nodes.new("ShaderNodeMix") mix_002.name = "Mix.002" @@ -3555,6 +3616,7 @@ def lunarterrain_node_group(): # node Reroute.036 reroute_036 = lunarterrain.nodes.new("NodeReroute") reroute_036.name = "Reroute.036" + reroute_036.socket_idname = "NodeSocketInt" # node Math.029 math_029 = lunarterrain.nodes.new("ShaderNodeMath") math_029.name = "Math.029" @@ -3634,9 +3696,11 @@ def lunarterrain_node_group(): # node Reroute.040 reroute_040 = lunarterrain.nodes.new("NodeReroute") reroute_040.name = "Reroute.040" + reroute_040.socket_idname = "NodeSocketFloat" # node Reroute.038 reroute_038 = lunarterrain.nodes.new("NodeReroute") reroute_038.name = "Reroute.038" + reroute_038.socket_idname = "NodeSocketFloat" # node Math.030 math_030 = lunarterrain.nodes.new("ShaderNodeMath") math_030.name = "Math.030" @@ -3668,12 +3732,15 @@ def lunarterrain_node_group(): # node Reroute.037 reroute_037 = lunarterrain.nodes.new("NodeReroute") reroute_037.name = "Reroute.037" + reroute_037.socket_idname = "NodeSocketGeometry" # node Reroute.039 reroute_039 = lunarterrain.nodes.new("NodeReroute") reroute_039.name = "Reroute.039" + reroute_039.socket_idname = "NodeSocketBool" # node Reroute.041 reroute_041 = lunarterrain.nodes.new("NodeReroute") reroute_041.name = "Reroute.041" + reroute_041.socket_idname = "NodeSocketBool" # node Value value = lunarterrain.nodes.new("ShaderNodeValue") value.label = "Rock Size Limit" @@ -4364,7 +4431,7 @@ def lunarterrain_node_group(): # math_004_2.Value -> math_005_2.Value lunarterrain.links.new(math_004_2.outputs[0], math_005_2.inputs[0]) # repeat_input.Point Index -> math_004_2.Value - lunarterrain.links.new(repeat_input.outputs[1], math_004_2.inputs[0]) + lunarterrain.links.new(repeat_input.outputs[2], math_004_2.inputs[0]) # reroute_019_1.Output -> group_007_1.Seed lunarterrain.links.new(reroute_019_1.outputs[0], group_007_1.inputs[2]) # reroute_019_1.Output -> group_001_1.Seed @@ -4396,7 +4463,7 @@ def lunarterrain_node_group(): # separate_xyz_002_1.Y -> math_008_1.Value lunarterrain.links.new(separate_xyz_002_1.outputs[1], math_008_1.inputs[0]) # repeat_input.Geometry -> join_geometry_001.Geometry - lunarterrain.links.new(repeat_input.outputs[0], join_geometry_001.inputs[0]) + lunarterrain.links.new(repeat_input.outputs[1], join_geometry_001.inputs[0]) # reroute_036.Output -> distribute_points_on_faces.Seed lunarterrain.links.new(reroute_036.outputs[0], distribute_points_on_faces.inputs[6]) # reroute_031.Output -> group_006_1.Seed @@ -4685,7 +4752,7 @@ def lunarterrain_node_group(): lunarterrain.links.new(join_geometry.outputs[0], switch_2.inputs[1]) # reroute_033.Output -> reroute_037.Input lunarterrain.links.new(reroute_033.outputs[0], reroute_037.inputs[0]) - # repeat_output.Geometry -> mesh_boolean_1.Mesh 2 + # repeat_output.Geometry -> mesh_boolean_1.Mesh lunarterrain.links.new(repeat_output.outputs[0], mesh_boolean_1.inputs[1]) # mesh_boolean_1.Mesh -> switch_2.True lunarterrain.links.new(mesh_boolean_1.outputs[0], switch_2.inputs[2]) @@ -4703,7 +4770,7 @@ def lunarterrain_node_group(): ) # reroute_037.Output -> join_geometry.Geometry lunarterrain.links.new(reroute_037.outputs[0], join_geometry.inputs[0]) - # reroute_037.Output -> mesh_boolean_1.Mesh 2 + # reroute_037.Output -> mesh_boolean_1.Mesh lunarterrain.links.new(reroute_037.outputs[0], mesh_boolean_1.inputs[1]) return lunarterrain diff --git a/model/terrain/lunar_surface_procgen/material.py b/model/terrain/lunar_surface_procgen/material.py index 2b3aafa..95367a1 100644 --- a/model/terrain/lunar_surface_procgen/material.py +++ b/model/terrain/lunar_surface_procgen/material.py @@ -1,4 +1,5 @@ import bpy +import mathutils mat = bpy.data.materials.new(name="LunarSurface") mat.use_nodes = True @@ -12,6 +13,7 @@ def random_x4___mat_node_group(): random_x4___mat.color_tag = "NONE" random_x4___mat.description = "" + random_x4___mat.default_group_node_width = 140 # random_x4___mat interface # Socket 0 @@ -178,6 +180,7 @@ def rockygroundshader_node_group(): rockygroundshader.color_tag = "NONE" rockygroundshader.description = "" + rockygroundshader.default_group_node_width = 140 # rockygroundshader interface # Socket Shader @@ -784,54 +787,56 @@ def rockygroundshader_node_group(): principled_bsdf.inputs[3].default_value = 1.4500000476837158 # Alpha principled_bsdf.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf.inputs[8].default_value = ( + principled_bsdf.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf.inputs[9].default_value = 0.05000000074505806 + principled_bsdf.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf.inputs[11].default_value = 0.0 + principled_bsdf.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf.inputs[12].default_value = 0.5 + principled_bsdf.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf.inputs[16].default_value = 0.0 # Tangent - principled_bsdf.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf.inputs[19].default_value = 0.029999999329447746 + principled_bsdf.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf.inputs[20].default_value = 1.5 + principled_bsdf.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf.inputs[23].default_value = 0.0 + principled_bsdf.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf.inputs[24].default_value = 0.5 + principled_bsdf.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf.inputs[29].default_value = 1.3300000429153442 + principled_bsdf.inputs[30].default_value = 1.3300000429153442 # node Noise Texture.006 noise_texture_006 = rockygroundshader.nodes.new("ShaderNodeTexNoise") @@ -1337,6 +1342,7 @@ def lunarsurfaceshader_node_group(): lunarsurfaceshader.color_tag = "NONE" lunarsurfaceshader.description = "" + lunarsurfaceshader.default_group_node_width = 140 # lunarsurfaceshader interface # Socket BSDF @@ -1520,54 +1526,56 @@ def lunarsurfaceshader_node_group(): principled_bsdf_1.inputs[3].default_value = 1.5 # Alpha principled_bsdf_1.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_1.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_1.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_1.inputs[8].default_value = ( + principled_bsdf_1.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_1.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_1.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf_1.inputs[11].default_value = 0.0 + principled_bsdf_1.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_1.inputs[12].default_value = 0.5 + principled_bsdf_1.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_1.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_1.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_1.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_1.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_1.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_1.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_1.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_1.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_1.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_1.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_1.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_1.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_1.inputs[20].default_value = 1.5 + principled_bsdf_1.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_1.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_1.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_1.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_1.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_1.inputs[23].default_value = 0.0 + principled_bsdf_1.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_1.inputs[24].default_value = 0.5 + principled_bsdf_1.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_1.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf_1.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf_1.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf_1.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf_1.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf_1.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_1.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_1.inputs[30].default_value = 1.3300000429153442 # node Noise Texture noise_texture_1 = lunarsurfaceshader.nodes.new("ShaderNodeTexNoise") @@ -1945,6 +1953,7 @@ def random_x8___mat_node_group(): random_x8___mat.color_tag = "NONE" random_x8___mat.description = "" + random_x8___mat.default_group_node_width = 140 # random_x8___mat interface # Socket 0 @@ -2229,6 +2238,7 @@ def sandshader_node_group(): sandshader.color_tag = "NONE" sandshader.description = "" + sandshader.default_group_node_width = 140 # sandshader interface # Socket BSDF @@ -2359,54 +2369,56 @@ def sandshader_node_group(): principled_bsdf_2.inputs[3].default_value = 1.5 # Alpha principled_bsdf_2.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_2.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_2.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_2.inputs[8].default_value = ( + principled_bsdf_2.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_2.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_2.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf_2.inputs[11].default_value = 0.0 + principled_bsdf_2.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_2.inputs[12].default_value = 0.5 + principled_bsdf_2.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_2.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_2.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_2.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_2.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_2.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_2.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_2.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_2.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_2.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_2.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_2.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_2.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_2.inputs[20].default_value = 1.5 + principled_bsdf_2.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_2.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_2.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_2.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_2.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_2.inputs[23].default_value = 0.0 + principled_bsdf_2.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_2.inputs[24].default_value = 0.5 + principled_bsdf_2.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_2.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf_2.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf_2.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf_2.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf_2.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf_2.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_2.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_2.inputs[30].default_value = 1.3300000429153442 # node Mapping mapping_2 = sandshader.nodes.new("ShaderNodeMapping") @@ -2684,6 +2696,7 @@ def smoothrockshader_node_group(): smoothrockshader.color_tag = "NONE" smoothrockshader.description = "" + smoothrockshader.default_group_node_width = 140 # smoothrockshader interface # Socket BSDF @@ -2827,54 +2840,56 @@ def smoothrockshader_node_group(): principled_bsdf_3.inputs[3].default_value = 1.5 # Alpha principled_bsdf_3.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_3.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_3.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_3.inputs[8].default_value = ( + principled_bsdf_3.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_3.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_3.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf_3.inputs[11].default_value = 0.0 + principled_bsdf_3.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_3.inputs[12].default_value = 0.5 + principled_bsdf_3.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_3.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_3.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_3.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_3.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_3.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_3.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_3.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_3.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_3.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_3.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_3.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_3.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_3.inputs[20].default_value = 1.5 + principled_bsdf_3.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_3.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_3.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_3.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_3.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_3.inputs[23].default_value = 0.0 + principled_bsdf_3.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_3.inputs[24].default_value = 0.5 + principled_bsdf_3.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_3.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf_3.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf_3.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf_3.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf_3.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf_3.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_3.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_3.inputs[30].default_value = 1.3300000429153442 # node Mapping mapping_3 = smoothrockshader.nodes.new("ShaderNodeMapping") @@ -3105,6 +3120,7 @@ def random_x2___mat_node_group(): random_x2___mat.color_tag = "NONE" random_x2___mat.description = "" + random_x2___mat.default_group_node_width = 140 # random_x2___mat interface # Socket 0 @@ -3216,6 +3232,7 @@ def rockshader_node_group(): rockshader.color_tag = "NONE" rockshader.description = "" + rockshader.default_group_node_width = 140 # rockshader interface # Socket BSDF @@ -3648,54 +3665,56 @@ def rockshader_node_group(): principled_bsdf_4.inputs[3].default_value = 1.5 # Alpha principled_bsdf_4.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_4.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_4.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_4.inputs[8].default_value = ( + principled_bsdf_4.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_4.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_4.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf_4.inputs[11].default_value = 0.0 + principled_bsdf_4.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_4.inputs[12].default_value = 0.5 + principled_bsdf_4.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_4.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_4.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_4.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_4.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_4.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_4.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_4.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_4.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_4.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_4.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_4.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_4.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_4.inputs[20].default_value = 1.5 + principled_bsdf_4.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_4.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_4.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_4.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_4.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_4.inputs[23].default_value = 0.0 + principled_bsdf_4.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_4.inputs[24].default_value = 0.5 + principled_bsdf_4.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_4.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf_4.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf_4.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf_4.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf_4.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf_4.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_4.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_4.inputs[30].default_value = 1.3300000429153442 # node Math math_4 = rockshader.nodes.new("ShaderNodeMath") @@ -4045,6 +4064,7 @@ def lunarsurface_node_group(): lunarsurface.nodes.remove(node) lunarsurface.color_tag = "NONE" lunarsurface.description = "" + lunarsurface.default_group_node_width = 140 # lunarsurface interface diff --git a/model/terrain/martian_surface_procgen/geometry.py b/model/terrain/martian_surface_procgen/geometry.py index 5269030..fe92e09 100644 --- a/model/terrain/martian_surface_procgen/geometry.py +++ b/model/terrain/martian_surface_procgen/geometry.py @@ -1,4 +1,5 @@ import bpy +import mathutils # initialize random__uniform_ node group @@ -9,6 +10,7 @@ def random__uniform__node_group(): random__uniform_.color_tag = "NONE" random__uniform_.description = "" + random__uniform_.default_group_node_width = 140 # random__uniform_ interface # Socket Value @@ -107,6 +109,7 @@ def random__normal__node_group(): random__normal_.color_tag = "NONE" random__normal_.description = "" + random__normal_.default_group_node_width = 140 # random__normal_ interface # Socket Value @@ -381,6 +384,7 @@ def martianrock_node_group(): martianrock.color_tag = "GEOMETRY" martianrock.description = "" + martianrock.default_group_node_width = 140 martianrock.is_modifier = True @@ -599,6 +603,7 @@ def martianrock_node_group(): # node Reroute.001 reroute_001 = martianrock.nodes.new("NodeReroute") reroute_001.name = "Reroute.001" + reroute_001.socket_idname = "NodeSocketFloat" # node Transform Geometry transform_geometry = martianrock.nodes.new("GeometryNodeTransform") transform_geometry.name = "Transform Geometry" @@ -611,6 +616,7 @@ def martianrock_node_group(): # node Reroute.002 reroute_002 = martianrock.nodes.new("NodeReroute") reroute_002.name = "Reroute.002" + reroute_002.socket_idname = "NodeSocketInt" # node Attribute Statistic attribute_statistic = martianrock.nodes.new("GeometryNodeAttributeStatistic") attribute_statistic.name = "Attribute Statistic" @@ -632,6 +638,7 @@ def martianrock_node_group(): # node Reroute.003 reroute_003 = martianrock.nodes.new("NodeReroute") reroute_003.name = "Reroute.003" + reroute_003.socket_idname = "NodeSocketGeometry" # node Vector Math.002 vector_math_002 = martianrock.nodes.new("ShaderNodeVectorMath") vector_math_002.name = "Vector Math.002" @@ -745,6 +752,7 @@ def martianrock_node_group(): # node Reroute.005 reroute_005 = martianrock.nodes.new("NodeReroute") reroute_005.name = "Reroute.005" + reroute_005.socket_idname = "NodeSocketFloat" # node Group.003 group_003 = martianrock.nodes.new("GeometryNodeGroup") group_003.name = "Group.003" @@ -774,9 +782,11 @@ def martianrock_node_group(): # node Reroute.006 reroute_006 = martianrock.nodes.new("NodeReroute") reroute_006.name = "Reroute.006" + reroute_006.socket_idname = "NodeSocketFloat" # node Reroute reroute = martianrock.nodes.new("NodeReroute") reroute.name = "Reroute" + reroute.socket_idname = "NodeSocketVectorXYZ" # node Group.007 group_007 = martianrock.nodes.new("GeometryNodeGroup") group_007.name = "Group.007" @@ -979,6 +989,7 @@ def martianrock_node_group(): # node Reroute.010 reroute_010 = martianrock.nodes.new("NodeReroute") reroute_010.name = "Reroute.010" + reroute_010.socket_idname = "NodeSocketBool" # node Cube.001 cube_001 = martianrock.nodes.new("GeometryNodeMeshCube") cube_001.name = "Cube.001" @@ -1002,6 +1013,7 @@ def martianrock_node_group(): # node Reroute.004 reroute_004 = martianrock.nodes.new("NodeReroute") reroute_004.name = "Reroute.004" + reroute_004.socket_idname = "NodeSocketGeometry" # node Frame.004 frame_004 = martianrock.nodes.new("NodeFrame") frame_004.name = "Frame.004" @@ -1011,9 +1023,11 @@ def martianrock_node_group(): # node Reroute.012 reroute_012 = martianrock.nodes.new("NodeReroute") reroute_012.name = "Reroute.012" + reroute_012.socket_idname = "NodeSocketFloatDistance" # node Reroute.013 reroute_013 = martianrock.nodes.new("NodeReroute") reroute_013.name = "Reroute.013" + reroute_013.socket_idname = "NodeSocketFloatDistance" # node Transform Geometry.003 transform_geometry_003 = martianrock.nodes.new("GeometryNodeTransform") transform_geometry_003.name = "Transform Geometry.003" @@ -1060,6 +1074,7 @@ def martianrock_node_group(): # node Reroute.015 reroute_015 = martianrock.nodes.new("NodeReroute") reroute_015.name = "Reroute.015" + reroute_015.socket_idname = "NodeSocketFloat" # node Separate XYZ separate_xyz = martianrock.nodes.new("ShaderNodeSeparateXYZ") separate_xyz.name = "Separate XYZ" @@ -1071,21 +1086,27 @@ def martianrock_node_group(): # node Reroute.017 reroute_017 = martianrock.nodes.new("NodeReroute") reroute_017.name = "Reroute.017" + reroute_017.socket_idname = "NodeSocketVectorXYZ" # node Reroute.018 reroute_018 = martianrock.nodes.new("NodeReroute") reroute_018.name = "Reroute.018" + reroute_018.socket_idname = "NodeSocketVectorXYZ" # node Reroute.019 reroute_019 = martianrock.nodes.new("NodeReroute") reroute_019.name = "Reroute.019" + reroute_019.socket_idname = "NodeSocketVectorXYZ" # node Reroute.020 reroute_020 = martianrock.nodes.new("NodeReroute") reroute_020.name = "Reroute.020" + reroute_020.socket_idname = "NodeSocketFloat" # node Reroute.021 reroute_021 = martianrock.nodes.new("NodeReroute") reroute_021.name = "Reroute.021" + reroute_021.socket_idname = "NodeSocketBool" # node Reroute.022 reroute_022 = martianrock.nodes.new("NodeReroute") reroute_022.name = "Reroute.022" + reroute_022.socket_idname = "NodeSocketFloatDistance" # node Frame.005 frame_005 = martianrock.nodes.new("NodeFrame") frame_005.name = "Frame.005" @@ -1481,6 +1502,7 @@ def crater_profile_node_group(): crater_profile.color_tag = "NONE" crater_profile.description = "" + crater_profile.default_group_node_width = 140 # crater_profile interface # Socket Value @@ -1619,6 +1641,7 @@ def crater_profile_node_group(): # node Reroute.002 reroute_002_1 = crater_profile.nodes.new("NodeReroute") reroute_002_1.name = "Reroute.002" + reroute_002_1.socket_idname = "NodeSocketInt" # node Integer integer_1 = crater_profile.nodes.new("FunctionNodeInputInt") integer_1.label = "Max N" @@ -1836,6 +1859,7 @@ def crater_profile_node_group(): # node Reroute.003 reroute_003_1 = crater_profile.nodes.new("NodeReroute") reroute_003_1.name = "Reroute.003" + reroute_003_1.socket_idname = "NodeSocketFloat" # node Math.005 math_005_1 = crater_profile.nodes.new("ShaderNodeMath") math_005_1.name = "Math.005" @@ -2029,6 +2053,7 @@ def martianterrain_node_group(): martianterrain.color_tag = "NONE" martianterrain.description = "" + martianterrain.default_group_node_width = 140 martianterrain.is_modifier = True @@ -2203,6 +2228,7 @@ def martianterrain_node_group(): # node Reroute.001 reroute_001_1 = martianterrain.nodes.new("NodeReroute") reroute_001_1.name = "Reroute.001" + reroute_001_1.socket_idname = "NodeSocketGeometry" # node Vector Math.002 vector_math_002_1 = martianterrain.nodes.new("ShaderNodeVectorMath") vector_math_002_1.name = "Vector Math.002" @@ -2235,6 +2261,7 @@ def martianterrain_node_group(): # node Reroute.003 reroute_003_2 = martianterrain.nodes.new("NodeReroute") reroute_003_2.name = "Reroute.003" + reroute_003_2.socket_idname = "NodeSocketFloat" # node Compare compare_1 = martianterrain.nodes.new("FunctionNodeCompare") compare_1.name = "Compare" @@ -2262,6 +2289,7 @@ def martianterrain_node_group(): # node Reroute.005 reroute_005_1 = martianterrain.nodes.new("NodeReroute") reroute_005_1.name = "Reroute.005" + reroute_005_1.socket_idname = "NodeSocketVectorXYZ" # node Float to Integer float_to_integer_1 = martianterrain.nodes.new("FunctionNodeFloatToInt") float_to_integer_1.name = "Float to Integer" @@ -2302,6 +2330,7 @@ def martianterrain_node_group(): # node Reroute.007 reroute_007 = martianterrain.nodes.new("NodeReroute") reroute_007.name = "Reroute.007" + reroute_007.socket_idname = "NodeSocketGeometry" # node Vector Math.028 vector_math_028 = martianterrain.nodes.new("ShaderNodeVectorMath") vector_math_028.name = "Vector Math.028" @@ -2317,12 +2346,15 @@ def martianterrain_node_group(): # node Reroute.008 reroute_008 = martianterrain.nodes.new("NodeReroute") reroute_008.name = "Reroute.008" + reroute_008.socket_idname = "NodeSocketVectorXYZ" # node Reroute.006 reroute_006_1 = martianterrain.nodes.new("NodeReroute") reroute_006_1.name = "Reroute.006" + reroute_006_1.socket_idname = "NodeSocketFloat" # node Reroute.004 reroute_004_1 = martianterrain.nodes.new("NodeReroute") reroute_004_1.name = "Reroute.004" + reroute_004_1.socket_idname = "NodeSocketFloat" # node Noise Texture.009 noise_texture_009 = martianterrain.nodes.new("ShaderNodeTexNoise") noise_texture_009.name = "Noise Texture.009" @@ -2348,6 +2380,7 @@ def martianterrain_node_group(): # node Reroute.009 reroute_009 = martianterrain.nodes.new("NodeReroute") reroute_009.name = "Reroute.009" + reroute_009.socket_idname = "NodeSocketInt" # node Group group_2 = martianterrain.nodes.new("GeometryNodeGroup") group_2.name = "Group" @@ -2433,6 +2466,7 @@ def martianterrain_node_group(): # node Reroute.010 reroute_010_1 = martianterrain.nodes.new("NodeReroute") reroute_010_1.name = "Reroute.010" + reroute_010_1.socket_idname = "NodeSocketInt" # node Group.018 group_018 = martianterrain.nodes.new("GeometryNodeGroup") group_018.name = "Group.018" @@ -2505,6 +2539,7 @@ def martianterrain_node_group(): # node Reroute.011 reroute_011 = martianterrain.nodes.new("NodeReroute") reroute_011.name = "Reroute.011" + reroute_011.socket_idname = "NodeSocketInt" # node Group.022 group_022_1 = martianterrain.nodes.new("GeometryNodeGroup") group_022_1.name = "Group.022" @@ -2645,6 +2680,7 @@ def martianterrain_node_group(): # node Reroute reroute_1 = martianterrain.nodes.new("NodeReroute") reroute_1.name = "Reroute" + reroute_1.socket_idname = "NodeSocketVectorXYZ" # node Frame.007 frame_007 = martianterrain.nodes.new("NodeFrame") frame_007.label = "Surface displacement" @@ -2655,6 +2691,7 @@ def martianterrain_node_group(): # node Reroute.012 reroute_012_1 = martianterrain.nodes.new("NodeReroute") reroute_012_1.name = "Reroute.012" + reroute_012_1.socket_idname = "NodeSocketInt" # node Transform Geometry.002 transform_geometry_002_1 = martianterrain.nodes.new("GeometryNodeTransform") transform_geometry_002_1.name = "Transform Geometry.002" @@ -2690,6 +2727,7 @@ def martianterrain_node_group(): # node Reroute.013 reroute_013_1 = martianterrain.nodes.new("NodeReroute") reroute_013_1.name = "Reroute.013" + reroute_013_1.socket_idname = "NodeSocketGeometry" # node Vector Math.030 vector_math_030 = martianterrain.nodes.new("ShaderNodeVectorMath") vector_math_030.name = "Vector Math.030" @@ -2769,12 +2807,15 @@ def martianterrain_node_group(): reroute_002_2 = martianterrain.nodes.new("NodeReroute") reroute_002_2.name = "Reroute.002" reroute_002_2.mute = True + reroute_002_2.socket_idname = "NodeSocketInt" # node Reroute.014 reroute_014 = martianterrain.nodes.new("NodeReroute") reroute_014.name = "Reroute.014" + reroute_014.socket_idname = "NodeSocketInt" # node Reroute.015 reroute_015_1 = martianterrain.nodes.new("NodeReroute") reroute_015_1.name = "Reroute.015" + reroute_015_1.socket_idname = "NodeSocketFloat" # node Group.002 group_002_1 = martianterrain.nodes.new("GeometryNodeGroup") group_002_1.name = "Group.002" @@ -2835,6 +2876,7 @@ def martianterrain_node_group(): reroute_016 = martianterrain.nodes.new("NodeReroute") reroute_016.name = "Reroute.016" reroute_016.mute = True + reroute_016.socket_idname = "NodeSocketInt" # node Group.001 group_001_1 = martianterrain.nodes.new("GeometryNodeGroup") group_001_1.name = "Group.001" @@ -2943,10 +2985,12 @@ def martianterrain_node_group(): reroute_018_1 = martianterrain.nodes.new("NodeReroute") reroute_018_1.label = "Index" reroute_018_1.name = "Reroute.018" + reroute_018_1.socket_idname = "NodeSocketFloat" # node Reroute.019 reroute_019_1 = martianterrain.nodes.new("NodeReroute") reroute_019_1.label = "Seed" reroute_019_1.name = "Reroute.019" + reroute_019_1.socket_idname = "NodeSocketFloat" # node Group.007 group_007_1 = martianterrain.nodes.new("GeometryNodeGroup") group_007_1.name = "Group.007" @@ -3335,22 +3379,27 @@ def martianterrain_node_group(): reroute_017_1 = martianterrain.nodes.new("NodeReroute") reroute_017_1.name = "Reroute.017" reroute_017_1.mute = True + reroute_017_1.socket_idname = "NodeSocketGeometry" # node Reroute.020 reroute_020_1 = martianterrain.nodes.new("NodeReroute") reroute_020_1.name = "Reroute.020" reroute_020_1.mute = True + reroute_020_1.socket_idname = "NodeSocketGeometry" # node Reroute.021 reroute_021_1 = martianterrain.nodes.new("NodeReroute") reroute_021_1.name = "Reroute.021" reroute_021_1.mute = True + reroute_021_1.socket_idname = "NodeSocketFloat" # node Reroute.022 reroute_022_1 = martianterrain.nodes.new("NodeReroute") reroute_022_1.name = "Reroute.022" reroute_022_1.mute = True + reroute_022_1.socket_idname = "NodeSocketVector" # node Reroute.023 reroute_023 = martianterrain.nodes.new("NodeReroute") reroute_023.name = "Reroute.023" reroute_023.mute = True + reroute_023.socket_idname = "NodeSocketFloat" # node Store Named Attribute store_named_attribute = martianterrain.nodes.new("GeometryNodeStoreNamedAttribute") store_named_attribute.name = "Store Named Attribute" @@ -3427,10 +3476,12 @@ def martianterrain_node_group(): reroute_025 = martianterrain.nodes.new("NodeReroute") reroute_025.name = "Reroute.025" reroute_025.mute = True + reroute_025.socket_idname = "NodeSocketFloat" # node Reroute.026 reroute_026 = martianterrain.nodes.new("NodeReroute") reroute_026.name = "Reroute.026" reroute_026.mute = True + reroute_026.socket_idname = "NodeSocketInt" # node Position.007 position_007 = martianterrain.nodes.new("GeometryNodeInputPosition") position_007.name = "Position.007" @@ -3446,6 +3497,7 @@ def martianterrain_node_group(): reroute_027 = martianterrain.nodes.new("NodeReroute") reroute_027.name = "Reroute.027" reroute_027.mute = True + reroute_027.socket_idname = "NodeSocketFloat" # node Math.024 math_024 = martianterrain.nodes.new("ShaderNodeMath") math_024.name = "Math.024" @@ -3481,23 +3533,29 @@ def martianterrain_node_group(): reroute_028 = martianterrain.nodes.new("NodeReroute") reroute_028.name = "Reroute.028" reroute_028.mute = True + reroute_028.socket_idname = "NodeSocketGeometry" # node Reroute.031 reroute_031 = martianterrain.nodes.new("NodeReroute") reroute_031.name = "Reroute.031" + reroute_031.socket_idname = "NodeSocketInt" # node Reroute.033 reroute_033 = martianterrain.nodes.new("NodeReroute") reroute_033.name = "Reroute.033" + reroute_033.socket_idname = "NodeSocketGeometry" # node Reroute.032 reroute_032 = martianterrain.nodes.new("NodeReroute") reroute_032.name = "Reroute.032" + reroute_032.socket_idname = "NodeSocketVectorXYZ" # node Reroute.029 reroute_029 = martianterrain.nodes.new("NodeReroute") reroute_029.name = "Reroute.029" reroute_029.mute = True + reroute_029.socket_idname = "NodeSocketInt" # node Reroute.030 reroute_030 = martianterrain.nodes.new("NodeReroute") reroute_030.name = "Reroute.030" reroute_030.mute = True + reroute_030.socket_idname = "NodeSocketInt" # node Frame.009 frame_009 = martianterrain.nodes.new("NodeFrame") frame_009.name = "Frame.009" @@ -3519,6 +3577,7 @@ def martianterrain_node_group(): reroute_024 = martianterrain.nodes.new("NodeReroute") reroute_024.name = "Reroute.024" reroute_024.mute = True + reroute_024.socket_idname = "NodeSocketFloat" # node Frame.019 frame_019 = martianterrain.nodes.new("NodeFrame") frame_019.label = "Max crater size" @@ -3531,6 +3590,7 @@ def martianterrain_node_group(): reroute_035 = martianterrain.nodes.new("NodeReroute") reroute_035.name = "Reroute.035" reroute_035.mute = True + reroute_035.socket_idname = "NodeSocketFloat" # node Boolean Math.001 boolean_math_001 = martianterrain.nodes.new("FunctionNodeBooleanMath") boolean_math_001.name = "Boolean Math.001" @@ -3558,6 +3618,7 @@ def martianterrain_node_group(): # node Reroute.034 reroute_034 = martianterrain.nodes.new("NodeReroute") reroute_034.name = "Reroute.034" + reroute_034.socket_idname = "NodeSocketFloat" # node Mix.002 mix_002 = martianterrain.nodes.new("ShaderNodeMix") mix_002.name = "Mix.002" @@ -3628,6 +3689,7 @@ def martianterrain_node_group(): # node Reroute.036 reroute_036 = martianterrain.nodes.new("NodeReroute") reroute_036.name = "Reroute.036" + reroute_036.socket_idname = "NodeSocketInt" # node Math.029 math_029 = martianterrain.nodes.new("ShaderNodeMath") math_029.name = "Math.029" @@ -3707,9 +3769,11 @@ def martianterrain_node_group(): # node Reroute.040 reroute_040 = martianterrain.nodes.new("NodeReroute") reroute_040.name = "Reroute.040" + reroute_040.socket_idname = "NodeSocketFloat" # node Reroute.038 reroute_038 = martianterrain.nodes.new("NodeReroute") reroute_038.name = "Reroute.038" + reroute_038.socket_idname = "NodeSocketFloat" # node Math.030 math_030 = martianterrain.nodes.new("ShaderNodeMath") math_030.name = "Math.030" @@ -3741,12 +3805,15 @@ def martianterrain_node_group(): # node Reroute.037 reroute_037 = martianterrain.nodes.new("NodeReroute") reroute_037.name = "Reroute.037" + reroute_037.socket_idname = "NodeSocketGeometry" # node Reroute.039 reroute_039 = martianterrain.nodes.new("NodeReroute") reroute_039.name = "Reroute.039" + reroute_039.socket_idname = "NodeSocketBool" # node Reroute.041 reroute_041 = martianterrain.nodes.new("NodeReroute") reroute_041.name = "Reroute.041" + reroute_041.socket_idname = "NodeSocketBool" # node Value value = martianterrain.nodes.new("ShaderNodeValue") value.label = "Rock Size Limit" @@ -4447,7 +4514,7 @@ def martianterrain_node_group(): # math_004_2.Value -> math_005_2.Value martianterrain.links.new(math_004_2.outputs[0], math_005_2.inputs[0]) # repeat_input.Point Index -> math_004_2.Value - martianterrain.links.new(repeat_input.outputs[1], math_004_2.inputs[0]) + martianterrain.links.new(repeat_input.outputs[2], math_004_2.inputs[0]) # reroute_019_1.Output -> group_007_1.Seed martianterrain.links.new(reroute_019_1.outputs[0], group_007_1.inputs[2]) # reroute_019_1.Output -> group_001_1.Seed @@ -4479,7 +4546,7 @@ def martianterrain_node_group(): # separate_xyz_002_1.Y -> math_008_1.Value martianterrain.links.new(separate_xyz_002_1.outputs[1], math_008_1.inputs[0]) # repeat_input.Geometry -> join_geometry_001.Geometry - martianterrain.links.new(repeat_input.outputs[0], join_geometry_001.inputs[0]) + martianterrain.links.new(repeat_input.outputs[1], join_geometry_001.inputs[0]) # reroute_036.Output -> distribute_points_on_faces.Seed martianterrain.links.new( reroute_036.outputs[0], distribute_points_on_faces.inputs[6] @@ -4780,7 +4847,7 @@ def martianterrain_node_group(): martianterrain.links.new(join_geometry.outputs[0], switch_2.inputs[1]) # reroute_033.Output -> reroute_037.Input martianterrain.links.new(reroute_033.outputs[0], reroute_037.inputs[0]) - # repeat_output.Geometry -> mesh_boolean_1.Mesh 2 + # repeat_output.Geometry -> mesh_boolean_1.Mesh martianterrain.links.new(repeat_output.outputs[0], mesh_boolean_1.inputs[1]) # mesh_boolean_1.Mesh -> switch_2.True martianterrain.links.new(mesh_boolean_1.outputs[0], switch_2.inputs[2]) @@ -4798,7 +4865,7 @@ def martianterrain_node_group(): ) # reroute_037.Output -> join_geometry.Geometry martianterrain.links.new(reroute_037.outputs[0], join_geometry.inputs[0]) - # reroute_037.Output -> mesh_boolean_1.Mesh 2 + # reroute_037.Output -> mesh_boolean_1.Mesh martianterrain.links.new(reroute_037.outputs[0], mesh_boolean_1.inputs[1]) return martianterrain diff --git a/model/terrain/martian_surface_procgen/material.py b/model/terrain/martian_surface_procgen/material.py index ae3de9b..bcc6e73 100644 --- a/model/terrain/martian_surface_procgen/material.py +++ b/model/terrain/martian_surface_procgen/material.py @@ -1,4 +1,5 @@ import bpy +import mathutils mat = bpy.data.materials.new(name="MartianSurface") mat.use_nodes = True @@ -12,6 +13,7 @@ def random_x4___mat_node_group(): random_x4___mat.color_tag = "NONE" random_x4___mat.description = "" + random_x4___mat.default_group_node_width = 140 # random_x4___mat interface # Socket 0 @@ -178,6 +180,7 @@ def rockygroundshader_node_group(): rockygroundshader.color_tag = "NONE" rockygroundshader.description = "" + rockygroundshader.default_group_node_width = 140 # rockygroundshader interface # Socket Shader @@ -784,54 +787,56 @@ def rockygroundshader_node_group(): principled_bsdf.inputs[3].default_value = 1.4500000476837158 # Alpha principled_bsdf.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf.inputs[8].default_value = ( + principled_bsdf.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf.inputs[9].default_value = 0.05000000074505806 + principled_bsdf.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf.inputs[11].default_value = 0.0 + principled_bsdf.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf.inputs[12].default_value = 0.5 + principled_bsdf.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf.inputs[16].default_value = 0.0 # Tangent - principled_bsdf.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf.inputs[19].default_value = 0.029999999329447746 + principled_bsdf.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf.inputs[20].default_value = 1.5 + principled_bsdf.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf.inputs[23].default_value = 0.0 + principled_bsdf.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf.inputs[24].default_value = 0.5 + principled_bsdf.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf.inputs[29].default_value = 1.3300000429153442 + principled_bsdf.inputs[30].default_value = 1.3300000429153442 # node Noise Texture.006 noise_texture_006 = rockygroundshader.nodes.new("ShaderNodeTexNoise") @@ -1335,6 +1340,7 @@ def sandshader_node_group(): sandshader.color_tag = "NONE" sandshader.description = "" + sandshader.default_group_node_width = 140 # sandshader interface # Socket BSDF @@ -1465,54 +1471,56 @@ def sandshader_node_group(): principled_bsdf_1.inputs[3].default_value = 1.5 # Alpha principled_bsdf_1.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_1.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_1.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_1.inputs[8].default_value = ( + principled_bsdf_1.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_1.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_1.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf_1.inputs[11].default_value = 0.0 + principled_bsdf_1.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_1.inputs[12].default_value = 0.5 + principled_bsdf_1.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_1.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_1.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_1.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_1.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_1.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_1.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_1.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_1.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_1.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_1.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_1.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_1.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_1.inputs[20].default_value = 1.5 + principled_bsdf_1.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_1.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_1.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_1.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_1.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_1.inputs[23].default_value = 0.0 + principled_bsdf_1.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_1.inputs[24].default_value = 0.5 + principled_bsdf_1.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_1.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf_1.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf_1.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf_1.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf_1.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf_1.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_1.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_1.inputs[30].default_value = 1.3300000429153442 # node Mapping mapping_1 = sandshader.nodes.new("ShaderNodeMapping") @@ -1790,6 +1798,7 @@ def random_x2___mat_node_group(): random_x2___mat.color_tag = "NONE" random_x2___mat.description = "" + random_x2___mat.default_group_node_width = 140 # random_x2___mat interface # Socket 0 @@ -1903,6 +1912,7 @@ def rockshader___3_node_group(): rockshader___3.color_tag = "NONE" rockshader___3.description = "" + rockshader___3.default_group_node_width = 140 # rockshader___3 interface # Socket Shader @@ -2171,56 +2181,58 @@ def rockshader___3_node_group(): principled_bsdf_2.inputs[3].default_value = 1.4500000476837158 # Alpha principled_bsdf_2.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_2.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_2.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_2.inputs[8].default_value = ( + principled_bsdf_2.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_2.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_2.inputs[10].default_value = 0.05000000074505806 # Subsurface IOR - principled_bsdf_2.inputs[10].default_value = 1.399999976158142 + principled_bsdf_2.inputs[11].default_value = 1.399999976158142 # Subsurface Anisotropy - principled_bsdf_2.inputs[11].default_value = 0.0 + principled_bsdf_2.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_2.inputs[12].default_value = 0.5 + principled_bsdf_2.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_2.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_2.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_2.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_2.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_2.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_2.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_2.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_2.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_2.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_2.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_2.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_2.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_2.inputs[20].default_value = 1.5 + principled_bsdf_2.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_2.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_2.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_2.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_2.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_2.inputs[23].default_value = 0.0 + principled_bsdf_2.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_2.inputs[24].default_value = 0.5 + principled_bsdf_2.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_2.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_2.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Color - principled_bsdf_2.inputs[26].default_value = (0.0, 0.0, 0.0, 1.0) + principled_bsdf_2.inputs[27].default_value = (0.0, 0.0, 0.0, 1.0) # Emission Strength - principled_bsdf_2.inputs[27].default_value = 1.0 + principled_bsdf_2.inputs[28].default_value = 1.0 # Thin Film Thickness - principled_bsdf_2.inputs[28].default_value = 0.0 + principled_bsdf_2.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_2.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_2.inputs[30].default_value = 1.3300000429153442 # node Mapping mapping_2 = rockshader___3.nodes.new("ShaderNodeMapping") @@ -2524,6 +2536,7 @@ def rockshader___4_node_group(): rockshader___4.color_tag = "NONE" rockshader___4.description = "" + rockshader___4.default_group_node_width = 140 # rockshader___4 interface # Socket Shader @@ -2742,56 +2755,58 @@ def rockshader___4_node_group(): principled_bsdf_3.inputs[3].default_value = 1.4500000476837158 # Alpha principled_bsdf_3.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_3.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_3.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_3.inputs[8].default_value = ( + principled_bsdf_3.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_3.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_3.inputs[10].default_value = 0.05000000074505806 # Subsurface IOR - principled_bsdf_3.inputs[10].default_value = 1.399999976158142 + principled_bsdf_3.inputs[11].default_value = 1.399999976158142 # Subsurface Anisotropy - principled_bsdf_3.inputs[11].default_value = 0.0 + principled_bsdf_3.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_3.inputs[12].default_value = 0.5 + principled_bsdf_3.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_3.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_3.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_3.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_3.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_3.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_3.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_3.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_3.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_3.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_3.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_3.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_3.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_3.inputs[20].default_value = 1.5 + principled_bsdf_3.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_3.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_3.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_3.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_3.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_3.inputs[23].default_value = 0.0 + principled_bsdf_3.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_3.inputs[24].default_value = 0.5 + principled_bsdf_3.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_3.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_3.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Color - principled_bsdf_3.inputs[26].default_value = (0.0, 0.0, 0.0, 1.0) + principled_bsdf_3.inputs[27].default_value = (0.0, 0.0, 0.0, 1.0) # Emission Strength - principled_bsdf_3.inputs[27].default_value = 1.0 + principled_bsdf_3.inputs[28].default_value = 1.0 # Thin Film Thickness - principled_bsdf_3.inputs[28].default_value = 0.0 + principled_bsdf_3.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_3.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_3.inputs[30].default_value = 1.3300000429153442 # node RGB Curves rgb_curves = rockshader___4.nodes.new("ShaderNodeRGBCurve") @@ -3207,6 +3222,7 @@ def rockshader_node_group(): rockshader.color_tag = "NONE" rockshader.description = "" + rockshader.default_group_node_width = 140 # rockshader interface # Socket BSDF @@ -3639,54 +3655,56 @@ def rockshader_node_group(): principled_bsdf_4.inputs[3].default_value = 1.5 # Alpha principled_bsdf_4.inputs[4].default_value = 1.0 - # Subsurface Weight + # Diffuse Roughness principled_bsdf_4.inputs[7].default_value = 0.0 + # Subsurface Weight + principled_bsdf_4.inputs[8].default_value = 0.0 # Subsurface Radius - principled_bsdf_4.inputs[8].default_value = ( + principled_bsdf_4.inputs[9].default_value = ( 1.0, 0.20000000298023224, 0.10000000149011612, ) # Subsurface Scale - principled_bsdf_4.inputs[9].default_value = 0.05000000074505806 + principled_bsdf_4.inputs[10].default_value = 0.05000000074505806 # Subsurface Anisotropy - principled_bsdf_4.inputs[11].default_value = 0.0 + principled_bsdf_4.inputs[12].default_value = 0.0 # Specular IOR Level - principled_bsdf_4.inputs[12].default_value = 0.5 + principled_bsdf_4.inputs[13].default_value = 0.5 # Specular Tint - principled_bsdf_4.inputs[13].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_4.inputs[14].default_value = (1.0, 1.0, 1.0, 1.0) # Anisotropic - principled_bsdf_4.inputs[14].default_value = 0.0 - # Anisotropic Rotation principled_bsdf_4.inputs[15].default_value = 0.0 + # Anisotropic Rotation + principled_bsdf_4.inputs[16].default_value = 0.0 # Tangent - principled_bsdf_4.inputs[16].default_value = (0.0, 0.0, 0.0) + principled_bsdf_4.inputs[17].default_value = (0.0, 0.0, 0.0) # Transmission Weight - principled_bsdf_4.inputs[17].default_value = 0.0 - # Coat Weight principled_bsdf_4.inputs[18].default_value = 0.0 + # Coat Weight + principled_bsdf_4.inputs[19].default_value = 0.0 # Coat Roughness - principled_bsdf_4.inputs[19].default_value = 0.029999999329447746 + principled_bsdf_4.inputs[20].default_value = 0.029999999329447746 # Coat IOR - principled_bsdf_4.inputs[20].default_value = 1.5 + principled_bsdf_4.inputs[21].default_value = 1.5 # Coat Tint - principled_bsdf_4.inputs[21].default_value = (1.0, 1.0, 1.0, 1.0) + principled_bsdf_4.inputs[22].default_value = (1.0, 1.0, 1.0, 1.0) # Coat Normal - principled_bsdf_4.inputs[22].default_value = (0.0, 0.0, 0.0) + principled_bsdf_4.inputs[23].default_value = (0.0, 0.0, 0.0) # Sheen Weight - principled_bsdf_4.inputs[23].default_value = 0.0 + principled_bsdf_4.inputs[24].default_value = 0.0 # Sheen Roughness - principled_bsdf_4.inputs[24].default_value = 0.5 + principled_bsdf_4.inputs[25].default_value = 0.5 # Sheen Tint - principled_bsdf_4.inputs[25].default_value = (1.0, 1.0, 1.0, 1.0) - # Emission Color principled_bsdf_4.inputs[26].default_value = (1.0, 1.0, 1.0, 1.0) + # Emission Color + principled_bsdf_4.inputs[27].default_value = (1.0, 1.0, 1.0, 1.0) # Emission Strength - principled_bsdf_4.inputs[27].default_value = 0.0 - # Thin Film Thickness principled_bsdf_4.inputs[28].default_value = 0.0 + # Thin Film Thickness + principled_bsdf_4.inputs[29].default_value = 0.0 # Thin Film IOR - principled_bsdf_4.inputs[29].default_value = 1.3300000429153442 + principled_bsdf_4.inputs[30].default_value = 1.3300000429153442 # node Math math_3 = rockshader.nodes.new("ShaderNodeMath") @@ -4036,6 +4054,7 @@ def martianrockshader_node_group(): martianrockshader.color_tag = "NONE" martianrockshader.description = "" + martianrockshader.default_group_node_width = 140 # martianrockshader interface # Socket Shader @@ -4500,6 +4519,7 @@ def martiansurface_node_group(): martiansurface.nodes.remove(node) martiansurface.color_tag = "NONE" martiansurface.description = "" + martiansurface.default_group_node_width = 140 # martiansurface interface diff --git a/scripts/blender/procgen_assets.py b/scripts/blender/procgen_assets.py index 7b3f785..13d66f6 100755 --- a/scripts/blender/procgen_assets.py +++ b/scripts/blender/procgen_assets.py @@ -1,4 +1,4 @@ -#!/usr/bin/env -S blender --factory-startup --background --offline-mode --enable-autoexec --python-exit-code 1 --python +#!/usr/bin/env -S blender --factory-startup --background --enable-autoexec --python-exit-code 1 --python """ Script for automated procedural asset generation using Blender that revolves around its rich node-based system for geometry (Geometry Nodes) and materials (Shader Nodes). @@ -118,8 +118,19 @@ def generate( node_group_input_socket_maps=node_group_input_socket_maps, ) + should_bake_material = material is not None + if not should_bake_material: + for node_group_inputs in geometry_nodes.values(): + for value in node_group_inputs.values(): + if isinstance(value, str) and value.startswith("MAT:"): + should_bake_material = True + break + else: + continue + break + # Preheat the oven for baking the material into PBR textures - if material: + if should_bake_material: ProceduralGenerator.Baker.preheat_oven(render_samples=render_samples) # Prepare the scene for rendering the thumbnail @@ -164,10 +175,11 @@ def generate( bpy.ops.object.modifier_apply(modifier=modifier.name) # If specified, bake the material into PBR textures - if material: + if should_bake_material: obj.hide_render = False - obj.data.materials.clear() - obj.data.materials.append(bpy.data.materials.get(material)) + if material: + obj.data.materials.clear() + obj.data.materials.append(bpy.data.materials.get(material)) ProceduralGenerator.Baker.bake_into_pbr_material( obj=obj, texture_resolution=texture_resolution ) @@ -287,7 +299,16 @@ def apply_geometry_nodes_modifiers( socket_id = node_group_input_socket_maps[node_group_name][ canonicalize_str(key) ] - modifier[socket_id] = value + if isinstance(value, str) and value.startswith("MAT:"): + material_name = value[4:] + material = bpy.data.materials.get(material_name) + if not material: + raise ValueError( + f"Material '{material_name}' not found in the list of available materials: {bpy.data.materials.keys()}" + ) + modifier[socket_id] = material + else: + modifier[socket_id] = value # Apply changes via mesh update obj.data.update() @@ -478,7 +499,7 @@ def cleanup( match self: case self.ALBEDO: if orig_metallic_default_value or orig_metallic_from_socket: - metallic_socket = ( + link = ( [ node for node in material.node_tree.nodes @@ -486,9 +507,11 @@ def cleanup( ][0] .inputs["Surface"] .links[0] - .inputs["Metallic"] ) - metallic_socket.default_value = orig_metallic_default_value + # TODO: Fix this ugly hack + if hasattr(link, "inputs"): + metallic_socket = link.inputs["Metallic"] + metallic_socket.default_value = orig_metallic_default_value if orig_metallic_from_socket: material.node_tree.links.new( orig_metallic_from_socket, @@ -555,7 +578,7 @@ def bake_into_pbr_material( cls._unwrap_uv_on_active_obj(obj, texture_resolution) # Get the material - material = obj.data.materials[0] + material = obj.data.materials[-1] # Bake all textures from the recipe baked_textures = {} @@ -1129,7 +1152,7 @@ def print_bpy(msg: Any, file: Optional[TextIO] = sys.stdout, *args, **kwargs): def verify_requirements(): - VERSION_BPY_MIN: Tuple[int, int] = (4, 2) + VERSION_BPY_MIN: Tuple[int, int] = (4, 3) if ( bpy.app.version[0] != VERSION_BPY_MIN[0] or bpy.app.version[1] < VERSION_BPY_MIN[1]