chams
Per-player materials on xhook's GPU chams; call chams.set every frame from on_paint or the menu takes over.
Functions
chams.set
chams.set(player, opts)| Name | Type | Description |
|---|---|---|
| player | integer | Entity | Players and NPC targets. |
| opts | table | See fields. |
Overrides one player's chams material for this frame.
- Raises an error on an unknown material or a non-number, non-Entity player.
- Skips spectators and the local player outside thirdperson; dead players get no behind-wall pass.
chams.clear
chams.clear(player)| Name | Type |
|---|---|
| player | integer | Entity |
Drops the override now; the menu's chams take over.
chams.shader
chams.shader([src]) -> boolean [, err]| Name | Type | Description |
|---|---|---|
| srcoptional | string | nil | GLSL 1.20 fragment; nil or "" removes. Default nil. |
Fragment shader for the "custom" material, linked to the skinning vertex shader.
Returns true, or false plus the GLSL error
- On failure the previous shader stays.
- Shared by all scripts, last call wins; clearing it also clears every uniform.
chams.uniform
chams.uniform(name, a [, b [, c]])| Name | Type | Description |
|---|---|---|
| name | string | Declared in your shader. |
| a | number | |
| boptional | number | Makes it a vec2. |
| coptional | number | Makes it a vec3. |
Sets a float, vec2 or vec3 uniform until changed or cleared.
Raises an error with no numbers; a 4th value is ignored.
Fields
| Name | Type | Description |
|---|---|---|
| mode | string | integer | Visible material; absent or "none" keeps menu's. |
| color | { r, g, b [, a] } | integer | 0 to 255 table or draw.color(); default white. |
| occluded | string | integer | Behind-wall material; absent or "none" skips it. |
| occluded_color | { r, g, b [, a] } | integer | Behind-wall colour; defaults to color. |
| wireframe | boolean | Wireframe on both passes. |
| hide | boolean | Skips the model; other fields ignored. |
Constants
| Name | Value | Description |
|---|---|---|
| chams.modes.none | 0 | mode: menu's material. occluded: no behind-wall pass. |
| chams.modes.flat | 1 | Flat unlit colour. |
| chams.modes.shaded | 2 | Colour with simple shading. |
| chams.modes.texture | 4 | Model's own texture, tinted. |
| chams.modes.metallic | 5 | |
| chams.modes.gradient | 6 | Vertical gradient from the menu's gradient editor. |
| chams.modes.glow | 7 | Fresnel rim glow. |
| chams.modes.iridescent | 9 | Hue shifts with view angle and time. |
| chams.modes.toon | 10 | Banded toon lighting, dark outline. |
| chams.modes.outline | 11 | Fresnel-edge silhouette, transparent body. |
| chams.modes.crystal | 14 | Faceted gem with reflections. |
| chams.modes.chrome | 18 | Mirror chrome reflecting sky and world. |
| chams.modes.halftone | 25 | Comic dot-screen. |
| chams.modes.sketch | 26 | Pencil cross-hatching. |
| chams.modes.cel | 33 | Cel shading in the picked colour. |
| chams.modes.cel_textured | 34 | Cel shading over the model's skin colours. |
| chams.modes.cel_glossy | 35 | Textured cel plus a mild reflection. |
| chams.modes.neon | 36 | Dark body, bright neon edge. |
| chams.modes.custom | 62 | Your chams.shader; flat until one is installed. |
| chams.modes.material | 63 | Material Creator's material; flat in builds without it. |