import bpy, mathutils mat = bpy.data.materials.new(name = "Windows2") mat.use_nodes = True #initialize Windows2 node group def windows2_node_group(): windows2 = mat.node_tree #start with a clean node tree for node in windows2.nodes: windows2.nodes.remove(node) windows2.color_tag = 'NONE' windows2.description = "" windows2.default_group_node_width = 140 #windows2 interface #initialize windows2 nodes #node Bump bump = windows2.nodes.new("ShaderNodeBump") bump.name = "Bump" bump.invert = True #Strength bump.inputs[0].default_value = 0.8916666507720947 #Distance bump.inputs[1].default_value = 0.10000000149011612 #Normal bump.inputs[3].default_value = (0.0, 0.0, 0.0) #node Mix.002 mix_002 = windows2.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.012400537729263306, 0.012400537729263306, 0.012400537729263306, 1.0) #B_Color mix_002.inputs[7].default_value = (1.0, 1.0, 1.0, 1.0) #node Texture Coordinate.001 texture_coordinate_001 = windows2.nodes.new("ShaderNodeTexCoord") texture_coordinate_001.name = "Texture Coordinate.001" texture_coordinate_001.from_instancer = False #node Texture Coordinate texture_coordinate = windows2.nodes.new("ShaderNodeTexCoord") texture_coordinate.name = "Texture Coordinate" texture_coordinate.from_instancer = False #node Bump.001 bump_001 = windows2.nodes.new("ShaderNodeBump") bump_001.name = "Bump.001" bump_001.invert = False #Strength bump_001.inputs[0].default_value = 0.8916666507720947 #Distance bump_001.inputs[1].default_value = 0.10000000149011612 #Normal bump_001.inputs[3].default_value = (0.0, 0.0, 0.0) #node Musgrave Texture musgrave_texture = windows2.nodes.new("ShaderNodeTexNoise") musgrave_texture.name = "Musgrave Texture" musgrave_texture.noise_dimensions = '3D' musgrave_texture.noise_type = 'FBM' musgrave_texture.normalize = False #Scale musgrave_texture.inputs[2].default_value = 21.899999618530273 #Detail musgrave_texture.inputs[3].default_value = 1.0 #Roughness musgrave_texture.inputs[4].default_value = 0.25 #Lacunarity musgrave_texture.inputs[5].default_value = 2.0 #Distortion musgrave_texture.inputs[8].default_value = 0.0 #node Material Output material_output = windows2.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 Principled BSDF principled_bsdf = windows2.nodes.new("ShaderNodeBsdfPrincipled") principled_bsdf.name = "Principled BSDF" principled_bsdf.distribution = 'GGX' principled_bsdf.subsurface_method = 'RANDOM_WALK_SKIN' #IOR principled_bsdf.inputs[3].default_value = 1.4500000476837158 #Alpha principled_bsdf.inputs[4].default_value = 0.9750000238418579 #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 IOR principled_bsdf.inputs[11].default_value = 1.399999976158142 #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 = (0.0, 0.0, 0.0, 1.0) #Emission Strength principled_bsdf.inputs[28].default_value = 1.0 #Thin Film Thickness principled_bsdf.inputs[29].default_value = 0.0 #Thin Film IOR principled_bsdf.inputs[30].default_value = 1.3300000429153442 #node Reroute.001 reroute_001 = windows2.nodes.new("NodeReroute") reroute_001.name = "Reroute.001" reroute_001.socket_idname = "NodeSocketColor" #node Reroute reroute = windows2.nodes.new("NodeReroute") reroute.name = "Reroute" reroute.socket_idname = "NodeSocketColor" #node Mix.003 mix_003 = windows2.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' #Factor_Float mix_003.inputs[0].default_value = 0.030833374708890915 #node Brick Texture brick_texture = windows2.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 = (1.0, 0.0008077447419054806, 0.0, 1.0) #Color2 brick_texture.inputs[2].default_value = (0.0, 0.19828613102436066, 0.21959739923477173, 1.0) #Mortar brick_texture.inputs[3].default_value = (0.0, 0.0, 0.0, 1.0) #Scale brick_texture.inputs[4].default_value = 42.500003814697266 #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 = 1.0 #Row Height brick_texture.inputs[9].default_value = 1.0 #node Mix.004 mix_004 = windows2.nodes.new("ShaderNodeMix") mix_004.name = "Mix.004" mix_004.blend_type = 'LINEAR_LIGHT' mix_004.clamp_factor = True mix_004.clamp_result = False mix_004.data_type = 'RGBA' mix_004.factor_mode = 'UNIFORM' #Factor_Float mix_004.inputs[0].default_value = 0.03541667014360428 #node Mix.001 mix_001 = windows2.nodes.new("ShaderNodeMix") mix_001.name = "Mix.001" mix_001.blend_type = 'MIX' mix_001.clamp_factor = True mix_001.clamp_result = False mix_001.data_type = 'RGBA' mix_001.factor_mode = 'UNIFORM' #A_Color mix_001.inputs[6].default_value = (1.0, 1.0, 1.0, 1.0) #B_Color mix_001.inputs[7].default_value = (0.0, 0.0, 0.0, 1.0) #node Object Info object_info = windows2.nodes.new("ShaderNodeObjectInfo") object_info.name = "Object Info" #node Mix mix = windows2.nodes.new("ShaderNodeMix") mix.name = "Mix" mix.blend_type = 'MIX' mix.clamp_factor = True mix.clamp_result = False mix.data_type = 'RGBA' mix.factor_mode = 'UNIFORM' #B_Color mix.inputs[7].default_value = (0.0, 0.0, 0.0, 1.0) #node ColorRamp colorramp = windows2.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.027272731065750122 colorramp_cre_0.alpha = 1.0 colorramp_cre_0.color = (0.10697267949581146, 0.15314680337905884, 0.2199300229549408, 1.0) colorramp_cre_1 = colorramp.color_ramp.elements.new(0.9863636493682861) colorramp_cre_1.alpha = 1.0 colorramp_cre_1.color = (0.09271731972694397, 0.09109188616275787, 0.09541463851928711, 1.0) #Set locations bump.location = (-343.93341064453125, -120.94110870361328) mix_002.location = (-341.2340393066406, 74.7131576538086) texture_coordinate_001.location = (-905.153076171875, -270.6412048339844) texture_coordinate.location = (-1067.584228515625, 217.40609741210938) bump_001.location = (-369.8406066894531, -333.9305114746094) musgrave_texture.location = (-692.5435180664062, -311.35614013671875) material_output.location = (787.5459594726562, 345.159423828125) principled_bsdf.location = (377.4997253417969, 340.0853271484375) reroute_001.location = (-433.8802490234375, -311.096923828125) reroute.location = (48.056148529052734, -338.44207763671875) mix_003.location = (-126.04620361328125, -135.89659118652344) brick_texture.location = (-825.785888671875, 259.97857666015625) mix_004.location = (89.00574493408203, -133.0022430419922) mix_001.location = (-338.51544189453125, 258.6866149902344) object_info.location = (-938.21533203125, 570.4349975585938) mix.location = (-343.0464172363281, 447.19140625) colorramp.location = (-740.6265258789062, 572.4308471679688) #Set dimensions bump.width, bump.height = 140.0, 100.0 mix_002.width, mix_002.height = 140.0, 100.0 texture_coordinate_001.width, texture_coordinate_001.height = 140.0, 100.0 texture_coordinate.width, texture_coordinate.height = 140.0, 100.0 bump_001.width, bump_001.height = 140.0, 100.0 musgrave_texture.width, musgrave_texture.height = 150.0, 100.0 material_output.width, material_output.height = 140.0, 100.0 principled_bsdf.width, principled_bsdf.height = 240.0, 100.0 reroute_001.width, reroute_001.height = 10.0, 100.0 reroute.width, reroute.height = 10.0, 100.0 mix_003.width, mix_003.height = 140.0, 100.0 brick_texture.width, brick_texture.height = 150.0, 100.0 mix_004.width, mix_004.height = 140.0, 100.0 mix_001.width, mix_001.height = 140.0, 100.0 object_info.width, object_info.height = 140.0, 100.0 mix.width, mix.height = 140.0, 100.0 colorramp.width, colorramp.height = 240.0, 100.0 #initialize windows2 links #texture_coordinate.UV -> brick_texture.Vector windows2.links.new(texture_coordinate.outputs[2], brick_texture.inputs[0]) #brick_texture.Fac -> mix.Factor windows2.links.new(brick_texture.outputs[1], mix.inputs[0]) #mix.Result -> principled_bsdf.Base Color windows2.links.new(mix.outputs[2], principled_bsdf.inputs[0]) #brick_texture.Fac -> mix_001.Factor windows2.links.new(brick_texture.outputs[1], mix_001.inputs[0]) #brick_texture.Fac -> mix_002.Factor windows2.links.new(brick_texture.outputs[1], mix_002.inputs[0]) #mix_001.Result -> principled_bsdf.Metallic windows2.links.new(mix_001.outputs[2], principled_bsdf.inputs[1]) #mix_002.Result -> principled_bsdf.Roughness windows2.links.new(mix_002.outputs[2], principled_bsdf.inputs[2]) #brick_texture.Fac -> bump.Height windows2.links.new(brick_texture.outputs[1], bump.inputs[2]) #musgrave_texture.Fac -> bump_001.Height windows2.links.new(musgrave_texture.outputs[0], bump_001.inputs[2]) #bump.Normal -> mix_003.A windows2.links.new(bump.outputs[0], mix_003.inputs[6]) #bump_001.Normal -> mix_003.B windows2.links.new(bump_001.outputs[0], mix_003.inputs[7]) #texture_coordinate_001.UV -> musgrave_texture.Vector windows2.links.new(texture_coordinate_001.outputs[2], musgrave_texture.inputs[0]) #mix_004.Result -> principled_bsdf.Normal windows2.links.new(mix_004.outputs[2], principled_bsdf.inputs[5]) #principled_bsdf.BSDF -> material_output.Surface windows2.links.new(principled_bsdf.outputs[0], material_output.inputs[0]) #reroute.Output -> mix_004.B windows2.links.new(reroute.outputs[0], mix_004.inputs[7]) #mix_003.Result -> mix_004.A windows2.links.new(mix_003.outputs[2], mix_004.inputs[6]) #reroute_001.Output -> reroute.Input windows2.links.new(reroute_001.outputs[0], reroute.inputs[0]) #brick_texture.Color -> reroute_001.Input windows2.links.new(brick_texture.outputs[0], reroute_001.inputs[0]) #object_info.Random -> colorramp.Fac windows2.links.new(object_info.outputs[5], colorramp.inputs[0]) #colorramp.Color -> mix.A windows2.links.new(colorramp.outputs[0], mix.inputs[6]) return windows2 windows2 = windows2_node_group()