---
title: "Converting Vertex-Colored Meshes to Textured Meshes"
description: "Vertex-colored meshes, as produced by generative 3D models like InstantMesh, can be converted to UV-mapped textured meshes by generating a UV atlas with xatlas, rasterizing each face into an upscaled texture buffer via point-in-triangle tests and barycentric color interpolation, then cleaning holes with OpenCV inpainting, median filtering, Gaussian blur and LANCZOS downsampling."
url: "https://swe.quest/articles/converting-vertex-colored-meshes-to-textured-meshes-e5f0aa9b3b8941f1"
canonical: "https://huggingface.co/blog/vertex-colored-to-textured-mesh"
source: "Hugging Face"
published: "2024-09-30"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["python","computer-vision","algorithms"]
---

# Converting Vertex-Colored Meshes to Textured Meshes

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-09-30, 6 min read, How-to. Original: [https://huggingface.co/blog/vertex-colored-to-textured-mesh](https://huggingface.co/blog/vertex-colored-to-textured-mesh)

## Summary

Vertex-colored meshes, as produced by generative 3D models like InstantMesh, can be converted to UV-mapped textured meshes by generating a UV atlas with xatlas, rasterizing each face into an upscaled texture buffer via point-in-triangle tests and barycentric color interpolation, then cleaning holes with OpenCV inpainting, median filtering, Gaussian blur and LANCZOS downsampling. The result is exported as a glb with a PBR material via trimesh, and the steps are packaged in a small InstantTexture Python library. The output still has visible artifacts and falls short of production-quality UVs and textures, so it suits quick conversions rather than final assets.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Python](https://swe.quest/tags/python.md) (Languages)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Algorithms](https://swe.quest/tags/algorithms.md) (Architecture & design)

## Prerequisites

- 3D mesh basics
- UV mapping
- NumPy

## Keywords

InstantTexture, xatlas, trimesh, OpenCV, InstantMesh, glTF

## Related posts

- [Practical 3D Asset Generation: A Step-by-Step Guide](https://swe.quest/articles/practical-3d-asset-generation-a-step-by-step-guide-c948271b2c09a8ea.md): Hugging Face · 2023-08-01 · Medium · 4 min read · Games, Computer vision
  A low-effort pipeline turns a text prompt into a usable game asset by leaning into the forgiving PS1 aesthetic.
- [3D Asset Generation: AI for Game Development #3](https://swe.quest/articles/3d-asset-generation-ai-for-game-development-3-dc2ebb89cd6c9a2a.md): Hugging Face · 2023-01-20 · Easy · 4 min read · Computer vision, Games, Machine learning
  As of early 2023, text-to-3D generation is not yet practical for game development.
- [Introduction to 3D Gaussian Splatting](https://swe.quest/articles/introduction-to-3d-gaussian-splatting-4bae5755704fcc0e.md): Hugging Face · 2023-09-18 · Medium · 6 min read · Computer vision, Machine learning, Algorithms
  3D Gaussian Splatting renders photorealistic scenes in real time by rasterizing millions of gaussians, each with a position, covariance, color and alpha, instead of triangles.
- [How did we build 3D animations in mobile apps?](https://swe.quest/articles/how-did-we-build-3d-animations-in-mobile-apps-a24b8209662d76ad.md): Wise Engineering · 2025-01-29 · Medium · 4 min read · Mobile, Performance engineering, JavaScript
  Wise renders its brand 3D illustrations interactively in its iOS and Android apps by building three.js/WebGL scenes as standalone local HTML files shown in web views, which it chose over native or Filament for cross-platform reuse and documentation, and which hit 60–120 FPS.
- [How We Built the BFCM 2023 Globe](https://swe.quest/articles/how-we-built-the-bfcm-2023-globe-509c84faf6998eb6.md): Shopify Engineering · 2024-10-30 · Medium · 17 min read · Frontend, Performance engineering, React
  Shopify's BFCM 2023 live-orders globe was built with Three.js and React-three-fiber, and most of its effects are drawn in single instanced draw calls.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
