MeshDepthMaterial

Qualified name: algan.rendering.shaders.materials.MeshDepthMaterial

class MeshDepthMaterial(color=None, *, near=0.1, far=100.0, **kwargs)[source]

Bases: Material

Renders camera distance as grayscale (near=bright, far=dark).

Methods

get_shader_param_values

Map of {shader_param_name: value} matching this material's shader signature.

shader

MeshDepthMaterial: grayscale by camera distance, near=bright, far=dark.

Attributes

applies_color

Whether the material's color should drive the mob's base color.

applies_color = False

Whether the material’s color should drive the mob’s base color. Even then, the default color=None means “keep the mob’s existing color” – unlike Three.js, where an unset material color is white – so Sphere(color=RED).set_material(MeshPhysicalMaterial()) stays red.

get_shader_param_values()[source]

Map of {shader_param_name: value} matching this material’s shader signature. Base materials expose no extra parameters.

static shader(memory, vertex_location, vertex_normal, albedo_color, camera_location, light_origin, light_color, light_intensity, ambient_light_intensity, near=0.1, far=100.0)

MeshDepthMaterial: grayscale by camera distance, near=bright, far=dark.

Approximates Three.js depth packing with a simple linear luminance ramp.

Parameters:
  • light_intensity (float)

  • ambient_light_intensity (float)

  • near (float)

  • far (float)