fix(dashboard): white pines, see-through hills and fighting surfaces in the 3D views

- Shader 94 ("Basic") draws with vertex colors: its class's technique setup
  names Technique_Basic_Lighting_VertColor, as 38 "Basic VC" does. The views
  treated it as having none, so Nimbus Station's glom pines (tag S84) came
  out as their grey texture, white. The other shader looks in use were
  checked the same way (33, 35, 37, 70, 82, 84, 105 hold).
- Two layer shaders: NiTexturingProperty's dark texture and the UV set each
  texture's flags name are read, and the views draw "Two Layers Blended" as
  the dark texture under the base one by the vertex alpha (no longer as
  opacity) and "Two Textures Added" as in TwoLayersAdded_PS. Avant Gardens'
  snowy grass mounds were see-through hills. The client ships no technique
  for the blended ones, so that blend follows the meshes' data.
- The near plane follows how far out the camera is (distance / 400, 0.5 to
  20) instead of a fixed 0.5 over a far plane in the thousands, so ground
  overlays, floor rings and road pieces stop fighting in far views.
- Conversion format 3 (new model data), so kept conversions are made again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-28 09:07:35 -05:00
parent 966a12f4af
commit 7c6c4bc232
9 changed files with 272 additions and 77 deletions

View File

@@ -245,8 +245,9 @@ namespace {
* Bump when NifFile's output changes: converted models kept on disk are made again, and the manifests' "format"
* goes into the viewers' model and texture URLs so browsers don't keep drawing the old ones (they're cached for
* a week). 2: meshes carry their multishader tag; conversions without it drew glom parts with the LEGO shader.
* 3: dark textures and the UV set each texture names.
*/
constexpr uint32_t FORMAT_VERSION = 2;
constexpr uint32_t FORMAT_VERSION = 3;
// A zone's lighting (WorldScene::Lighting) for the viewers' shaders
nlohmann::json LightingJson(const WorldScene::Lighting& lighting) {
@@ -591,12 +592,17 @@ namespace {
return nullptr;
}
const auto folder = FolderOf(path);
std::vector<std::string> textures; // per mesh: a res path, "#<block>" for one stored in the .nif, or empty
// Per mesh: a res path, "#<block>" for one stored in the .nif, or empty; for its base and its dark texture
const auto where = [&folder](int32_t embedded, const std::string& file) {
if (embedded >= 0) return "#" + std::to_string(embedded);
return file.empty() ? std::string{} : FindTexture(folder, file);
};
std::vector<std::string> textures, darkTextures;
for (const auto& mesh : model->meshes) {
if (mesh.material.embeddedTexture >= 0) textures.push_back("#" + std::to_string(mesh.material.embeddedTexture));
else textures.push_back(mesh.material.texture.empty() ? std::string{} : FindTexture(folder, mesh.material.texture));
textures.push_back(where(mesh.material.embeddedTexture, mesh.material.texture));
darkTextures.push_back(where(mesh.material.embeddedDarkTexture, mesh.material.darkTexture));
}
auto encoded = std::make_shared<const std::string>(NifFile::Encode(*model, textures));
auto encoded = std::make_shared<const std::string>(NifFile::Encode(*model, textures, darkTextures));
g_Disk.Store(target, *encoded);
return encoded;
}