Skip to content

feat(poc): render textures upright, --front camera, and Text via a glyph atlas#33

Merged
delta9000 merged 1 commit into
mainfrom
feat/poc-render-texture-text
Jun 28, 2026
Merged

feat(poc): render textures upright, --front camera, and Text via a glyph atlas#33
delta9000 merged 1 commit into
mainfrom
feat/poc-render-texture-text

Conversation

@delta9000

Copy link
Copy Markdown
Owner

Three rendering-correctness changes the NIST visual conformance sweep surfaced. All in the PoC consumer + the x3d_stbtt io module — the headless core is untouched.

1. Texture vertical flip (bug)

stb_image decodes rows top-first but GL treats the first row as the texture bottom, so file textures rendered upside-down (ConformanceNist/Geometry/Box/texture.x3d: the VTS decal was inverted). Flip on load; the inline SFImage path is genuinely bottom-up and stays unflipped.

2. --front canonical camera

New flag that frames the scene from a straight-on, bounding-sphere-fit front camera (overriding any authored Viewpoint), matching how the NIST set bakes its *-front.jpg references so screenshots line up apples-to-apples.

3. Text rendering (feature)

Text was a blank white bar. Adds StbttGlyphAtlas to the x3d_stbtt io module: it bakes an ASCII coverage atlas via stb_truetype and returns a FontMetrics with advances (raw hmtx/unitsPerEm, matching StbttFontMetrics) and atlas UVs. The PoC consumes it through the FontMetrics seam + a uGlyphAtlas shader branch (alpha-tested coverage, material color). Per the seam decision, rasterization lives in the io module, not core.

The shared Liberation faces move to third_party/fonts/ — one copy for both the SDK text tests and the PoC (no duplication); FIXTURES_DIR updated. x3d_stbtt now also builds under -DX3D_CPP_BUILD_POC=ON. NOTICE updated.

Verified: build-ci 111/111, full PoC build, and visual confirmation against the conformance references (textured box upright, "The VRML Test Suite" renders as glyphs).

…t via a glyph atlas

Three rendering-correctness changes surfaced by the Web3D/NIST conformance
visual sweep, all in the PoC consumer + the stbtt io module (core stays headless):

* Texture vertical flip: stb_image decodes rows top-first but GL treats the
  first row as the texture bottom, so file textures rendered upside-down
  (ConformanceNist Geometry/Box/texture.x3d: VTS decal inverted). Flip on load.

* --front: new flag that frames the scene from a canonical straight-on,
  bounding-sphere-fit front camera (overriding any authored Viewpoint), matching
  how the NIST set bakes its *-front.jpg references so screenshots line up.

* Text rendering: add StbttGlyphAtlas to the x3d_stbtt io module — bakes an ASCII
  coverage atlas via stb_truetype and returns a FontMetrics with advances (raw
  hmtx/unitsPerEm, matching StbttFontMetrics) AND atlas UVs. The PoC consumes it
  through the FontMetrics seam + a uGlyphAtlas shader branch (alpha-tested
  coverage, material color). Text was a blank white bar; now renders real glyphs.

The shared Liberation faces move to third_party/fonts/ (one copy for both the SDK
text tests and the PoC, no duplication); x3d_stbtt now also builds under
-DX3D_CPP_BUILD_POC=ON. NOTICE updated.
@delta9000 delta9000 merged commit 5413c22 into main Jun 28, 2026
14 of 15 checks passed
@delta9000 delta9000 deleted the feat/poc-render-texture-text branch June 28, 2026 02:24
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