pixijs-scene-mesh
Original:🇺🇸 English
Translated
Use this skill when rendering custom geometry in PixiJS v8. Covers Mesh with MeshGeometry (positions, uvs, indices, topology), MeshSimple for per-frame vertex animation, MeshPlane for subdivided deformation, MeshRope for path-following textures, PerspectiveMesh for 2.5D corners. Triggers on: Mesh, MeshGeometry, MeshSimple, MeshPlane, MeshRope, PerspectiveMesh, positions, uvs, indices, topology, setCorners, constructor options, MeshOptions, MeshPlaneOptions, MeshRopeOptions, SimpleMeshOptions, PerspectivePlaneOptions.
12installs
Sourcepixijs/pixijs-skills
Added on
NPX Install
npx skill4agent add pixijs/pixijs-skills pixijs-scene-meshTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Meshes render arbitrary 2D (or perspective-projected) geometry with a texture or custom shader. PixiJS ships the base class plus four specialized subclasses for common shapes: , , , and . Pick the subclass that matches your shape; drop to the base when you need full vertex-level control or a custom shader.
MeshMeshSimpleMeshPlaneMeshRopePerspectiveMeshMeshAssumes familiarity with . Meshes are leaf nodes; they cannot have children. Wrap multiple meshes in a to group them.
pixijs-scene-core-conceptsContainerQuick Start
ts
const texture = await Assets.load("pattern.png");
const geometry = new MeshGeometry({
positions: new Float32Array([0, 0, 100, 0, 100, 100, 0, 100]),
uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
indices: new Uint32Array([0, 1, 2, 0, 2, 3]),
topology: "triangle-list",
});
const mesh = new Mesh({
geometry,
texture,
roundPixels: false,
});
app.stage.addChild(mesh);Every subclass takes a single options object. The base requires a ; subclasses (, , , ) build the geometry internally and require a instead. See each variant's reference for the full field list.
MeshMeshgeometryMeshSimpleMeshPlaneMeshRopePerspectiveMeshtextureVariants
| Variant | Use when | Trade-offs | Reference |
|---|---|---|---|
| Full control, custom geometry, custom shaders | You build the | references/mesh.md |
| Quick textured shapes with per-frame vertex animation | Thin wrapper; auto-updates the vertex buffer | references/mesh-simple.md |
| Subdivided textured rectangle for distortion effects | Fixed topology; | references/mesh-plane.md |
| Texture following a polyline path | Bent at each point; needs many points for smooth curves | references/mesh-rope.md |
| 2D plane with perspective corners | Not true 3D; UV-level perspective correction only | references/mesh-perspective.md |
When to use what
- "I need a textured quad" → (see
Sprite), not a mesh. Meshes are for cases Sprite can't express.pixijs-scene-sprite - "I need to deform a textured rectangle" → . Set
MeshPlane/verticesXfor the desired smoothness.verticesY - "I need a rope or trail that follows points" → . Control thickness with
MeshRope; usewidthto stretch ortextureScale: 0to repeat.> 0 - "I need a tilted 2D card or floor" → . Pass four corner positions; not real 3D but good enough for 2.5D effects.
PerspectiveMesh - "I need per-frame animated vertices with a simple shape" → . It handles the buffer-update dance for you.
MeshSimple - "I need a custom shader or unusual geometry" → Base with a hand-built
Mesh. SeeMeshGeometryfor shader authoring.pixijs-custom-rendering - "I need true 3D rendering" → Use a dedicated 3D library. simulates perspective at the UV level but has no depth buffer.
PerspectiveMesh
Quick concepts
MeshGeometry owns the vertex data
MeshGeometrypositionsuvsindicestopologyMeshBatching
A mesh batches (combines with other draw calls) only if it uses , has no custom shader, no depth or culling state, and the rule ( and ≤100 vertices). Custom shaders always render independently.
MeshGeometry'auto'batchMode = 'auto'Topology is on the geometry, not the mesh
new MeshGeometry({ topology: 'triangle-strip' })'triangle-list'Extra knobs
- — trims GPU buffer storage to the actual vertex count on creation. Use it when feeding large, one-shot geometries.
new MeshGeometry({ shrinkBuffersToFit: true }) - — topology-aware hit test that walks the triangles. Works with any
Mesh.containsPoint(point), including custom layouts.MeshGeometry - — pass a
new Mesh({ geometry, state })object to control blend, depth, and culling. Batching is disabled automatically if depth or culling flags are set. Defaults toStatewhen omitted.State.for2d()
Common Mistakes
[HIGH] Using old SimpleMesh
/ SimplePlane
/ SimpleRope
names
SimpleMeshSimplePlaneSimpleRopeWrong:
ts
import { SimpleRope } from "pixi.js";
const rope = new SimpleRope(texture, points);Correct:
ts
import { MeshRope } from "pixi.js";
const rope = new MeshRope({ texture, points });Renamed in v8: → , → , → . All switched to options-object constructors.
SimpleMeshMeshSimpleSimplePlaneMeshPlaneSimpleRopeMeshRope[HIGH] Positional constructor args for MeshGeometry
MeshGeometryWrong:
ts
const geom = new MeshGeometry(vertices, uvs, indices);Correct:
ts
const geom = new MeshGeometry({
positions: vertices,
uvs,
indices,
topology: "triangle-list",
});v8 uses an options object. Note the property is , not ; the name is only used by .
positionsverticesverticesMeshSimple[MEDIUM] Adding children to a mesh
Wrong:
ts
mesh.addChild(otherMesh);Correct:
ts
const group = new Container();
group.addChild(mesh, otherMesh);MeshallowChildren = falseContainer