Skip to content

Conversation

david-lively
Copy link
Contributor

@david-lively david-lively commented Sep 25, 2025

Description

This PR adds flat normal generation in the pixel shader for tilesets that do not have normals. Before this change, either smooth per-vertex normals, or flat face normals would be generated on the CPU. The latter required duplicating vertices per face which requires a much larger vertex buffer.
image
image

This behavior will be enabled by default when rendering a lit tileset (or unlit if the Ignore Khr Unlit option is enabled) if normals are not included in the tileset.

Issue number or link

Author checklist

  • I have submitted a Contributor License Agreement (only needed once).
  • I have done a full self-review of my code.
  • I have updated CHANGES.md with a short summary of my change (for user-facing changes).
  • I have added or updated unit tests to ensure consistent code coverage as necessary.
  • I have updated the documentation as necessary.

Remaining Tasks

Testing plan

Load a tileset that does not have normals. Disable Generate Smooth Normals and enable the Ignore KHR Unlit options. Note that the Normal material overlay contains no normals, but lighting is correct. One may also connect the normal generation output to the Base Color node on the

@j9liu j9liu changed the base branch from main to generate-tangents September 25, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant