datumhue.shader.new(opts: shader.CreateOptions) -> ShaderCreate a shader of the given type (the required field that selects the shader kind). color1/color2 are Colors; color2 is optional only for "solid" and required for every other type.
-- Stripes: param1 is their count, param2 their angle in radians.
local stripes = datumhue.shader.new({
type = "stripe",
color1 = datumhue.color("#e69875"),
color2 = datumhue.color("#2d353b"),
param1 = 8,
param2 = math.pi / 4,
})
scene:cube({ material = stripes })opts shader.CreateOptions options 7 keys
| Key | Type | Default | Description |
|---|---|---|---|
| type required | shader.ShaderType | no default | Shader kind. |
| color1 required | Color | no default | Primary color. |
| color2 | Color | a "solid" shader takes none; every other type raises | Secondary color. |
| param1 | number | 0 | First shader parameter. |
| param2 | number | 0 | Second shader parameter. |
| animated | boolean | false | Animate the shader. |
| source | Image | DrawCanvas | Scene | no texture is bound | Texture source handle (pixel / draw canvas / scene). |
In the guide: Shaders