Material

Each object has a set of material properties which define its color, shininess, smoothness, and response to ambient, diffuse, and specular lighting. Currently, per-vertex coloration and texture mapping are not supported, although we plan to add support for them soon.

MaterialProperties

class meshrender.MaterialProperties(color=array([ 0.5, 0.5, 0.5]), k_a=1.0, k_d=1.0, k_s=1.0, alpha=1.0, smooth=False, wireframe=False)

Bases: object

A set of material properties describing how an object will look.

__init__(color=array([ 0.5, 0.5, 0.5]), k_a=1.0, k_d=1.0, k_s=1.0, alpha=1.0, smooth=False, wireframe=False)

Initialize a set of material properties.

Parameters:
  • color ((3,) float) – The RGB color of the object in (0,1).
  • k_a (float) – A multiplier for ambient lighting.
  • k_d (float) – A multiplier for diffuse lighting.
  • k_s (float) – A multiplier for specular lighting.
  • alpha (float) – A multiplier for shininess (higher values indicate more reflectivity and smaller highlights).
  • smooth (bool) – If True, normals will be interpolated to smooth the mesh.
  • wireframe (bool) – If True, the mesh will be rendered as a wireframe.
color

(3,) float – The RGB color of the object in (0,1).

k_a

float – A multiplier for ambient lighting.

k_d

float – A multiplier for diffuse lighting.

k_s

float – A multiplier for specular lighting.

alpha

float – A multiplier for shininess.

smooth

bool – If True, indicates a smooth rather than piecewise planar surface.

wireframe

bool – If True, the mesh will be rendered as a wireframe.