Skip to content
Back to skills

Override Shader Chunks

ASecurity

Use when a PlayCanvas StandardMaterial needs custom shading its properties cannot express, such as stylized looks or vertex displacement, before writing a ShaderMaterial.

  • 24 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added August 31, 2026
ai-agentsexpress

Security analysis

A100/100

Scanned October 2, 2026

npx -y skills add playcanvas/skills --skill override-shader-chunks --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Override Shader Chunks?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Override Shader Chunks
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/playcanvas-override-shader-chunks/badge)](https://www.skillsdirectory.com/skills/playcanvas-override-shader-chunks)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: override-shader-chunks
description: Use when a PlayCanvas StandardMaterial needs custom shading its properties cannot express, such as stylized looks or vertex displacement, before writing a ShaderMaterial.
---

# Override shader chunks

Overriding a `StandardMaterial` chunk keeps fog, tone mapping, shadows, skinning, and instancing
intact. Use a `ShaderMaterial` only when the look needs its own vertex and fragment pair.

- Set `material.shaderChunksVersion` to the installed major.minor, such as `'2.23'`. Chunk names
  and contracts change between versions, so read the installed chunk source, not memory.
- Set chunks with `material.getShaderChunks(SHADERLANGUAGE_GLSL).set(name, source)` and the WGSL
  equivalent, then call `material.update()`. For every material on a device, use
  `ShaderChunks.get(device, language)`; the global `shaderChunks` object is deprecated.
- Supply both GLSL and WGSL. On WebGPU, one GLSL-only chunk sends the whole shader through a
  transpiler that is usually not loaded, so it fails to compile. Otherwise pin the device to WebGL.
- Clone shared materials, including imported ones, before overriding them for only some meshes.
  Per-mesh uniforms use `meshInstance.setParameter()`.
- Uniforms are raw; convert sRGB colours with `Color#linear()`.
- Vertex chunks that read the model matrix, such as `transformCoreVS`, must keep the `INSTANCING`
  path with a `matrix_model` fallback, like the stock chunk.
- Expand mesh bounds by the maximum displacement; CPU bounds do not see shader deformation.
- For an emissive-only look, implement `getEmission()` writing `dEmission`, zero `diffuse` and
  `specular`, and disable `useSkybox`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.