pygfx.materials.MeshBasicMaterial

class pygfx.materials.MeshBasicMaterial(env_map=None, wireframe=False, wireframe_thickness=1, flat_shading=False, reflectivity=1.0, refraction_ratio=0.98, env_combine_mode='MULTIPLY', env_mapping_mode='CUBE-REFLECTION', **kwargs)

Bases: MeshAbstractMaterial

Basic mesh material.

A material for drawing geometries in a simple shaded (flat or wireframe) way. This material is not affected by lights.

Parameters:
  • env_map (Texture) – The environment map.

  • wireframe (bool) – If True, render geometry as a wireframe, i.e., only render edges.

  • wireframe_thickness (int) – The thickness of a rendered edge in screen pixels.

  • flat_shading (bool) – If True, the shader will ignore the geometry’s normal data and instead use face normals during lighting calculations.

  • reflectivity (float) – How much the environment map affects the surface. also see env_combine_mode. The default value is 1 and the valid range is between 0 (no reflections) and 1 (full reflections).

  • refraction_ratio (float) – The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of the material. It is used with env_mapping_mode set to “REFRACTION”.

  • env_combine_mode (str) – How the environment map affects the surface. The default value is “MULTIPLY” and the valid values are “MULTIPLY”, “MIX”, and “ADD”.

  • env_mapping_mode (str) – The environment mapping mode. The default value is “CUBE-REFLECTION” and the valid values are “CUBE-REFLECTION” and “CUBE-REFRACTION”.

  • kwargs (Any) – Additional kwargs will be passed to the base class.

property env_map

The environment map.

property wireframe

Render geometry as a wireframe. Default is False (i.e. render as polygons).

property wireframe_thickness

The thickness of the lines when rendering as a wireframe.

property flat_shading

Whether the mesh is rendered with flat shading. When true, the shader will apply per-face surface normals, resulting in per-face lighting and a “pixelated”, non-interpolated look, which can be useful to show the (size of) the triangle faces, or simply for the retro appearance. Note that the face normals are calculated from the vertex positions, ignoring the normal data in the geometry.

property reflectivity

How much the environment map affects the surface. also see env_combine_mode. The default value is 1 and the valid range is between 0 (no reflections) and 1 (full reflections).

property refraction_ratio

The index of refraction (IOR) of air (approximately 1) divided by the index of refraction of the material. It is used with env_mapping_mode set to “REFRACTION”.

property env_combine_mode

How the environment map affects the surface. The default value is “MULTIPLY” and the valid values are “MULTIPLY”, “MIX”, and “ADD”.

property env_mapping_mode

The environment mapping mode. The default value is “REFLECTION” and the valid values are “CUBE-REFLECTION” and “CUBE-REFRACTION”.

property light_map

The light map to define pre-baked lighting (in srgb). Default is None. It requires a second set of texture coordinates (geometry.texcoords1).

property light_map_intensity

Intensity of the baked light. Scaling occurs in the physical color space. Default is 1.0.

property ao_map

The red channel of this texture is used as the ambient occlusion map. Default is None. It requires a second set of texture coordinates (geometry.texcoords1).

property ao_map_intensity

Intensity of the ambient occlusion effect. Default is 1.0, zero is no occlusion effect.