r3f-geometry_skill

This skill helps you create and optimize 3D geometry in React Three Fiber, enabling custom shapes, efficient instancing, and direct vertex manipulation.
  • JavaScript

6

GitHub Stars

2

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill bbeierle12/skill-mcp-claude --skill r3f-geometry

  • _meta.json375 B
  • SKILL.md11.2 KB

Overview

This skill provides practical helpers and patterns for creating and manipulating BufferGeometry in React Three Fiber. It covers built-in primitives, declarative and programmatic buffer attributes, indexed geometry, dynamic updates, instancing at scale, and common geometry utilities. Use it to build custom shapes, optimize draw calls, and manage vertex-level data efficiently.

How this skill works

It exposes examples and code patterns for constructing geometries either via JSX-built-in geometry components or by creating THREE.BufferGeometry and BufferAttribute instances directly. The skill demonstrates setting positions, normals, uvs, and indices, updating attributes at runtime, computing normals and bounds, and using InstancedMesh with per-instance matrices, colors, and custom instanced attributes fed into shaders. It also shows utilities for centering, merging, and disposing geometry.

When to use it

  • When you need custom vertex data (positions, normals, uvs, colors) not provided by built-in primitives.
  • When rendering hundreds or thousands of identical objects—use instancing to reduce draw calls.
  • When sharing vertices between faces to save memory—use indexed geometry.
  • When animating vertex positions on the CPU and pushing updates to the GPU each frame.
  • When preparing static geometry for performance: merge, center, compute bounds and normals.

Best practices

  • Prefer InstancedMesh for 100+ identical objects to drastically reduce draw calls.
  • Use typed arrays (Float32Array/Uint16Array) for BufferAttributes and set needsUpdate after changes.
  • Call computeVertexNormals(), computeBoundingBox(), and computeBoundingSphere() where needed.
  • Dispose geometries and materials when no longer used to free GPU memory.
  • Merge static meshes and reduce segment counts for non-hero geometry to improve frame rate.

Example use cases

  • Create a custom triangle, quad, or procedural terrain by building BufferGeometry and BufferAttributes.
  • Animate a waving plane by mutating position attribute values in useFrame and recomputing normals.
  • Render a particle field or foliage using InstancedMesh with per-instance transforms and colors.
  • Pass custom per-instance data (speeds, phases) via InstancedBufferAttribute into shader materials.
  • Merge a group of static meshes into one BufferGeometry for a single draw call in a static scene.

FAQ

Mutate the position attribute values, set attribute.needsUpdate = true, and call geometry.computeVertexNormals() if lighting requires updated normals.

When should I use indexed geometry?

Use indexing when vertices are shared across triangles to reduce memory and prevent duplicated vertex data; supply an index buffer (Uint16Array/Uint32Array) and call setIndex.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
r3f-geometry skill by bbeierle12/skill-mcp-claude | VeilStrat