Module Material
[frames] | no frames]

Module Material

The Blender.Material submodule.

New: access to shader data.

Material

This module provides access to Material objects in Blender.

Example:

       import Blender
       from Blender import Material
       mat = Material.New('newMat')          # create a new Material called 'newMat'
       print mat.rgbCol                      # print its rgb color triplet sequence
       mat.rgbCol = [0.8, 0.2, 0.2]          # change its color
       mat.setAlpha(0.2)                     # mat.alpha = 0.2 -- almost transparent
       mat.emit = 0.7                        # equivalent to mat.setEmit(0.8)
       mat.mode |= Material.Modes.ZTRANSP    # turn on Z-Buffer transparency
       mat.setName('RedBansheeSkin')         # change its name
       mat.setAdd(0.8)                       # make it glow
       mat.setMode('Halo')                   # turn 'Halo' "on" and all others "off"
Classes
  Material
This object gives access to Materials in Blender.
Functions
Blender Material
New(name='Mat')
Create a new Material object.
Blender Material or a list of Blender Materials
Get(name=None)
Get the Material object(s) from Blender.
Variables
readonly dictionary ColorbandInput
The available Colorband Input sources.
readonly dictionary ColorbandMethod
The available Colorband mixing methods.
readonly dictionary Modes
The available Material Modes.
readonly dictionary ShadeModes
The available Material Shade Modes.
readonly dictionary Shaders
The available Material Shaders.
  __package__ = None
Function Details

New(name='Mat')

 

Create a new Material object.

Parameters:
  • name (string) - The Material name.
Returns: Blender Material
The created Material object.

Get(name=None)

 

Get the Material object(s) from Blender.

Parameters:
  • name (string) - The name of the Material.
Returns: Blender Material or a list of Blender Materials
It depends on the 'name' parameter:
  • (name): The Material object with the given name;
  • (): A list with all Material objects in the current scene.

Variables Details

ColorbandInput

The available Colorband Input sources.
  • ENERGY - Make Material use the Energy input.
  • NORMAL - Make Material use the Normal input.
  • RESULT - Make Material use the Result input.
  • SHADER - Make Material use the Shader input.
Type:
readonly dictionary

ColorbandMethod

The available Colorband mixing methods.
  • ADD - Make Material use the Add method.
  • BLEND - Make Material use the Blend/Mix method.
  • BURN - Make Material use the Burn method.
  • COLOR - Make Material use the Color method.
  • DARK - Make Material use the Darken method.
  • DIFF - Make Material use the Difference method.
  • DIV - Make Material use the Divide method.
  • DODGE - Make Material use the Dodge method.
  • HUE - Make Material use the Hue method.
  • LIGHT - Make Material use the Lighten method.
  • MIX - Make Material use the Blend/Mix method.
  • MULT - Make Material use the Multiply method.
  • OVERLAY - Make Material use the Overlay method.
  • SAT - Make Material use the Saturation method.
  • SCREEN - Make Material use the Screen method.
  • SUB - Make Material use the Substract method.
  • VAL - Make Material use the Value method.
Type:
readonly dictionary

Modes

The available Material Modes.

Note: Some Modes are only available when the 'Halo' mode is off and others only when it is on. But these two subsets of modes share the same numerical values in their Blender C #defines. So, for example, if 'Halo' is on, then 'NoMist' is actually interpreted as 'HaloShaded'. We marked all such possibilities in the Modes dict below: each halo-related mode that uses an already taken value is preceded by "+" and appear below the normal mode which also uses that value.

  • TRACEABLE - Make Material visible for shadow lamps.
  • SHADOW - Enable Material for shadows.
  • SHADOWBUF - Enable Material to cast shadows with shadow buffers.
  • SHADELESS - Make Material insensitive to light or shadow.
  • WIRE - Render only the edges of faces.
  • VCOL_LIGHT - Add vertex colors as extra light.
  • VCOL_PAINT - Replace basic colors with vertex colors.
  • HALO - Render as a halo.
  • ZTRANSP - Z-buffer transparent faces.
  • ZINVERT - Render with inverted Z-buffer.
  • + HALORINGS - Render rings over the basic halo.
  • ENV - Do not render Material.
  • + HALOLINES - Render star shaped lines over the basic halo.
  • ONLYSHADOW - Let alpha be determined on the degree of shadow.
  • + HALOXALPHA - Use extreme alpha.
  • TEXFACE - UV-Editor assigned texture gives color and texture info for faces.
  • TEXFACE_ALPHA - When TEXFACE is enabled, use the alpha as well.
  • + HALOSTAR - Render halo as a star.
  • NOMIST - Set the Material insensitive to mist.
  • + HALOSHADED - Let halo receive light.
  • HALOTEX - Give halo a texture.
  • HALOPUNO - Use the vertex normal to specify the dimension of the halo.
  • HALOFLARE - Render halo as a lens flare.
  • RAYMIRROR - Enables raytracing for mirror reflection rendering.
  • RAYTRANSP - Enables raytracing for transparency rendering.
  • RAYBIAS - Prevent ray traced shadow errors with Phong interpolated normals.
  • RAMPCOL - Status of colorband ramp for Material's diffuse color. This is a read-only bit.
  • RAMPSPEC - Status of colorband ramp for Material's specular color. This is a read-only bit.
  • TANGENTSTR - Uses direction of strands as normal for tangent-shading.
  • TRANSPSHADOW - Lets Material receive transparent shadows based on material color and alpha.
  • FULLOSA - Force rendering of all OSA samples.
  • TANGENT_V - Use the tangent vector in V direction for shading
  • NMAP_TS - Tangent space normal mapping.
  • GROUP_EXCLUSIVE - Light from this group even if the lights are on a hidden Layer.
Type:
readonly dictionary

ShadeModes

The available Material Shade Modes.
  • CUBIC - Use cubic interpolation of diffuse values, for smoother transitions.
  • OBCOLOR - Modulate result with a per object color.
Type:
readonly dictionary

Shaders

The available Material Shaders.
  • DIFFUSE_LAMBERT - Make Material use the lambert diffuse shader.
  • DIFFUSE_ORENNAYAR - Make Material use the Oren-Nayer diffuse shader.
  • DIFFUSE_TOON - Make Material use the toon diffuse shader.
  • DIFFUSE_MINNAERT - Make Material use the minnaert diffuse shader.
  • SPEC_COOKTORR - Make Material use the Cook-Torr specular shader.
  • SPEC_PHONG - Make Material use the Phong specular shader.
  • SPEC_BLINN - Make Material use the Blinn specular shader.
  • SPEC_TOON - Make Material use the toon specular shader.
  • SPEC_WARDISO - Make Material use the Ward-iso specular shader.
Type:
readonly dictionary