model3d: LOD switching and per-texture material layers #19

Manually merged
github merged 1 commit from gh-pr/19/head into gh-pr/19/base 2026-11-27 02:31:13 +00:00
Owner

@⁠asm512 on GitHub · 2026-11-21 20:16 UTC · original
asm512:model-lod-texture-layers → main · +1021 −237 · 3 files · 1 commits · merged 2026-11-22 02:23 UTC

Adds LOD switching and per-texture material layers to the 3D model viewer.

LOD

  • The decoder reads any of the four drawable LOD slots instead of only slot 0. About a fifth of sampled models (props, doors, weapon parts, vehicle _mid files) fill more than one.
  • Vehicles keep their levels in sibling files (x_hi.#ft, x_mid.#ft, x.#ft). The viewer header gets Hi / Mid / Low buttons that jump between them, plus LOD0–LOD3 buttons for in-file levels. Camera is kept across switches.

Textures

  • Every pooled texture a material binds is kept as a layer that can be switched on or off from an "Applied textures" dropdown: color, normal maps (per-pixel lighting) and multiply overlays (dirt, dust, masks).
  • Default set is one color texture per material, same as before; the viewer also turns normal maps on.
  • "Texture Browser" opens a model's bound textures as flat images, with Export All PNG.

Notes

  • Overlays are a rough preview: the per-channel meaning of those maps isn't known, so they are multiplied as-is.
  • Only six texture parameter names are resolved (diffuseTex, tintPaletteTex, emissiveTex, dirtDiffuseTex, dirtNoiseTex, DustTexture); the rest are labelled by kind and hash.
  • cheetah2 renders are pixel-identical to before with the default set. The Brickell SLOD test render differs in 217 of 480,000 pixels and I haven't found why.
  • New tests need PERCYSTAR_LEVELS_RPF set and are skipped otherwise.
  • Cargo.lock is synced to the 1.4.1 manifest.
**@⁠asm512** on GitHub · 2026-11-21 20:16 UTC · [original](https://github.com/rpatty-dev/PercyStar/pull/19) `asm512:model-lod-texture-layers` → `main` · +1021 −237 · 3 files · 1 commits · merged 2026-11-22 02:23 UTC Adds LOD switching and per-texture material layers to the 3D model viewer. **LOD** - The decoder reads any of the four drawable LOD slots instead of only slot 0. About a fifth of sampled models (props, doors, weapon parts, vehicle `_mid` files) fill more than one. - Vehicles keep their levels in sibling files (`x_hi.#ft`, `x_mid.#ft`, `x.#ft`). The viewer header gets Hi / Mid / Low buttons that jump between them, plus LOD0–LOD3 buttons for in-file levels. Camera is kept across switches. **Textures** - Every pooled texture a material binds is kept as a layer that can be switched on or off from an "Applied textures" dropdown: color, normal maps (per-pixel lighting) and multiply overlays (dirt, dust, masks). - Default set is one color texture per material, same as before; the viewer also turns normal maps on. - "Texture Browser" opens a model's bound textures as flat images, with Export All PNG. **Notes** - Overlays are a rough preview: the per-channel meaning of those maps isn't known, so they are multiplied as-is. - Only six texture parameter names are resolved (`diffuseTex`, `tintPaletteTex`, `emissiveTex`, `dirtDiffuseTex`, `dirtNoiseTex`, `DustTexture`); the rest are labelled by kind and hash. - `cheetah2` renders are pixel-identical to before with the default set. The Brickell SLOD test render differs in 217 of 480,000 pixels and I haven't found why. - New tests need `PERCYSTAR_LEVELS_RPF` set and are skipped otherwise. - `Cargo.lock` is synced to the 1.4.1 manifest.
- decode any of the four drawable LOD slots, not just slot 0
- viewer buttons for in-file LODs and _hi/_mid/base sibling files,
  camera kept across switches
- keep every pooled texture a material binds as a toggleable layer:
  color, normal map (per-pixel lighting) and multiply overlays
- "Applied textures" dropdown with Default / Color + normals / None
- Texture Browser: open a model's bound textures as flat images,
  with Export All PNG
- sync Cargo.lock to 1.4.1
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 02:31:11 +00:00
github manually merged commit 0337a45137 into gh-pr/19/base 2026-11-27 02:31:13 +00:00
Author
Owner

@⁠rpatty-dev on GitHub · 2026-11-22 02:23 UTC · original

Merged onto main (resolved the test conflict in main.rs and fixed the unused_mut warning in model3d.rs in commit 6687bcd; 52/52 tests + release build passing). Thanks for the LOD switcher and texture layers!

**@⁠rpatty-dev** on GitHub · 2026-11-22 02:23 UTC · [original](https://github.com/rpatty-dev/PercyStar/pull/19#issuecomment-7072878332) Merged onto main (resolved the test conflict in main.rs and fixed the unused_mut warning in model3d.rs in commit 6687bcd; 52/52 tests + release build passing). Thanks for the LOD switcher and texture layers!
This discussion has been locked. Commenting is limited to contributors.
No description provided.