datumhue.material.standard(opts: material.MaterialStandardOptions) -> MaterialCreate a physically-based material. Lit by the scene; supports PBR texture maps, transparency, and clearcoat. Apply it via a mesh's material option or node:update.
local brass = datumhue.material.standard({
color = datumhue.color("#dbbc7f"),
metallic = 0.8,
roughness = 0.3,
})
scene:sphere({ material = brass })
scene:cube({ pos = datumhue.math.vec3(1.5, 0, 0), material = brass })opts material.MaterialStandardOptions options 18 keys, 4 inherited
| Key | Type | Default | Description |
|---|---|---|---|
| texture | Image | the base color alone, unless texture_source or shader is given | Base-color texture from an image asset. |
| texture_source | Image | DrawCanvas | Scene | the texture image, if any | Base-color texture from a source handle (image / draw canvas / scene), used in place of texture. |
| shader | Shader | the base color and texture alone | Custom shader whose output is the base color, lit by the scene's lights, shadows and fog as a texture is; color multiplies it. Its uniforms, channels, reloads and dh.time reach the mesh as they reach a panel. Raises together with texture or texture_source. |
| normal_map | Image | the mesh's own normals | Tangent-space normal map. |
| occlusion | Image | no ambient occlusion | Ambient-occlusion map (grayscale; darkens crevices). |
| metallic_roughness | Image | the uniform metallic and roughness | Combined metallic (blue channel) + roughness (green channel) map. |
| emissive_texture | Image | the uniform emissive color | Emissive map, modulated by the emissive color. |
| alpha_mode | "opaque" | "mask" | "blend" | "premultiplied" | "add" | "multiply" | "opaque" | Transparency handling. |
| alpha_cutoff | number | 0.5 | Threshold for the mask alpha mode, 0..1; ignored by other modes. |
| double_sided | boolean | false | Render both faces, disabling back-face culling. |
| reflectance | number | 0.5 | Specular reflectance at normal incidence, 0..1. |
| ior | number | 1.5 | Index of refraction. |
| clearcoat | number | 0 | Clearcoat layer strength, 0..1; 0 is no clearcoat. |
| clearcoat_roughness | number | 0 | Clearcoat layer perceptual roughness, 0..1. |
| From material.PbrMaterialOptions | |||
| color | Color | datumhue.color(1, 1, 1) | Base color. |
| metallic | number | 0 | Metallic factor. |
| roughness | number | 0.5 | Perceptual roughness. |
| emissive | Color | datumhue.color(0, 0, 0) | Emissive color. |