Skip to content

Commit

Permalink
Don't duplicate vertices for unlit meshes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Oct 2, 2024
1 parent 5e326af commit eee0450
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
##### Fixes :wrench:

- Fixed a bug that caused incorrect lighting for tilesets using `KHR_materials_unlit`.
- Reduced the memory used by tiles with `KHR_materials_unlit`.
- `CesiumGlobeAnchor` properties are no longer shown on the main `CesiumSunSky` Details panel, because it is almost never necessary to set these. They can still be set on the component's own Details panel if needed.

### v2.9.0 - 2024-10-01
Expand Down
5 changes: 4 additions & 1 deletion Source/CesiumRuntime/Private/CesiumGltfComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,10 @@ static void loadPrimitive(
// vertices shared by multiple triangles. If we don't have tangents, but
// need them, we need to use a tangent space generation algorithm which
// requires duplicated vertices.
bool duplicateVertices = !hasNormals || (needsTangents && !hasTangents);
bool normalsAreRequired = !primitiveResult.isUnlit;
bool needToGenerateFlatNormals = normalsAreRequired && !hasNormals;
bool needToGenerateTangents = needsTangents && !hasTangents;
bool duplicateVertices = needToGenerateFlatNormals || needToGenerateTangents;
duplicateVertices =
duplicateVertices && primitive.mode != MeshPrimitive::Mode::POINTS;

Expand Down

0 comments on commit eee0450

Please sign in to comment.