import bpy, mathutils mat = bpy.data.materials.new(name = "Material.001") mat.use_nodes = True #initialize Material.001 node group def material_001_node_group(): material_001 = mat.node_tree #start with a clean node tree for node in material_001.nodes: material_001.nodes.remove(node) material_001.color_tag = 'NONE' material_001.description = "" material_001.default_group_node_width = 140 #material_001 interface #initialize material_001 nodes #node Principled BSDF principled_bsdf = material_001.nodes.new("ShaderNodeBsdfPrincipled") principled_bsdf.name = "Principled BSDF" principled_bsdf.distribution = 'MULTI_GGX' principled_bsdf.subsurface_method = 'RANDOM_WALK' #Metallic principled_bsdf.inputs[1].default_value = 0.6000000238418579 #Roughness principled_bsdf.inputs[2].default_value = 0.5 #IOR principled_bsdf.inputs[3].default_value = 1.5 #Alpha principled_bsdf.inputs[4].default_value = 1.0 #Normal principled_bsdf.inputs[5].default_value = (0.0, 0.0, 0.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 Material Output material_output = material_001.nodes.new("ShaderNodeOutputMaterial") material_output.name = "Material Output" material_output.is_active_output = True material_output.target = 'ALL' #Thickness material_output.inputs[3].default_value = 0.0 #node Gradient Texture gradient_texture = material_001.nodes.new("ShaderNodeTexGradient") gradient_texture.name = "Gradient Texture" gradient_texture.gradient_type = 'LINEAR' #node Mapping.001 mapping_001 = material_001.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, 1.5707963705062866, 0.0) #Scale mapping_001.inputs[3].default_value = (1.0, 1.0, 1.0) #node Texture Coordinate texture_coordinate = material_001.nodes.new("ShaderNodeTexCoord") texture_coordinate.name = "Texture Coordinate" texture_coordinate.from_instancer = False #node Displacement displacement = material_001.nodes.new("ShaderNodeDisplacement") displacement.name = "Displacement" displacement.space = 'OBJECT' #Midlevel displacement.inputs[1].default_value = 0.0 #Scale displacement.inputs[2].default_value = 1.7000000476837158 #Normal displacement.inputs[3].default_value = (0.0, 0.0, 0.0) #node Noise Texture noise_texture = material_001.nodes.new("ShaderNodeTexNoise") noise_texture.name = "Noise Texture" noise_texture.noise_dimensions = '3D' noise_texture.noise_type = 'FBM' noise_texture.normalize = True #Vector noise_texture.inputs[0].default_value = (0.0, 0.0, 0.0) #Scale noise_texture.inputs[2].default_value = 3.0 #Detail noise_texture.inputs[3].default_value = 4.0 #Roughness noise_texture.inputs[4].default_value = 0.5 #Lacunarity noise_texture.inputs[5].default_value = 2.0 #Distortion noise_texture.inputs[8].default_value = 0.0 #node Color Ramp color_ramp = material_001.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 = (1.0, 1.0, 1.0, 1.0) color_ramp_cre_1 = color_ramp.color_ramp.elements.new(0.5090910196304321) color_ramp_cre_1.alpha = 1.0 color_ramp_cre_1.color = (1.0, 1.0, 1.0, 1.0) color_ramp_cre_2 = color_ramp.color_ramp.elements.new(0.8772725462913513) color_ramp_cre_2.alpha = 1.0 color_ramp_cre_2.color = (0.0, 0.0, 0.0, 1.0) #node Ambient Occlusion ambient_occlusion = material_001.nodes.new("ShaderNodeAmbientOcclusion") ambient_occlusion.name = "Ambient Occlusion" ambient_occlusion.inside = False ambient_occlusion.only_local = False ambient_occlusion.samples = 16 #Distance ambient_occlusion.inputs[1].default_value = 1.0 #Normal ambient_occlusion.inputs[2].default_value = (0.0, 0.0, 0.0) #node Noise Texture.001 noise_texture_001 = material_001.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 = 2.0 #Detail noise_texture_001.inputs[3].default_value = 5.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 Mix mix = material_001.nodes.new("ShaderNodeMix") mix.name = "Mix" mix.blend_type = 'LINEAR_LIGHT' mix.clamp_factor = True mix.clamp_result = False mix.data_type = 'RGBA' mix.factor_mode = 'UNIFORM' #Factor_Float mix.inputs[0].default_value = 0.3499999940395355 #node Mix.001 mix_001 = material_001.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 = (0.0, 0.0, 0.0, 1.0) #B_Color mix_001.inputs[7].default_value = (0.5, 0.5, 0.5, 1.0) #Set locations principled_bsdf.location = (226.54168701171875, 324.4122619628906) material_output.location = (580.6032104492188, 175.73545837402344) gradient_texture.location = (-687.175537109375, 252.16946411132812) mapping_001.location = (-867.175537109375, 212.16946411132812) texture_coordinate.location = (-1047.175537109375, 212.16946411132812) displacement.location = (91.8699951171875, -128.1659393310547) noise_texture.location = (-135.18336486816406, -114.0890121459961) color_ramp.location = (-368.9694519042969, 307.89739990234375) ambient_occlusion.location = (-132.99998474121094, 341.99078369140625) noise_texture_001.location = (-729.2054443359375, -191.76510620117188) mix.location = (-533.666748046875, 51.50182342529297) mix_001.location = (47.0, 362.37530517578125) #Set dimensions principled_bsdf.width, principled_bsdf.height = 240.0, 100.0 material_output.width, material_output.height = 140.0, 100.0 gradient_texture.width, gradient_texture.height = 140.0, 100.0 mapping_001.width, mapping_001.height = 140.0, 100.0 texture_coordinate.width, texture_coordinate.height = 140.0, 100.0 displacement.width, displacement.height = 140.0, 100.0 noise_texture.width, noise_texture.height = 140.0, 100.0 color_ramp.width, color_ramp.height = 240.0, 100.0 ambient_occlusion.width, ambient_occlusion.height = 140.0, 100.0 noise_texture_001.width, noise_texture_001.height = 140.0, 100.0 mix.width, mix.height = 140.0, 100.0 mix_001.width, mix_001.height = 140.0, 100.0 #initialize material_001 links #principled_bsdf.BSDF -> material_output.Surface material_001.links.new(principled_bsdf.outputs[0], material_output.inputs[0]) #mix_001.Result -> principled_bsdf.Base Color material_001.links.new(mix_001.outputs[2], principled_bsdf.inputs[0]) #mapping_001.Vector -> gradient_texture.Vector material_001.links.new(mapping_001.outputs[0], gradient_texture.inputs[0]) #texture_coordinate.Object -> mapping_001.Vector material_001.links.new(texture_coordinate.outputs[3], mapping_001.inputs[0]) #displacement.Displacement -> material_output.Displacement material_001.links.new(displacement.outputs[0], material_output.inputs[2]) #noise_texture.Fac -> displacement.Height material_001.links.new(noise_texture.outputs[0], displacement.inputs[0]) #color_ramp.Color -> ambient_occlusion.Color material_001.links.new(color_ramp.outputs[0], ambient_occlusion.inputs[0]) #mapping_001.Vector -> noise_texture_001.Vector material_001.links.new(mapping_001.outputs[0], noise_texture_001.inputs[0]) #gradient_texture.Color -> mix.A material_001.links.new(gradient_texture.outputs[0], mix.inputs[6]) #noise_texture_001.Color -> mix.B material_001.links.new(noise_texture_001.outputs[1], mix.inputs[7]) #mix.Result -> color_ramp.Fac material_001.links.new(mix.outputs[2], color_ramp.inputs[0]) #ambient_occlusion.Color -> mix_001.Factor material_001.links.new(ambient_occlusion.outputs[0], mix_001.inputs[0]) return material_001 material_001 = material_001_node_group()