tsl-materials
Skill4 starsChanged 16 days agoMITView on GitHub
Create physically convincing custom materials and shaders with Three.js TSL node materials on WebGPU. Use as the parent material/shader skill for glass, water, metal, paint, rust, plastic, concrete, window interiors and other materials.
In this repository28 other files it gives its agents.
- character-cameraSkill
- character-inputSkill
- character-kitSkill
- character-modelSkill
- character-walkingSkill
- engineered-environmentsSkill
- megacitySkill
- station-maglevSkill
- greenhouseSkill
- pipesSkill
- procedural-geometrySkill
- signageSkill
- indirect-lightingSkill
- lightingSkill
- glassSkill
- interior-mappingSkill
- material-compositionSkill
- metalSkill
- paintSkill
- rustSkill
- waterSkill
- threejs-directorSkill
- card-grassSkill
- far-shadeSkill
- ocean-waterSkill
- photo-skySkill
- snow-weatherSkill
- jolt-drivingSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Prefer reusable TSL node graphs and material functions over monolithic shaders.
- Distinctive: line 61
Do not add every effect to every material.
- Distinctive: line 75
Use physically meaningful causes for variation.
- Distinctive: line 77
Do not use procedural noise merely because it looks interesting.
- Distinctive: line 81
Prefer inexpensive procedural nodes for broad variation.
- Distinctive: line 83
Use environment lighting/reflections where a material depends on reflected surroundings.
- Distinctive: line 87
Prefer reusable ES module functions such as:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TSL Materials
Target: Three.js 0.187.0, three/webgpu and TSL node materials from three/tsl; WebGPU only, no WebGL fallback, no GLSL strings.
Prefer reusable TSL node graphs and material functions over monolithic shaders.
Sibling skills
This is the parent skill. For a particular material, load the matching sibling as well:
glass: windows, windscreens, canopies, portholes, building windows, transparent panelsmetal: bare, brushed, cast, galvanised and structural metalpaint: painted surfaces as layered coatings, wear and dirtrust: oxidation and corrosion as a layered surface transformationwater: lakes, rivers, reservoirs, puddles and wet surfacesmaterial-composition: combining these into coherent multi-material objectsinterior-mapping: fake rooms behind the windows of buildings that cannot be entered
Material vocabulary
Reason about a material using:
- base colour / diffuse response
- metalness
- specular intensity and colour
- roughness / gloss
- normal perturbation
- micro-normal detail
- clearcoat
- clearcoat roughness
- anisotropy
- transmission
- IOR
- thickness
- attenuation colour and distance
- reflection
- refraction
- Fresnel response
- emission
- iridescence where physically appropriate
- dirt, wear and damage masks
Three.js physical node materials expose many of these properties directly, including transmission, thickness, IOR, clearcoat, anisotropy, dispersion and specular controls.
Layered thinking
A realistic material is usually a combination of:
- macro shape
- base material response
- microstructure
- large-scale variation
- wear/age
- environmental interaction
Do not add every effect to every material.
Scale
Separate macro, meso and micro detail.
Macro: colour blocks, corrosion regions, panels, major stains. Meso: scratches, brushed grain, dents, dirt accumulation. Micro: fine roughness and normal variation.
Microdetail should not change the silhouette unless explicitly intended.
Physical plausibility
Use physically meaningful causes for variation. Dirt accumulates in creases, water collects in low areas, paint wears at exposed edges, polished metal has directional highlights, and rough surfaces produce broader reflections.
Do not use procedural noise merely because it looks interesting.
Performance
Prefer inexpensive procedural nodes for broad variation. Reuse nodes/material functions. Avoid unnecessary texture samples and expensive loops. Keep high-frequency effects subtle and screen-space aware.
Use environment lighting/reflections where a material depends on reflected surroundings.
API style
Prefer reusable ES module functions such as:
createMetalMaterial() createPaintMaterial() createGlassMaterial() createWaterMaterial() createRustMaterial()
Expose meaningful parameters rather than dozens of low-level shader controls. Keep live values in uniforms so they can change without recompiling the material.
import * as THREE from 'three/webgpu';
import { uniform, float, positionWorld, mx_fractal_noise_float } from 'three/tsl';
// Moulded plastic with broad, world-anchored tone variation.
export function createPlasticMaterial({
color = 0x3a6ea5, roughness = 0.45, variation = 0.08, scale = 0.6, coat = 0.2,
} = {}) {
const base = uniform(new THREE.Color(color));
const amount = uniform(variation);
const n = mx_fractal_noise_float(positionWorld.mul(scale)); // roughly -1..1
const material = new THREE.MeshPhysicalNodeMaterial({
metalness: 0, clearcoat: coat, clearcoatRoughness: 0.3,
});
material.colorNode = base.mul(n.mul(amount).add(1.0));
material.roughnessNode = float(roughness).add(n.mul(0.05)).clamp(0.02, 1.0);
material.userData.uniforms = { base, amount }; // live controls
return material;
}Share one material between every mesh that looks the same; make a second only when the parameters differ.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

