Materials/Textures – procedural


a Procedural textures are explained in this station. It is only the starting point to this complex topic.


  1. Run the script and check the functionality of the functions.
  2. Change the parameters of a texture.
  3. Set material and texture to a new object.

All types in one image – the mapping types will be shown in a separate station. On the picture you can see the names of the textures and how the rendered objects looks like.


Code used to render the image

Name: ''
Blender: 2.69
Group: 'Materials and Textures'
Tooltip: 'Texturen procedurale'

import bpy

def materialcheck(obj, materialtype):
    """ Put a procedural textur on a object."""

    # used names
    matname = "mat" + materialart
    texname = "tex" + materialart

    # new material
    material =
    material.diffuse_color = (0, .5, 0)

    # new texture
    textur =, type=materialart)

    # lits all properties and methods of a texture
    # print(dir(textur))

    # connect texture with material[matname].texture_slots.add()[matname].active_texture = textur

if __name__ == '__main__':

    # switch to object mode if edit mode is activ
    if bpy.ops.object.mode_set.poll():

    # clear the scene
    # all names of procedurale texturen, without IMAGE and LANDSCAPE
    materials = ['BLEND',

    x, y, z = 1, 0, 1
    for i in materials:
        # new line in the middle of the list
        if z % 7 == 0:
            y = 4
            x = 1
        bpy.ops.mesh.primitive_cylinder_add(location=(x, y, 0))
        obj = = 'obj-%0.2d' % (z)
        obj = bpy.context.scene.objects['obj-%0.2d' % (z)]

        x += 3
        z += 1
        materialcheck(obj, materialtype=i)
hint:Run the script, set the camera on the right position and start the menu sequence: Render » Render Image.
Every texture has more or less parameters. In the property panel all parameters are changeable. The names of parameters are printed with the dir command.

Output example for the texture »WOOD«:

['__doc__', '__module__', '__slots__', 'animation_data',
 'animation_data_clear', 'animation_data_create', 'bl_rna',
 'color_ramp', 'contrast', 'copy', 'evaluate', 'factor_blue',
 'factor_green', 'factor_red', 'intensity', 'is_library_indirect',
 'is_updated', 'is_updated_data', 'library', 'nabla', 'name',
 'node_tree', 'noise_basis', 'noise_basis_2', 'noise_scale',
 'noise_type', 'rna_type', 'saturation', 'tag', 'turbulence',
 'type', 'update_tag', 'use_color_ramp', 'use_fake_user',
 'use_nodes', 'use_preview_alpha', 'user_clear', 'users',