Skip to main content
We’ll write a chams material from scratch: scanlines climbing the body, a bright rim, halftone dots behind walls, and a speed slider in the menu. It replaces the cheat’s own chams on enemies. Everything here is @native/scene. No pipelines, no buffers.

Step 1: The surface

A material is one HLSL function. It gets the pixel (position, normal, how much it faces you, time…) and returns a color. Create src/index.ts:
params become fields of p. Each keeps its type: speed is a float, rimColor a float4 in 0..1.

Step 2: Draw it on enemies

replace: true switches the cheat’s own chams off for those players while you draw them. Drop it and you get both, one on top of the other. The model comes from the same skinned pose the cheat’s chams use, in the same frame, so it doesn’t trail behind the player.

Step 3: X-ray with its own look

Turn on xray and the material runs a second time for the parts behind walls, with s.occluded = true and s.color set to occludedColor. Branch on it:
camera is the frame camera from gpu.hlsli, already declared for you.

Step 4: A menu

Material properties and parameters can change any time; the upload happens once a frame.
ui.effect re-runs whenever a value it reads changes, so the material follows the menu with no polling.

When it doesn’t show up

  • A compile error goes to the log once, with your line numbers. Until the material compiles, its draws are skipped.
  • Return straight alpha: the scene premultiplies for you.
  • scene.player only works inside on("render"), like every draw call.