ke.material

Python-friendly surface material authoring and renderer material presets.

API overview

Material

Base facade wrapping a native renderer material.

VertexColorMaterial

Material using vertex/display colors and an optional built-in style.

PhongMaterial

Blinn-Phong material with factors and optional texture maps.

PBRMaterial

Metallic-roughness PBR material with factors and optional textures.

class kangengine.material.Material(native: Any | None = None)[python]

Bases: NativeWrapper

Base facade wrapping a native renderer material.

class kangengine.material.VertexColorMaterial(
style=<VertexColorStyle.UNTEXTURED: 0>,
native: Any | None = None,
)[python]

Bases: Material

Material using vertex/display colors and an optional built-in style.

set_style(style: VertexColorStyle) VertexColorMaterial

Set the rendering style and return this material.

Return type:

VertexColorMaterial

property style

Return the active built-in vertex-color style.

class kangengine.material.PhongMaterial(preset=None, native: Any | None = None)[python]

Bases: Material

Blinn-Phong material with factors and optional texture maps.

property alpha_map

Optional alpha-mask texture, such as OBJ map_d.

property ambient

Ambient RGB factor.

property diffuse

Diffuse RGB factor.

property diffuse_map

Optional diffuse texture.

load_from_preset(preset: PhongMaterialType) PhongMaterial

Load a built-in preset and return this material.

Return type:

PhongMaterial

property normal_map

Optional tangent-space normal map.

set_alpha_map(texture: Texture | None) PhongMaterial

Set the alpha map and return this material.

Return type:

PhongMaterial

set_ambient(ambient: Any) PhongMaterial

Set the ambient factor and return this material.

Return type:

PhongMaterial

set_diffuse(diffuse: Any) PhongMaterial

Set the diffuse factor and return this material.

Return type:

PhongMaterial

set_diffuse_map(texture: Texture | None) PhongMaterial

Set the diffuse map and return this material.

Return type:

PhongMaterial

set_normal_map(texture: Texture | None) PhongMaterial

Set the normal map and return this material.

Return type:

PhongMaterial

set_shininess(shininess: float) PhongMaterial

Set the highlight exponent and return this material.

Return type:

PhongMaterial

set_specular(specular: Any) PhongMaterial

Set the specular factor and return this material.

Return type:

PhongMaterial

set_specular_map(texture: Texture | None) PhongMaterial

Set the specular map and return this material.

Return type:

PhongMaterial

property shininess

Specular highlight exponent.

property specular

Specular RGB factor.

property specular_map

Optional specular texture.

class kangengine.material.PBRMaterial(preset=None, native: Any | None = None)[python]

Bases: Material

Metallic-roughness PBR material with factors and optional textures.

property ao_texture

Optional ambient-occlusion texture.

property base_color

Base-color RGBA factor.

property base_color_texture

Optional base-color texture.

property emissive_color

Emissive RGB factor.

property emissive_strength

Multiplier applied to the emissive color.

property emissive_texture

Optional emissive texture.

load_from_preset(preset: PBRMaterialType) PBRMaterial

Load a built-in preset and return this material.

Return type:

PBRMaterial

property metallic

Metallic factor in the range 0..1.

property metallic_roughness_texture

Optional packed metallic-roughness texture.

property metallic_texture

Optional single-channel metallic texture.

property normal_texture

Optional tangent-space normal texture.

property orm_texture

Optional packed occlusion-roughness-metallic texture.

property roughness

Roughness factor in the range 0..1.

property roughness_texture

Optional single-channel roughness texture.

set_ao_texture(texture: Texture | None) PBRMaterial

Set the ambient-occlusion texture and return this material.

Return type:

PBRMaterial

set_base_color(base_color: Any) PBRMaterial

Set the base-color factor and return this material.

Return type:

PBRMaterial

set_base_color_texture(texture: Texture | None) PBRMaterial

Set the base-color texture and return this material.

Return type:

PBRMaterial

set_emissive_color(emissive_color: Any) PBRMaterial

Set the emissive color and return this material.

Return type:

PBRMaterial

set_emissive_strength(
emissive_strength: float,
) PBRMaterial

Set the emissive strength and return this material.

Return type:

PBRMaterial

set_emissive_texture(texture: Texture | None) PBRMaterial

Set the emissive texture and return this material.

Return type:

PBRMaterial

set_metallic(metallic: float) PBRMaterial

Set the metallic factor and return this material.

Return type:

PBRMaterial

set_metallic_roughness_texture(texture: Texture | None) PBRMaterial

Set the packed metallic-roughness texture and return this material.

Return type:

PBRMaterial

set_metallic_texture(texture: Texture | None) PBRMaterial

Set the metallic texture and return this material.

Return type:

PBRMaterial

set_normal_texture(texture: Texture | None) PBRMaterial

Set the normal texture and return this material.

Return type:

PBRMaterial

set_orm_texture(texture: Texture | None) PBRMaterial

Set the packed ORM texture and return this material.

Return type:

PBRMaterial

set_roughness(roughness: float) PBRMaterial

Set the roughness factor and return this material.

Return type:

PBRMaterial

set_roughness_texture(texture: Texture | None) PBRMaterial

Set the roughness texture and return this material.

Return type:

PBRMaterial

class kangengine.material.PhongMaterialType[native]

Built-in Blinn-Phong material preset.

BLACK_PLASTIC = <PhongMaterialType.BLACK_PLASTIC: 12>
BLACK_RUBBER = <PhongMaterialType.BLACK_RUBBER: 18>
BRASS = <PhongMaterialType.BRASS: 6>
BRONZE = <PhongMaterialType.BRONZE: 7>
CHROME = <PhongMaterialType.CHROME: 8>
COPPER = <PhongMaterialType.COPPER: 9>
CYAN_PLASTIC = <PhongMaterialType.CYAN_PLASTIC: 13>
CYAN_RUBBER = <PhongMaterialType.CYAN_RUBBER: 19>
EMERALD = <PhongMaterialType.EMERALD: 0>
GOLD = <PhongMaterialType.GOLD: 10>
GREEN_PLASTIC = <PhongMaterialType.GREEN_PLASTIC: 14>
GREEN_RUBBER = <PhongMaterialType.GREEN_RUBBER: 20>
JADE = <PhongMaterialType.JADE: 1>
OBSIDIAN = <PhongMaterialType.OBSIDIAN: 2>
PEARL = <PhongMaterialType.PEARL: 3>
RED_PLASTIC = <PhongMaterialType.RED_PLASTIC: 15>
RED_RUBBER = <PhongMaterialType.RED_RUBBER: 21>
RUBY = <PhongMaterialType.RUBY: 4>
SILVER = <PhongMaterialType.SILVER: 11>
TURQUOISE = <PhongMaterialType.TURQUOISE: 5>
WHITE_PLASTIC = <PhongMaterialType.WHITE_PLASTIC: 16>
WHITE_RUBBER = <PhongMaterialType.WHITE_RUBBER: 22>
YELLOW_PLASTIC = <PhongMaterialType.YELLOW_PLASTIC: 17>
YELLOW_RUBBER = <PhongMaterialType.YELLOW_RUBBER: 23>
PhongMaterialType.name -> str
property value
class kangengine.material.PBRMaterialType[native]

Built-in metallic-roughness material preset.

ALUMINUM = <PBRMaterialType.ALUMINUM: 8>
BLACK_PLASTIC = <PBRMaterialType.BLACK_PLASTIC: 2>
BLACK_RUBBER = <PBRMaterialType.BLACK_RUBBER: 3>
CARROT = <PBRMaterialType.CARROT: 5>
CHARCOAL = <PBRMaterialType.CHARCOAL: 4>
CHROME = <PBRMaterialType.CHROME: 9>
CONCRETE = <PBRMaterialType.CONCRETE: 6>
COPPER = <PBRMaterialType.COPPER: 10>
EMISSIVE_BLUE = <PBRMaterialType.EMISSIVE_BLUE: 12>
GOLD = <PBRMaterialType.GOLD: 11>
GRAY_CARD = <PBRMaterialType.GRAY_CARD: 0>
RED_BRICK = <PBRMaterialType.RED_BRICK: 7>
WHITE_PLASTIC = <PBRMaterialType.WHITE_PLASTIC: 1>
PBRMaterialType.name -> str
property value