Material
This class is not intended to be used directly. Use one of the concrete material types such as PhongMaterial, UnlitMaterial, ShaderMaterial, or derive your own material implementation from this class.
Types
Material::Blending enum
Enumerates blending modes used for compositing this material.
| Value | Description |
|---|---|
| None | No blending (default) fragments overwrite existing pixels. |
| Normal | Standard alpha blending. |
| Additive | Adds fragment color to the framebuffer color. |
| Subtractive | Subtracts fragment color from the framebuffer color. |
| Multiply | Multiplies fragment color by the framebuffer color. |
Material::Depth enum
Enumerates depth comparison functions used for depth testing.
| Value | Description |
|---|---|
| Less | Passes if the fragment depth is less than the stored depth. |
| Equal | Passes if the fragment depth is equal to the stored depth. |
| LessEqual | Passes if the fragment depth is less than or equal to the stored depth. |
| Greater | Passes if the fragment depth is greater than the stored depth. |
| GreaterEqual | Passes if the fragment depth is greater than or equal to the stored depth. |
| Always | Always passes regardless of depth value. |
| Never | Never passes regardless of depth value. |
Material::Side enum
Enumerates which side of each polygon is rendered.
| Value | Description |
|---|---|
| Front | Renders front faces only (default). |
| Back | Renders back faces only. |
| TwoSided | Renders both front and back faces. |
Material::Type enum
Enumerates all supported material types.
| Value | Description |
|---|---|
| DepthMaterial | Renders depth only; used internally for shadow map passes. |
| PBRMaterial | Implements physically-based rendering with the metallic workflow. |
| PhongMaterial | Implements the Blinn–Phong lighting model. |
| ShaderMaterial | Uses a custom shader program for rendering. |
| SpriteMaterial | Specialized material for 2D sprites and billboards. |
| UnlitMaterial | Renders without lighting; color appears as-is. |
| Length | Sentinel value representing the number of material types. |
Properties
alpha_test float
Alpha threshold below which fragments are discarded.
Fragments whose final alpha (opacity combined with texture alpha) falls below this value are not rendered. Use for cutout surfaces such as foliage. Unlike transparent, discarded fragments write no depth and require no sorting. A value of 0 disables the test.
float alpha_test {0.0f};Blending mode used when rendering this material.
Blending blending {Blending::Normal};depth_test bool
Enables depth testing.
bool depth_test {true};flat_shaded bool
Enables flat shading.
bool flat_shaded {false};fog bool
Enables scene fog for this material.
bool fog {true};opacity float
Value in the range indicating how transparent the material is.
Blends the material with the framebuffer when transparency is enabled, and contributes to the alpha value tested against alpha_test. Has no effect when both are disabled.
float opacity {1.0f};polygon_offset_factor float
Polygon offset factor used to mitigate z-fighting.
float polygon_offset_factor {0.0f};polygon_offset_units float
Polygon offset units used to mitigate z-fighting.
float polygon_offset_units {0.0f};transparent bool
Enables transparency for this material.
bool transparent {false};visible bool
Controls whether this material is visible when rendering.
bool visible {true};wireframe bool
Enables wireframe rendering.
bool wireframe {false};Functions
Identifies the concrete Material::Type of this material.
virtual Type Material::GetType() const=0;