Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds end-to-end support for per-vertex colors in extended OBJ vertex lines (v x y z r g b) across the Obj2Tiles pipeline (splitting, decimation, and OBJ→glTF conversion), preserving/interpolating colors during splitting and exporting them as COLOR_0 in glTF (with sRGB→linear conversion).
Changes:
- Parse and carry optional vertex colors through
Obj2Tiles.Librarymeshes (Mesh/MeshT) including split-time interpolation and OBJ write-back. - Extend decimation-stage OBJ parsing/writing (
ObjMesh) and pass colors throughMeshDecimatorCore. - Extend Obj2Gltf OBJ parser + glTF writer to emit
COLOR_0and write a dedicated colors buffer; add NUnit coverage for library-layer behavior.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents vertex color support and cleans up formatting. |
| Obj2Tiles/Stages/Model/ObjMesh.cs | Adds vertex color parsing/storage + OBJ writing for the decimation-stage parser. |
| Obj2Tiles/Stages/DecimationStage.cs | Passes colors into/out of MeshDecimatorCore during LOD decimation. |
| Obj2Tiles.Library/Materials/RGB.cs | Adds RGB interpolation + sRGB→linear helper + equality members. |
| Obj2Tiles.Library/Geometry/MeshUtils.cs | Parses per-vertex RGB from OBJ and plumbs into Mesh/MeshT. |
| Obj2Tiles.Library/Geometry/Mesh.cs | Stores optional vertex colors; preserves + interpolates through splitting; writes colors in OBJ output. |
| Obj2Tiles.Library/Geometry/MeshT.cs | Same as Mesh but for textured meshes; updates split + OBJ writing + unused-vertex removal. |
| Obj2Tiles.Library.Test/VertexColorTests.cs | Adds tests for parsing/splitting/interpolation/round-trip OBJ writing with colors. |
| Obj2Tiles.Library.Test/TestData/triangle-colors.obj | New colored OBJ fixture. |
| Obj2Tiles.Library.Test/TestData/cube-colors.obj | New colored OBJ fixture. |
| Obj2Tiles.Library.Test/TestData/cube-colors-textured/* | New textured + colored OBJ/MTL (and texture) fixtures. |
| Obj2Tiles.Library.Test/Obj2Tiles.Library.Test.csproj | Copies new test data to output. |
| Obj2Gltf/WaveFront/ObjParser.cs | Parses extended vertex color tokens into ObjModel.Colors. |
| Obj2Gltf/WaveFront/ObjModel.cs | Adds storage for per-vertex colors. |
| Obj2Gltf/Converter.cs | Emits COLOR_0 and converts sRGB→linear when writing vertex data. |
| Obj2Gltf/BufferState.cs | Adds color buffer/accessor plumbing for glTF output. |
| .github/copilot-instructions.md | Updates project guidance to mention vertex color support and flow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for OBJ files with per-vertex colors (extended vertex format:
v x y z r g b).Vertex colors are:
COLOR_0attribute with automatic sRGB → linear RGB conversion per the glTF specificationCloses #43