handle 2 methods, 10 fields UI apps only
Material A material handle returned by datumhue.material.*. Materials are 3D-only: 2D and UI surfaces take a Shader instead.
Obtained from datumhue.material.standard , datumhue.material.unlitAccepted by datumhue.voxel.new , Scene:cube , Scene:sphere , Scene:plane , Scene:cylinder , Scene:capsule , Scene:torus , Scene:cone and 2 moreThe examples on this page start from:
Material: set_sourcemethod Set or clear the base-color texture from a source (image / draw canvas / scene). Either drops a base-color shader.
Example
local canvas = datumhue .draw.new ({ width = 64 , height = 64 })
canvas:circle ({
pos = datumhue .math.vec2 (0 , 0 ),
radius = 24 ,
color = color ("#e67e80" ),
})
material:set_source (canvas)
Material: updatemethod Batch-update the material's fields.
Example
material:update ({ metallic = 0.9 , roughness = 0.25 })
print (material.roughness) opts material.UpdateOptions options 17 keys Omitted keys keep their current value.
Key Type Description color Color New base color. metallic number Metallic factor (0..1). roughness number Perceptual roughness (0..1). emissive Color Emissive color. source Image | DrawCanvas | Scene Base-color texture source (image / draw canvas / scene), in place of a base-color shader. shader Shader Custom shader whose output is the base color, lit, as shader in material.standard , in place of a texture source; raises together with source. A source or Material:set_source drops it. normal_map Image Tangent-space normal map. occlusion Image Ambient-occlusion map (grayscale). metallic_roughness Image Combined metallic + roughness map. emissive_texture Image Emissive map, modulated by the emissive color. alpha_mode "opaque" | "mask" | "blend" | "premultiplied" | "add" | "multiply" Transparency handling. alpha_cutoff number Threshold for the mask alpha mode, 0..1. Read only together with alpha_mode, which takes a 0.5 threshold when this is left out. double_sided boolean Render both faces (disables back-face culling). reflectance number Specular reflectance at normal incidence, 0..1. ior number Index of refraction. clearcoat number Clearcoat layer strength, 0..1. clearcoat_roughness number Clearcoat layer perceptual roughness, 0..1.