xhookLua
Game

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)
NameTypeDescription
playerinteger | EntityPlayers and NPC targets.
optstableSee 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)
NameType
playerinteger | Entity

Drops the override now; the menu's chams take over.

chams.shader

chams.shader([src]) -> boolean [, err]
NameTypeDescription
srcoptionalstring | nilGLSL 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]])
NameTypeDescription
namestringDeclared in your shader.
anumber
boptionalnumberMakes it a vec2.
coptionalnumberMakes 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

NameTypeDescription
modestring | integerVisible material; absent or "none" keeps menu's.
color{ r, g, b [, a] } | integer0 to 255 table or draw.color(); default white.
occludedstring | integerBehind-wall material; absent or "none" skips it.
occluded_color{ r, g, b [, a] } | integerBehind-wall colour; defaults to color.
wireframebooleanWireframe on both passes.
hidebooleanSkips the model; other fields ignored.

Constants

NameValueDescription
chams.modes.none0mode: menu's material. occluded: no behind-wall pass.
chams.modes.flat1Flat unlit colour.
chams.modes.shaded2Colour with simple shading.
chams.modes.texture4Model's own texture, tinted.
chams.modes.metallic5
chams.modes.gradient6Vertical gradient from the menu's gradient editor.
chams.modes.glow7Fresnel rim glow.
chams.modes.iridescent9Hue shifts with view angle and time.
chams.modes.toon10Banded toon lighting, dark outline.
chams.modes.outline11Fresnel-edge silhouette, transparent body.
chams.modes.crystal14Faceted gem with reflections.
chams.modes.chrome18Mirror chrome reflecting sky and world.
chams.modes.halftone25Comic dot-screen.
chams.modes.sketch26Pencil cross-hatching.
chams.modes.cel33Cel shading in the picked colour.
chams.modes.cel_textured34Cel shading over the model's skin colours.
chams.modes.cel_glossy35Textured cel plus a mild reflection.
chams.modes.neon36Dark body, bright neon edge.
chams.modes.custom62Your chams.shader; flat until one is installed.
chams.modes.material63Material Creator's material; flat in builds without it.
chams ยท Lua API ยท xhook