[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CSR3MCV76KATMZWEY2W4PG":3,"skill-same:01M7CSR3MCV76KATMZWEY2W4PG":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7CSR3MCV76KATMZWEY2W4PG","pixijs-custom-rendering",null,"Use this skill when writing custom shaders, uniforms, filters, or batchers in PixiJS v8. Covers Shader.from({gl, gpu, resources}), GlProgram\u002FGpuProgram, UniformGroup with typed uniforms (f32, vec2, mat4x4), UBO mode, textures as resources, custom Filter via Filter.from, GLSL ES 3.0 conventions (in\u002Fout, finalColor, texture()), uBackTexture sampling, pixi.js\u002Funsafe-eval for strict CSP, custom Batcher via extensions. Triggers on: Shader, GlProgram, GpuProgram, UniformGroup, Batcher, Filter, Filter.from, GLSL, WGSL, UBO, uniform, custom shader, finalColor, uBackTexture, blendRequired, unsafe-eval.","om-scogo\u002Fskillsh-scraper","om-scogo","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160466840?v=4","01M79AWB6DFVCQ7RK70CS34B96","Om Achrekar","01M79AWB6ZM9SKR8KDH1WSSM22",0,"MIT","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fpixijs-pixijs-skills\u002Fpixijs-custom-rendering\u002FSkill.md",[],[],"2026-11-15 14:19:17",false,"---\nname: pixijs-custom-rendering\ndescription: \"Use this skill when writing custom shaders, uniforms, filters, or batchers in PixiJS v8. Covers Shader.from({gl, gpu, resources}), GlProgram\u002FGpuProgram, UniformGroup with typed uniforms (f32, vec2, mat4x4), UBO mode, textures as resources, custom Filter via Filter.from, GLSL ES 3.0 conventions (in\u002Fout, finalColor, texture()), uBackTexture sampling, pixi.js\u002Funsafe-eval for strict CSP, custom Batcher via extensions. Triggers on: Shader, GlProgram, GpuProgram, UniformGroup, Batcher, Filter, Filter.from, GLSL, WGSL, UBO, uniform, custom shader, finalColor, uBackTexture, blendRequired, unsafe-eval.\"\nlicense: MIT\n---\n\nCustom shaders bind GLSL and WGSL programs to scene objects via `Shader.from({ gl, gpu, resources })`. Uniforms live in typed `UniformGroup`s, textures are passed as separate resources, and the same shader can target both WebGL and WebGPU.\n\n## Quick Start\n\n```ts\nconst uniforms = new UniformGroup({\n  uTime: { value: 0, type: \"f32\" },\n});\n\nconst shader = Shader.from({\n  gl: { vertex: vertexSrc, fragment: fragmentSrc },\n  resources: { uniforms },\n});\n\nconst geometry = new MeshGeometry({\n  positions: new Float32Array([0, 0, 100, 0, 100, 100, 0, 100]),\n  uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n  indices: new Uint32Array([0, 1, 2, 0, 2, 3]),\n});\n\nconst mesh = new Mesh({ geometry, shader });\napp.stage.addChild(mesh);\n\napp.ticker.add(() => {\n  shader.resources.uniforms.uniforms.uTime = performance.now() \u002F 1000;\n});\n```\n\n**Related skills:** `pixijs-filters` (built-in filters), `pixijs-scene-mesh` (custom geometry), `pixijs-performance` (batch optimization), `pixijs-migration-v8` (shader API migration from v7).\n\n## Core Patterns\n\n### Dual-renderer shader (WebGL + WebGPU)\n\n```ts\nimport { Shader, GlProgram, GpuProgram, UniformGroup } from \"pixi.js\";\n\nconst glVertex = `...`; \u002F\u002F GLSL vertex (write `#version 300 es` yourself if you want WebGL2\u002FGLSL ES 3.0)\nconst glFragment = `...`; \u002F\u002F GLSL fragment\nconst wgslSource = `...`; \u002F\u002F WGSL combined\n\nconst shader = Shader.from({\n  gl: { vertex: glVertex, fragment: glFragment },\n  gpu: {\n    \u002F\u002F entryPoint names are arbitrary; they must match the @vertex \u002F @fragment\n    \u002F\u002F function names in your WGSL source. PixiJS ships examples using\n    \u002F\u002F 'mainVert' \u002F 'mainFrag' but `main` is equally valid.\n    vertex: { entryPoint: \"mainVert\", source: wgslSource },\n    fragment: { entryPoint: \"mainFrag\", source: wgslSource },\n  },\n  resources: {\n    myUniforms: new UniformGroup({\n      uColor: { value: new Float32Array([1, 0, 0, 1]), type: \"vec4\u003Cf32>\" },\n      uMatrix: { value: new Float32Array(16), type: \"mat4x4\u003Cf32>\" },\n    }),\n  },\n});\n```\n\nIf only `gl` is provided, the shader works with WebGL only. If only `gpu` is provided, it works with WebGPU only. The `compatibleRenderers` bitmask is set automatically.\n\n`GlProgram` does **not** auto-inject `#version 300 es`. If you write `#version 300 es` yourself, PixiJS preserves it and treats the shader as GLSL ES 3.0; otherwise it injects WebGL1 compat macros (`#define in varying`, `#define texture texture2D`) and runs the shader as WebGL1-style GLSL. `GlProgram` always injects a default precision (`highp` vertex, `mediump` fragment) and the program name. For GLSL ES 3.0, use `in`\u002F`out` instead of `attribute`\u002F`varying`, `texture()` instead of `texture2D()`, and an `out vec4` instead of `gl_FragColor`.\n\n### Textures as resources\n\nTextures are resources, not uniforms. Pass the texture's `source` and `style` separately:\n\n```ts\nimport { Shader, UniformGroup, Texture, Assets } from \"pixi.js\";\n\nconst texture = await Assets.load(\"myImage.png\");\n\nconst shader = Shader.from({\n  gl: { vertex: vertSrc, fragment: fragSrc },\n  resources: {\n    uTexture: texture.source,\n    uSampler: texture.source.style,\n    myUniforms: new UniformGroup({\n      uAlpha: { value: 1.0, type: \"f32\" },\n    }),\n  },\n});\n\n\u002F\u002F Swap texture at runtime\nshader.resources.uTexture = otherTexture.source;\n```\n\nResources are a flat key-value map. The key must match the uniform\u002Fbinding name in the shader source.\n\nResources can also be plain objects (auto-wrapped into `UniformGroup`):\n\n```ts\nconst shader = Shader.from({\n  gl: { vertex: vertSrc, fragment: fragSrc },\n  resources: {\n    myUniforms: {\n      uTime: { value: 0, type: \"f32\" },\n    },\n  },\n});\n```\n\n### UBO mode (Uniform Buffer Objects)\n\nUBO mode packs uniforms into a single GPU buffer. Required for WebGPU; optional (WebGL2+) for WebGL.\n\n```ts\nimport { UniformGroup } from \"pixi.js\";\n\nconst ubo = new UniformGroup(\n  {\n    uProjection: { value: new Float32Array(16), type: \"mat4x4\u003Cf32>\" },\n    uAlpha: { value: 1.0, type: \"f32\" },\n  },\n  { ubo: true, isStatic: true },\n);\n\n\u002F\u002F Must call update() manually when isStatic is true\nubo.uniforms.uAlpha = 0.5;\nubo.update();\n```\n\nUBO rules:\n\n- Only `f32` and `i32` based types are supported (no `u32`). Matrices are float-only.\n- Samplers\u002Ftextures cannot go in a UBO.\n- The UniformGroup name in resources must exactly match the UBO block name in the shader.\n- Structure and order must exactly match the shader layout.\n- UBO sync uses `new Function` under the hood. In strict-CSP environments (no `unsafe-eval`), import `pixi.js\u002Funsafe-eval` once at startup to swap in the fallback sync path; without it, UBO-backed shaders (and therefore WebGPU) will throw on first use.\n\n### Custom filter\n\n`Filter.from({ gl, resources })` is the shorthand. Pass only a fragment shader; PixiJS supplies a default vertex shader that handles output frame positioning.\n\n```ts\nimport { Filter } from \"pixi.js\";\n\nconst filter = Filter.from({\n  gl: {\n    fragment: `\n            in vec2 vTextureCoord;\n            out vec4 finalColor;\n            uniform sampler2D uTexture;\n            uniform float uStrength;\n\n            void main(void) {\n                vec4 color = texture(uTexture, vTextureCoord);\n                finalColor = mix(color, vec4(1.0 - color.rgb, color.a), uStrength);\n            }\n        `,\n  },\n  resources: {\n    filterUniforms: {\n      uStrength: { value: 0.5, type: \"f32\" },\n    },\n  },\n});\n\nfilter.resources.filterUniforms.uniforms.uStrength = 1.0;\n```\n\nFor a custom vertex shader, use `new Filter({ glProgram: new GlProgram({ vertex, fragment }), resources })`.\n\n#### Filter shader conventions (GLSL ES 3.0)\n\n- `in vec2 vTextureCoord;` instead of `varying vec2 vTextureCoord;`\n- `out vec4 finalColor;` instead of `gl_FragColor`\n- `texture(uTexture, uv)` instead of `texture2D(uTexture, uv)`\n- The default vertex shader exposes `uInputSize`, `uOutputFrame`, `uOutputTexture` and helpers `filterVertexPosition()` \u002F `filterTextureCoord()`\n\n#### Sampling the render target behind the filter\n\nSet `blendRequired: true` and sample `uBackTexture` in the fragment shader. PixiJS copies the destination pixels into that uniform before running the filter:\n\n```ts\nconst blendFilter = Filter.from({\n  gl: { fragment: blendFragSrc },\n  resources: { uniforms: { uAmount: { value: 0.5, type: \"f32\" } } },\n  blendRequired: true,\n});\n```\n\nOnly enable `blendRequired` when you need it; it forces an extra GPU copy every frame.\n\n### Updating uniforms at runtime\n\n```ts\n\u002F\u002F Access the UniformGroup via resources\nshader.resources.myUniforms.uniforms.uTime = performance.now() \u002F 1000;\n\n\u002F\u002F For isStatic UBOs, call update() after changing values\nshader.resources.myUniforms.update();\n```\n\n### Uniform type reference\n\nSee [references\u002Funiform-types.md](references\u002Funiform-types.md) for the complete table of supported types, their WGSL\u002FGLSL equivalents, and value formats.\n\n### Custom Batcher (extension-based)\n\nThe `Batcher` abstract class enables custom batching for specialized rendering. Subclass it and register via extensions:\n\n```ts\nimport { Batcher, extensions, ExtensionType } from \"pixi.js\";\nimport type {\n  BatcherOptions,\n  BatchableMeshElement,\n  BatchableQuadElement,\n  Geometry,\n  Shader,\n} from \"pixi.js\";\n\nclass MyBatcher extends Batcher {\n  public static extension = {\n    type: [ExtensionType.Batcher],\n    name: \"my-batcher\",\n  };\n\n  public name = \"my-batcher\";\n  protected vertexSize = 6; \u002F\u002F floats per vertex\n  public geometry: Geometry;\n  public shader: Shader;\n\n  constructor(options: BatcherOptions) {\n    super(options);\n    \u002F\u002F Initialize geometry and shader\n  }\n\n  public packAttributes(\n    element: BatchableMeshElement,\n    float32View: Float32Array,\n    uint32View: Uint32Array,\n    index: number,\n    textureId: number,\n  ): void {\n    \u002F\u002F Pack mesh vertex attributes into the batch buffer\n  }\n\n  public packQuadAttributes(\n    element: BatchableQuadElement,\n    float32View: Float32Array,\n    uint32View: Uint32Array,\n    index: number,\n    textureId: number,\n  ): void {\n    \u002F\u002F Pack quad vertex attributes into the batch buffer\n  }\n}\n\nextensions.add(MyBatcher);\n```\n\nElements reference the batcher by `batcherName`. The `BatchableElement` interface requires: `batcherName`, `texture`, `blendMode`, `indexSize`, `attributeSize`, `topology`, and `packAsQuad`.\n\n## Common Mistakes\n\n### [CRITICAL] Old Shader.from(vertex, fragment, uniforms) constructor\n\nWrong:\n\n```ts\nconst shader = Shader.from(vertex, fragment, { uTime: 1 });\n```\n\nCorrect:\n\n```ts\nconst shader = Shader.from({\n  gl: { vertex, fragment },\n  resources: {\n    uniforms: new UniformGroup({\n      uTime: { value: 1, type: \"f32\" },\n    }),\n  },\n});\n```\n\nv8 requires an options object with `gl`\u002F`gpu` programs and `resources`. The positional API was removed.\n\n\n### [CRITICAL] UniformGroup without type annotation\n\nWrong:\n\n```ts\nnew UniformGroup({ uTime: 1 });\n```\n\nCorrect:\n\n```ts\nnew UniformGroup({ uTime: { value: 1, type: \"f32\" } });\n```\n\nEvery uniform requires an explicit `{ value, type }` pair. Omitting the type causes a runtime error: \"Uniform type undefined is not supported.\"\n\n\n### [HIGH] UBO with unsupported types or wrong structure\n\nUBO mode supports `f32` and `i32` based types (scalars and vectors). `u32` is not in the supported `UniformGroup` type list and will throw. Matrices are float-only (`mat*\u003Cf32>`). Samplers cannot be placed in UBOs.\n\nThe struct name and field order must exactly match the shader's UBO declaration. Mismatches produce garbled rendering with no error.\n\n\n### [HIGH] Putting textures in UniformGroup\n\nWrong:\n\n```ts\nnew UniformGroup({\n  uTexture: { value: texture, type: \"f32\" },\n});\n```\n\nCorrect:\n\n```ts\nconst shader = Shader.from({\n  gl: { vertex, fragment },\n  resources: {\n    uTexture: texture.source,\n    uSampler: texture.source.style,\n    myUniforms: new UniformGroup({\n      uAlpha: { value: 1.0, type: \"f32\" },\n    }),\n  },\n});\n```\n\nTextures are resources, not uniforms. Pass `texture.source` (TextureSource) and `texture.source.style` (TextureStyle) as top-level resource entries.\n\n\n## API Reference\n\n- [Shader](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.Shader.html.md)\n- [GlProgram](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.GlProgram.html.md)\n- [GpuProgram](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.GpuProgram.html.md)\n- [UniformGroup](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.UniformGroup.html.md)\n- [Filter](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Ffilters.Filter.html.md)\n- [Batcher](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.Batcher.html.md)\n- [BatcherPipe](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.BatcherPipe.html.md)\n","Custom shaders bind GLSL and WGSL programs to scene objects via `Shader.from({ gl, gpu, resources })`. Uniforms live in typed `UniformGroup`s, textures are passed as separate resources, and the same shader can target both WebGL and WebGPU.\n\n## Quick Start\n\n```ts\nconst uniforms = new UniformGroup({\n  uTime: { value: 0, type: \"f32\" },\n});\n\nconst shader = Shader.from({\n  gl: { vertex: vertexSrc, fragment: fragmentSrc },\n  resources: { uniforms },\n});\n\nconst geometry = new MeshGeometry({\n  positions: new Float32Array([0, 0, 100, 0, 100, 100, 0, 100]),\n  uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n  indices: new Uint32Array([0, 1, 2, 0, 2, 3]),\n});\n\nconst mesh = new Mesh({ geometry, shader });\napp.stage.addChild(mesh);\n\napp.ticker.add(() => {\n  shader.resources.uniforms.uniforms.uTime = performance.now() \u002F 1000;\n});\n```\n\n**Related skills:** `pixijs-filters` (built-in filters), `pixijs-scene-mesh` (custom geometry), `pixijs-performance` (batch optimization), `pixijs-migration-v8` (shader API migration from v7).\n\n## Core Patterns\n\n### Dual-renderer shader (WebGL + WebGPU)\n\n```ts\nimport { Shader, GlProgram, GpuProgram, UniformGroup } from \"pixi.js\";\n\nconst glVertex = `...`; \u002F\u002F GLSL vertex (write `#version 300 es` yourself if you want WebGL2\u002FGLSL ES 3.0)\nconst glFragment = `...`; \u002F\u002F GLSL fragment\nconst wgslSource = `...`; \u002F\u002F WGSL combined\n\nconst shader = Shader.from({\n  gl: { vertex: glVertex, fragment: glFragment },\n  gpu: {\n    \u002F\u002F entryPoint names are arbitrary; they must match the @vertex \u002F @fragment\n    \u002F\u002F function names in your WGSL source. PixiJS ships examples using\n    \u002F\u002F 'mainVert' \u002F 'mainFrag' but `main` is equally valid.\n    vertex: { entryPoint: \"mainVert\", source: wgslSource },\n    fragment: { entryPoint: \"mainFrag\", source: wgslSource },\n  },\n  resources: {\n    myUniforms: new UniformGroup({\n      uColor: { value: new Float32Array([1, 0, 0, 1]), type: \"vec4\u003Cf32>\" },\n      uMatrix: { value: new Float32Array(16), type: \"mat4x4\u003Cf32>\" },\n    }),\n  },\n});\n```\n\nIf only `gl` is provided, the shader works with WebGL only. If only `gpu` is provided, it works with WebGPU only. The `compatibleRenderers` bitmask is set automatically.\n\n`GlProgram` does **not** auto-inject `#version 300 es`. If you write `#version 300 es` yourself, PixiJS preserves it and treats the shader as GLSL ES 3.0; otherwise it injects WebGL1 compat macros (`#define in varying`, `#define texture texture2D`) and runs the shader as WebGL1-style GLSL. `GlProgram` always injects a default precision (`highp` vertex, `mediump` fragment) and the program name. For GLSL ES 3.0, use `in`\u002F`out` instead of `attribute`\u002F`varying`, `texture()` instead of `texture2D()`, and an `out vec4` instead of `gl_FragColor`.\n\n### Textures as resources\n\nTextures are resources, not uniforms. Pass the texture's `source` and `style` separately:\n\n```ts\nimport { Shader, UniformGroup, Texture, Assets } from \"pixi.js\";\n\nconst texture = await Assets.load(\"myImage.png\");\n\nconst shader = Shader.from({\n  gl: { vertex: vertSrc, fragment: fragSrc },\n  resources: {\n    uTexture: texture.source,\n    uSampler: texture.source.style,\n    myUniforms: new UniformGroup({\n      uAlpha: { value: 1.0, type: \"f32\" },\n    }),\n  },\n});\n\n\u002F\u002F Swap texture at runtime\nshader.resources.uTexture = otherTexture.source;\n```\n\nResources are a flat key-value map. The key must match the uniform\u002Fbinding name in the shader source.\n\nResources can also be plain objects (auto-wrapped into `UniformGroup`):\n\n```ts\nconst shader = Shader.from({\n  gl: { vertex: vertSrc, fragment: fragSrc },\n  resources: {\n    myUniforms: {\n      uTime: { value: 0, type: \"f32\" },\n    },\n  },\n});\n```\n\n### UBO mode (Uniform Buffer Objects)\n\nUBO mode packs uniforms into a single GPU buffer. Required for WebGPU; optional (WebGL2+) for WebGL.\n\n```ts\nimport { UniformGroup } from \"pixi.js\";\n\nconst ubo = new UniformGroup(\n  {\n    uProjection: { value: new Float32Array(16), type: \"mat4x4\u003Cf32>\" },\n    uAlpha: { value: 1.0, type: \"f32\" },\n  },\n  { ubo: true, isStatic: true },\n);\n\n\u002F\u002F Must call update() manually when isStatic is true\nubo.uniforms.uAlpha = 0.5;\nubo.update();\n```\n\nUBO rules:\n\n- Only `f32` and `i32` based types are supported (no `u32`). Matrices are float-only.\n- Samplers\u002Ftextures cannot go in a UBO.\n- The UniformGroup name in resources must exactly match the UBO block name in the shader.\n- Structure and order must exactly match the shader layout.\n- UBO sync uses `new Function` under the hood. In strict-CSP environments (no `unsafe-eval`), import `pixi.js\u002Funsafe-eval` once at startup to swap in the fallback sync path; without it, UBO-backed shaders (and therefore WebGPU) will throw on first use.\n\n### Custom filter\n\n`Filter.from({ gl, resources })` is the shorthand. Pass only a fragment shader; PixiJS supplies a default vertex shader that handles output frame positioning.\n\n```ts\nimport { Filter } from \"pixi.js\";\n\nconst filter = Filter.from({\n  gl: {\n    fragment: `\n            in vec2 vTextureCoord;\n            out vec4 finalColor;\n            uniform sampler2D uTexture;\n            uniform float uStrength;\n\n            void main(void) {\n                vec4 color = texture(uTexture, vTextureCoord);\n                finalColor = mix(color, vec4(1.0 - color.rgb, color.a), uStrength);\n            }\n        `,\n  },\n  resources: {\n    filterUniforms: {\n      uStrength: { value: 0.5, type: \"f32\" },\n    },\n  },\n});\n\nfilter.resources.filterUniforms.uniforms.uStrength = 1.0;\n```\n\nFor a custom vertex shader, use `new Filter({ glProgram: new GlProgram({ vertex, fragment }), resources })`.\n\n#### Filter shader conventions (GLSL ES 3.0)\n\n- `in vec2 vTextureCoord;` instead of `varying vec2 vTextureCoord;`\n- `out vec4 finalColor;` instead of `gl_FragColor`\n- `texture(uTexture, uv)` instead of `texture2D(uTexture, uv)`\n- The default vertex shader exposes `uInputSize`, `uOutputFrame`, `uOutputTexture` and helpers `filterVertexPosition()` \u002F `filterTextureCoord()`\n\n#### Sampling the render target behind the filter\n\nSet `blendRequired: true` and sample `uBackTexture` in the fragment shader. PixiJS copies the destination pixels into that uniform before running the filter:\n\n```ts\nconst blendFilter = Filter.from({\n  gl: { fragment: blendFragSrc },\n  resources: { uniforms: { uAmount: { value: 0.5, type: \"f32\" } } },\n  blendRequired: true,\n});\n```\n\nOnly enable `blendRequired` when you need it; it forces an extra GPU copy every frame.\n\n### Updating uniforms at runtime\n\n```ts\n\u002F\u002F Access the UniformGroup via resources\nshader.resources.myUniforms.uniforms.uTime = performance.now() \u002F 1000;\n\n\u002F\u002F For isStatic UBOs, call update() after changing values\nshader.resources.myUniforms.update();\n```\n\n### Uniform type reference\n\nSee [references\u002Funiform-types.md](references\u002Funiform-types.md) for the complete table of supported types, their WGSL\u002FGLSL equivalents, and value formats.\n\n### Custom Batcher (extension-based)\n\nThe `Batcher` abstract class enables custom batching for specialized rendering. Subclass it and register via extensions:\n\n```ts\nimport { Batcher, extensions, ExtensionType } from \"pixi.js\";\nimport type {\n  BatcherOptions,\n  BatchableMeshElement,\n  BatchableQuadElement,\n  Geometry,\n  Shader,\n} from \"pixi.js\";\n\nclass MyBatcher extends Batcher {\n  public static extension = {\n    type: [ExtensionType.Batcher],\n    name: \"my-batcher\",\n  };\n\n  public name = \"my-batcher\";\n  protected vertexSize = 6; \u002F\u002F floats per vertex\n  public geometry: Geometry;\n  public shader: Shader;\n\n  constructor(options: BatcherOptions) {\n    super(options);\n    \u002F\u002F Initialize geometry and shader\n  }\n\n  public packAttributes(\n    element: BatchableMeshElement,\n    float32View: Float32Array,\n    uint32View: Uint32Array,\n    index: number,\n    textureId: number,\n  ): void {\n    \u002F\u002F Pack mesh vertex attributes into the batch buffer\n  }\n\n  public packQuadAttributes(\n    element: BatchableQuadElement,\n    float32View: Float32Array,\n    uint32View: Uint32Array,\n    index: number,\n    textureId: number,\n  ): void {\n    \u002F\u002F Pack quad vertex attributes into the batch buffer\n  }\n}\n\nextensions.add(MyBatcher);\n```\n\nElements reference the batcher by `batcherName`. The `BatchableElement` interface requires: `batcherName`, `texture`, `blendMode`, `indexSize`, `attributeSize`, `topology`, and `packAsQuad`.\n\n## Common Mistakes\n\n### [CRITICAL] Old Shader.from(vertex, fragment, uniforms) constructor\n\nWrong:\n\n```ts\nconst shader = Shader.from(vertex, fragment, { uTime: 1 });\n```\n\nCorrect:\n\n```ts\nconst shader = Shader.from({\n  gl: { vertex, fragment },\n  resources: {\n    uniforms: new UniformGroup({\n      uTime: { value: 1, type: \"f32\" },\n    }),\n  },\n});\n```\n\nv8 requires an options object with `gl`\u002F`gpu` programs and `resources`. The positional API was removed.\n\n\n### [CRITICAL] UniformGroup without type annotation\n\nWrong:\n\n```ts\nnew UniformGroup({ uTime: 1 });\n```\n\nCorrect:\n\n```ts\nnew UniformGroup({ uTime: { value: 1, type: \"f32\" } });\n```\n\nEvery uniform requires an explicit `{ value, type }` pair. Omitting the type causes a runtime error: \"Uniform type undefined is not supported.\"\n\n\n### [HIGH] UBO with unsupported types or wrong structure\n\nUBO mode supports `f32` and `i32` based types (scalars and vectors). `u32` is not in the supported `UniformGroup` type list and will throw. Matrices are float-only (`mat*\u003Cf32>`). Samplers cannot be placed in UBOs.\n\nThe struct name and field order must exactly match the shader's UBO declaration. Mismatches produce garbled rendering with no error.\n\n\n### [HIGH] Putting textures in UniformGroup\n\nWrong:\n\n```ts\nnew UniformGroup({\n  uTexture: { value: texture, type: \"f32\" },\n});\n```\n\nCorrect:\n\n```ts\nconst shader = Shader.from({\n  gl: { vertex, fragment },\n  resources: {\n    uTexture: texture.source,\n    uSampler: texture.source.style,\n    myUniforms: new UniformGroup({\n      uAlpha: { value: 1.0, type: \"f32\" },\n    }),\n  },\n});\n```\n\nTextures are resources, not uniforms. Pass `texture.source` (TextureSource) and `texture.source.style` (TextureStyle) as top-level resource entries.\n\n\n## API Reference\n\n- [Shader](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.Shader.html.md)\n- [GlProgram](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.GlProgram.html.md)\n- [GpuProgram](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.GpuProgram.html.md)\n- [UniformGroup](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.UniformGroup.html.md)\n- [Filter](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Ffilters.Filter.html.md)\n- [Batcher](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.Batcher.html.md)\n- [BatcherPipe](https:\u002F\u002Fpixijs.download\u002Frelease\u002Fdocs\u002Frendering.BatcherPipe.html.md)\n",{"name":5,"license":15,"description":7},"main","8859218955d9504cd18b59e7892100718039d3b4","data\u002Fskills\u002Fpixijs-pixijs-skills\u002Fpixijs-custom-rendering",1,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper","https:\u002F\u002Fgithub.com\u002Fom-scogo","SDE-1 @ Scogo ","2026-07-18 12:22:46",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add om-scogo\u002Fskillsh-scraper --skill pixijs-custom-rendering",{"tool":38,"command":39},"bunx","bunx skills add om-scogo\u002Fskillsh-scraper --skill pixijs-custom-rendering",{"tool":41,"command":42},"pnpm","pnpm dlx skills add om-scogo\u002Fskillsh-scraper --skill pixijs-custom-rendering","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fpixijs-pixijs-skills\u002Fpixijs-custom-rendering\u002FSkill.md",true,[46,52,56],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"metadata.json","REFERENCE","参考文档",477,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fpixijs-pixijs-skills\u002Fpixijs-custom-rendering\u002Fmetadata.json",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Funiform-types.md",3760,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fpixijs-pixijs-skills\u002Fpixijs-custom-rendering\u002Freferences\u002Funiform-types.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"SKILL.md",11233,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fpixijs-pixijs-skills\u002Fpixijs-custom-rendering\u002FSKILL.md",[61,68,73,80,85,92],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7D6MC9FAAEV4CMNYX8W7JTG","arxiv-search","Search arXiv physics, math, and computer science preprints using natural language queries. Powered by Valyu semantic search.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002Fskills\u002Farxiv-search\u002FSKILL.md",[],[],{"skillNo":69,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7D6M85CKKN87TA98VCQV4H7","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002FSkill.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7D4ZTCS4DR3CE4JY06X84T2","working-with-legacy-code","Safely change and test untested codebases using Feathers' \"Working Effectively with Legacy Code\". Use when the user mentions \"legacy code\", \"no tests\", \"untested codebase\", \"how do I test this\", \"seams\", \"characterization tests\", \"golden master\", \"sprout method\", \"afraid to change this code\", \"monster method\", \"dependency breaking\", or \"inherited a messy codebase\". Also trigger when changing code without tests safely, getting a class under test when constructors, statics, or singletons block it, adding features to tangled modules, or planning incremental test coverage for an old codebase. Covers the legacy-code change algorithm, seams, characterization tests, sprout\u002Fwrap, and dependency-breaking techniques. For refactoring code that already has tests, see refactoring-patterns. For day-to-day code quality, see clean-code.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002Fworking-with-legacy-code\u002FSKILL.md",[],[],{"skillNo":81,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7D4ZHZKJD2RSNGAF63V14P4","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002FSkill.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7D4ZB4CJBFW5JE67CPH2QRV","web-typography","Select, pair, and implement typefaces for web projects. Use when the user mentions \"font pairing\", \"which typeface\", \"line height\", \"responsive typography\", \"web font loading\", \"type hierarchy\", \"variable fonts\", \"FOUT\u002FFOIT\", \"typographic scale\", or \"the text is hard to read\". Also trigger when choosing between system fonts and web fonts, optimizing font-loading performance, or designing readable long-form content. Covers readability evaluation, CSS implementation, and performance optimization. For overall UI design systems, see refactoring-ui. For dramatic typographic experiences, see top-design.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002Fweb-typography\u002FSKILL.md",[],[],{"skillNo":93,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M7D4Z4MVYVY3NMJ18BNV6WNA","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002FSkill.md",[],[]]