Skip to content
Skillv1.0.0

threejs-materials

Choose, configure, and optimize Three.js mesh materials: basic, Lambert, Phong, Standard, Physical, toon, points, lines, and shader-backed surfaces; PBR maps, transparency, environment reflections, cl

by akillness(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from akillness/jeo-skills (.agent-skills/threejs-materials/SKILL.md). Install upstream with npx skills add akillness/jeo-skills --skill threejs-materials. Copyright stays with the author (MIT).

Three.js Materials

Use this skill for mesh surface semantics and cost. Route image maps/UVs/HDR assets to threejs-textures, lighting and shadow setup to threejs-lighting, and custom GLSL to threejs-shaders.

When to use this skill

  • Select a material type that matches unlit, classic-lighting, PBR, stylized, or custom work
  • Configure base color, metalness, roughness, normal/AO/emissive maps, and environment response
  • Fix transparency sorting, invisible backsides, unexpectedly shared edits, or material leaks
  • Reduce material variants, shader complexity, or draw-call fragmentation after profiling

Instructions

Step 1: Choose the simplest material that expresses the intent

Requirement Default material
No lighting / debug / sprite-like mesh MeshBasicMaterial
Low-cost classic diffuse scene MeshLambertMaterial
Classic specular look MeshPhongMaterial
Normal physically based surface MeshStandardMaterial
Clearcoat, transmission, advanced PBR MeshPhysicalMaterial
Cel-shaded style MeshToonMaterial
Custom vertex/fragment program ShaderMaterial via threejs-shaders

Start with MeshStandardMaterial for normal PBR work, then add physical features only when their visual benefit justifies the shader cost and renderer support.

Step 2: Set PBR inputs coherently

const material = new THREE.MeshStandardMaterial({
  color: 0x9ca3af,
  metalness: 0.65,
  roughness: 0.28,
  map: baseColorTexture,
  normalMap,
  roughnessMap,
  metalnessMap,
  envMapIntensity: 1,
});

Base-color textures need the correct color-space configuration; data maps such as normal, roughness, metalness, and AO do not use the same display color treatment. See threejs-textures for map loading and UV-channel requirements. Evaluate material values under representative lights and an environment map, not in an unlit empty scene.

Step 3: Handle transparency explicitly

Use transparent: true only when alpha blending is necessary. Set depthWrite, side, alphaTest, and renderOrder based on a diagnosed visual requirement; broad render-order overrides can hide an underlying sort problem. Prefer alpha test for hard-cut foliage/decals when it satisfies the desired appearance.

Step 4: Respect material ownership

Materials are commonly shared. A mutation to mesh.material.color changes every consumer of that material. Clone before per-object changes, keep the clone's lifecycle explicit, and call dispose() when its final consumer leaves.

const uniqueMaterial = sharedMaterial.clone();
mesh.material = uniqueMaterial;
uniqueMaterial.color.set("#3b82f6");

Step 5: Verify look and cost

  • Test direct light, environment response, shadows, and a neutral background.
  • Test transparent objects overlapping one another and opaque geometry.
  • Inspect whether a change creates many distinct material/program variants.
  • Test cleanup for replaced or cloned materials and their owned maps.

Examples

Metal product surface

Use MeshStandardMaterial, a calibrated base color, metallic/roughness maps, and an HDR environment. A metallic object with no environment has little to reflect; adding arbitrary point lights is not a substitute for the missing IBL signal.

Per-object highlight

Clone a shared material only if the highlight cannot be represented through a uniform, instance attribute, outline pass, or other non-duplicating mechanism. Restore/dispose it when selection changes.

Best practices

  1. Match material choice to the rendering intent before adjusting many parameters.
  2. Keep texture color-space and UV-channel rules correct; a wrong map interpretation is not fixable with roughness guesses.
  3. Minimize material variants in repeated geometry.
  4. Measure expensive physical/transmission features on target devices.
  5. Dispose clones and their feature-owned textures, but never dispose shared assets early.

References

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/akillness-jeo-skills-threejs-materials/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

akillness-jeo-skills-threejs-materials.ocm.jsonjson
{
  "ocm": "1",
  "id": "akillness-jeo-skills-threejs-materials",
  "kind": "skill",
  "name": "threejs-materials",
  "description": "Choose, configure, and optimize Three.js mesh materials: basic, Lambert, Phong, Standard, Physical, toon, points, lines, and shader-backed surfaces; PBR maps, transparency, environment reflections, cloning, and disposal. Use when styling meshes, tuning PBR, fixing transparency or material sharing bugs, or reducing material cost. Triggers on: Three.js material, MeshStandardMaterial, MeshPhysicalMaterial, PBR, roughness, metalness, transparency, environment map, mesh surface, material clone.",
  "publisher": "akillness",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "three-js",
      "materials",
      "pbr",
      "meshstandardmaterial",
      "meshphysicalmaterial",
      "transparency",
      "webgl",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Choose, configure, and optimize Three.js mesh materials: basic, Lambert, Phong, Standard, Physical, toon, points, lines, and shader-backed surfaces; PBR maps, transparency, environment reflections, cloning, and disposal. Use when styling meshes, tuning PBR, fixing transparency or material sharing bugs, or reducing material cost. Triggers on: Three.js material, MeshStandardMaterial, MeshPhysicalMaterial, PBR, roughness, metalness, transparency, environment map, mesh surface, material clone."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/akillness/jeo-skills",
      "path": ".agent-skills/threejs-materials/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/akillness/jeo-skills/blob/HEAD/.agent-skills/threejs-materials/SKILL.md",
      "key": "akillness/jeo-skills/.agent-skills/threejs-materials/SKILL.md"
    },
    "allowed_tools": [
      "Bash",
      "Read",
      "Write",
      "Edit",
      "Glob",
      "Grep"
    ],
    "license": "MIT"
  },
  "instructions": "# Three.js Materials\n\nUse this skill for mesh surface semantics and cost. Route image maps/UVs/HDR assets to\n`threejs-textures`, lighting and shadow setup to `threejs-lighting`, and custom GLSL to\n`threejs-shaders`.\n\n## When to use this skill\n\n- Select a material type that matches unlit, classic-lighting, PBR, stylized, or custom work\n- Configure base color, metalness, roughness, normal/AO/emissive maps, and environment response\n- Fix transparency sorting, invisible backsides, unexpectedly shared edits, or material leaks\n- Reduce material variants, shader complexity, or draw-call fragmentation",
  "cost": {
    "context_tokens": 1062
  }
}

Fetch it by URL: GET /api/v1/registry/akillness-jeo-skills-threejs-materials/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.