---
id: "meshgpt"
title: "MeshGPT"
domain: "genai"
stage: "generation"
realtime: "interactive"
platforms: [cuda, python]
year_introduced: 2023
inputs: [mesh]
outputs: [mesh]
style: "both"
dynamic: "static"
cost: "heavy"
authority: "Siddiqui et al., 2023"
url: "https://texelatlas.vercel.app/t/meshgpt/"
sources_verified_at: "2026-11-29"
---
# MeshGPT (Siddiqui et al., 2023)

> Learns a vocabulary of triangle tokens with a graph-convolutional encoder and vector quantisation, then trains a decoder-only transformer to emit meshes triangle by triangle.

## Reach for it when

- want generated meshes with clean artist-like triangles
- need to learn mesh generation as token sequences
- unconditional low-poly asset generation
- marching-cubes style outputs are too dense and messy

## How it works

Each triangle in a training mesh is described by its vertices and local geometry, encoded by a graph convolution over the mesh, and quantised into a discrete codebook index (residual vector quantisation). A mesh therefore becomes a sequence of triangle tokens in a canonical order, and a GPT-style transformer is trained to predict the next token. Sampling produces a sequence that is decoded back into triangles. Because meshes are generated natively as compact, sharp-edged triangle sets rather than extracted from a field, results look like artist-made meshes, with large flat faces and coarse triangle counts, unlike iso-surface output.

## When to use it

Choose it to study or reproduce token-based mesh generation, or for unconditional/class-conditioned low-poly assets. Prefer [MeshAnything](https://texelatlas.vercel.app/t/meshanything.md) when you need conditioning on a dense shape or point cloud, [MeshFlow](https://texelatlas.vercel.app/t/meshflow.md) for parallel generation with continuous latents, and [Hunyuan3D 2.0](https://texelatlas.vercel.app/t/hunyuan3d-2.md) or [TRELLIS (Structured 3D Latents)](https://texelatlas.vercel.app/t/trellis.md) when the target is a high-detail textured scan-like asset.

## Cost

heavy — Autoregressive: time grows with triangle count; qualitative.
Measured GPU Weight: 20.73× baseline (heavy) — 0.6821 ms median / 0.7068 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 16.81× baseline (moderate) — 0.2672 ms median (2.55× faster on L4).
Ampere A100 scaling: 12.9× baseline (moderate) — 0.3716 ms median (1.84× faster on A100).

## Failure modes

- Errors in a long token sequence give holes, flipped or overlapping triangles
- Quantisation limits vertex precision
- Limited face counts per mesh (hundreds to a few thousand triangles)
- Official release code is research-grade; the popular community reimplementation differs from the paper in details

## Dataflow

- Inputs: mesh
- Outputs: mesh
- Platforms: cuda, python

## Presets

### MeshGPT — autoregressive triangle-token decoding (left) vs completed faceted mesh (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_SEQ_PROG": 0.72,
  "P_TRI_RES": 10,
  "P_ROT_SPEED": 0.58,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_SEQ_PROG = 0.72; // P Token Progress [0.15, 1.0, 0.02]
const float P_TRI_RES = 10.0; // P Triangle Scale [5.0, 16.0, 0.5]
const float P_ROT_SPEED = 0.58; // P Orbit Speed [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P Tokens / Mesh Split [0.0, 1.0, 0.02]

mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }

vec3 hash31(float x) {
  vec3 p = fract(vec3(x) * vec3(0.1031, 0.1030, 0.0973));
  p += dot(p, p.yzx + 33.33);
  return fract((p.xxy + p.yzz) * p.zyx);
}

// Sculpted architectural chair/bust polyhedron
float mapObj(vec3 p, float spin) {
  vec3 q = p;
  q.xz = rot2(spin * 0.45) * q.xz;
  q.yz = rot2(0.24) * q.yz;
  float r = length(q);
  vec3 d = q / max(r, 1e-4);
  float shape = 0.68 + 0.12 * cos(d.y * 4.5) + 0.08 * sin(atan(d.z, d.x) * 4.0) * (1.0 - abs(d.y));
  return (r - shape) * 0.82;
}

vec3 calcNormal(vec3 p, float spin) {
  vec2 e = vec2(0.0025, 0.0);
  return normalize(vec3(
    mapObj(p + e.xyy, spin) - mapObj(p - e.xyy, spin),
    mapObj(p + e.yxy, spin) - mapObj(p - e.yxy, spin),
    mapObj(p + e.yyx, spin) - mapObj(p - e.yyx, spin)
  ));
}

vec3 aces(vec3 x) {
  x = max(x, 0.0);
  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  float screenX = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  float prog = clamp(P_SEQ_PROG, 0.1, 1.0);
  float triRes = clamp(P_TRI_RES, 4.0, 18.0);
  float spin = iTime * max(P_ROT_SPEED, 0.0);

  vec3 ro = vec3(0.0, 0.10, 2.30);
  vec3 rd = normalize(vec3(uv, -1.55));
  vec3 bg = mix(vec3(0.022, 0.028, 0.048), vec3(0.058, 0.072, 0.118), smoothstep(-0.55, 0.55, uv.y));
  vec3 col = bg;

  float t = 0.0;
  bool hit = false;
  for (int i = 0; i < 56; i++) {
    float d = mapObj(ro + rd * t, spin);
    if (d < 0.0025) { hit = true; break; }
    t += d;
    if (t > 5.0) break;
  }

  if (hit) {
    vec3 p = ro + rd * t;
    vec3 n = calcNormal(p, spin);
    vec3 objP = p;
    objP.xz = rot2(spin * 0.45) * objP.xz;
    objP.yz = rot2(0.24) * objP.yz;

    // Quantized spherical triangle-grid tokenization (VQ-VAE triangle codebook)
    vec3 dn = normalize(objP + vec3(1e-5));
    vec2 sp = vec2(atan(dn.z, dn.x) / 3.14159265, asin(clamp(dn.y, -0.999, 0.999)) / 1.5707963);
    vec2 g = sp * vec2(triRes * 1.8, triRes);
    vec2 cell = floor(g);
    vec2 f = fract(g);
    float upper = step(f.x, f.y);
    vec3 bary = (upper > 0.5) ? vec3(1.0 - f.y, f.x, f.y - f.x) : vec3(1.0 - f.x, f.y, f.x - f.y);
    float edgeD = min(bary.x, min(bary.y, bary.z));
    float wire = smoothstep(0.065, 0.015, edgeD);

    // Flat-shaded quantized facet normal
    vec2 cUV = (cell + ((upper > 0.5) ? vec2(0.33, 0.67) : vec2(0.67, 0.33))) / vec2(triRes * 1.8, triRes);
    float phi = cUV.x * 3.14159265;
    float th = cUV.y * 1.5707963;
    vec3 flatObjN = normalize(vec3(cos(th) * cos(phi), sin(th), cos(th) * sin(phi)));
    vec3 flatN = flatObjN;
    flatN.yz = rot2(-0.24) * flatN.yz;
    flatN.xz = rot2(-spin * 0.45) * flatN.xz;
    flatN = normalize(mix(n, flatN, 0.68));

    // Autoregressive bottom-to-top triangle token sequence order
    float seqOrder = clamp((cUV.y + 1.0) * 0.5 + (cUV.x + 1.0) * 0.04, 0.0, 1.0);
    float waveFront = mod(prog + 0.22 * sin(iTime * 0.75), 1.02);
    float tokId = cell.y * 37.0 + cell.x * 2.0 + upper;
    vec3 tokCol = 0.32 + 0.58 * hash31(tokId);

    vec3 l1 = normalize(vec3(0.58, 0.80, 0.55));
    float diff = max(dot(flatN, l1), 0.0);
    float spec = pow(max(dot(flatN, normalize(l1 - rd)), 0.0), 32.0);

    if (screenX < split) {
      // Left: Autoregressive token sequence construction with glowing active-token frontier
      float generated = smoothstep(waveFront + 0.03, waveFront - 0.02, seqOrder);
      float frontier = exp(-abs(seqOrder - waveFront) * 38.0);
      vec3 activeFace = tokCol * (0.35 + 0.75 * diff) + vec3(1.0, 0.86, 0.35) * frontier * 1.4;
      activeFace = mix(activeFace, vec3(0.95, 0.98, 1.0), wire * 0.55);
      // Un-generated future triangles shown as faint ghost wireframe
      vec3 ghost = bg + vec3(0.14, 0.34, 0.52) * wire * 0.55;
      col = mix(ghost, activeFace, generated);
    } else {
      // Right: Completed clean artist-like MeshGPT triangle mesh
      vec3 base = vec3(0.76, 0.80, 0.88) * (0.28 + 0.82 * diff) + vec3(1.0) * spec * 0.38;
      col = mix(base, vec3(0.10, 0.24, 0.42), wire * 0.68);
    }
  }

  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
  col = mix(col, vec3(0.95, 0.97, 1.0), sep);

  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: MIT — written for this index.

## Sources

1. [primary] Yawar Siddiqui, Antonio Alliegro, Alexey Artemov, Tatiana Tommasi, Daniele Sirigatti, Vladislav Rosov, Angela Dai, Matthias Nießner (2023) MeshGPT: Generating Triangle Meshes with Decoder-Only Transformers. arXiv preprint (cs.CV). https://arxiv.org/abs/2311.15475 (verified via arxiv on 2026-11-29)
2. [primary] Yawar Siddiqui, Antonio Alliegro, Alexey Artemov, Tatiana Tommasi, Daniele Sirigatti, Vladislav Rosov, Angela Dai, Matthias Nießner (2024) MeshGPT: Generating Triangle Meshes with Decoder-Only Transformers. 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). https://doi.org/10.1109/cvpr52733.2024.01855 (verified via crossref on 2026-11-29)
3. [implementation] lucidrains (2023) lucidrains/meshgpt-pytorch. https://github.com/lucidrains/meshgpt-pytorch License: MIT. (verified via github on 2026-11-29)

## Cite this entry

Texel. "MeshGPT." https://texelatlas.vercel.app/t/meshgpt/ (accessed 2026-12-01).
