Skip to content

docs(first-light): distinguish the UV shaders from the authored material - #3350

Open
jeremygold02 wants to merge 2 commits into
ItsNotRexed:mainfrom
jeremygold02:docs/first-light-material-provenance
Open

jeremygold02 wants to merge 2 commits into
ItsNotRexed:mainfrom
jeremygold02:docs/first-light-material-provenance

Conversation

@jeremygold02

@jeremygold02 jeremygold02 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Coordination claim on #3232. The package-local effect lookup landed in #3036.

The default first-light fixture draws a model from the package with two translated game shaders. The old title and opening could be read to mean that the model's exported material selects this pair. The model and shaders reproduce exactly, and the material assignment tells a different part of the story.

Evidence

  • Recovered the documented OBJ from the local Xbox 1.0.2.1 package. Its public digest, 4,213 vertices and 7,968 triangles all matched. The pinned decoder and a separate raw metadata read agreed on one mesh selecting material slot zero, the sole slot.
  • The material's shader hash resolves to exactly one native effect. Its sole technique has four passes. Each selects one program in the compute group, and none selects a vertex, mesh or pixel program. Reading all four actual program headers independently confirmed compute shader model 6.6 in each.
  • Selected the documented UV shaders by archive offset at fix(first-light): select same-stage shader variants by archive offset (BUILD-834) #2893 and verified both published FSSM digests. The command-line and harness draws were byte-identical, with 12,804/16,384 pixels covered. All eight first-light tests passed with the local fixture. GPU run

The guide, index and CLI help now describe both defaults. The untextured draw displays model UVs. With --dds, the default pixel shader samples the supplied texture. The guide also links directly to the merged effect lookup tool. Gameplay use of the reference model remains open.

At 3b598a9b, I rebuilt the native Vulkan harness and ran both modes with the documented mesh, no shader overrides, and a synthetic four-color 2×2 DDS for the textured case. The mesh and vertex program were byte-identical. The manifests selected different pixel programs. Both images had the same 12,804 covered pixels out of 16,384, and the RGBA values changed on all 12,804. Both modes passed the tool's image checks. With the local fixture and harness enabled, 52 focused tests and 18 subtests passed. The NVIDIA device reported subgroup size 32.

AI-assisted by Codex. Package checks used an Intel Core Ultra 7 265K. The Vulkan draws used an NVIDIA GeForce RTX 5070 (621.01), Windows 11 Home 25H2 build 26200.9974, Python 3.12.10. Integrated Intel Graphics (32.0.101.9150) was also installed.

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Read 88c1a9b on Windows 11 (Python 3.13.7): pass for what the repository can confirm

  • The manifest fields the new paragraph names exist as written: rpf9dump writes MeshShaders (tools/rpf9dump/Program.cs:285) and Materials[].Shader as 8 hex digits (:290); docs/models.md:294 and :491 describe them the same way.
  • The new opening no longer says the VS and PS are the model's own, which agrees with section 1 of the same page ("the chosen VS applies no matrix", two ordinary containers from shaders.rpf).
  • Both links resolve: TEST-608: resolve stored SGD5 technique passes to shader carve offsets #3036 is open (TEST-608), and the fix(first-light): select same-stage shader variants by archive offset (BUILD-834) #2893 comment reports the documented OBJ digest, 4,213 vertices, 7,968 triangles and 12,804 of 16,384 pixels on Windows, matching the numbers already in docs/first_light.md.
  • At the head: test_docs_design_rows 2, test_docs_links 5, test_docs_list_items 2, test_docs_repo_paths 2, test_i18n_index 5, all OK; git diff --check clean.

Not verified (needs the game): that MeshShaders[0] is slot 0 and the only slot for this model, and that its shader hash resolves to one effect with one technique and four compute-only passes. The lookup relies on #3036, which is not merged. AI-assisted check (Claude Code).

@iurysf

iurysf commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Code read of 88c1a9b: the reframing is the right call and the manifest fields it names exist; it leaves three places saying the opposite.

Ran at this commit (Windows 11, -W error): tests/test_docs_design_rows.py, test_docs_links.py, test_docs_list_items.py, test_docs_repo_paths.py, test_i18n_index.py, test_text_write_line_endings.py — all OK.

AI-assisted code read (Claude). No game data used.

@ramenbellic

Copy link
Copy Markdown

Code read of 3302d4e:

  • The three places an earlier review flagged are now reworded: docs/README.md:74, tools/first_light.py:1 and :470. The manifest fields the new paragraph names exist (tools/rpf9dump/Program.cs:285, :290). I can't check the effect, technique and pass counts without the package.
  • TEST-608: resolve stored SGD5 technique passes to shader carve offsets #3036 has since merged (tools/sgd5_effects.py is on main), so the dependency is met. The "effect lookup" link at docs/first_light.md:28 could point to that tool instead of the PR.
  • A trial merge with current main is clean, but main has added a textured mode (main docs/first_light.md:106, "With a texture"). With --dds the default pixel shader changes (main tools/first_light.py:594). After the merge, the new title (docs/first_light.md:1), the index line (docs/README.md:74) and the help text "The default pair displays its UVs" (tools/first_light.py:470) describe only the untextured default. A word on --dds would keep them accurate.
  • test_first_light passes (OK, 3 skipped at the head and 4 skipped merged), as do test_docs_links, test_docs_design_rows, test_docs_list_items, test_docs_repo_paths and test_i18n_index, both at the head and merged.

AI-assisted review (Claude Code); no approval or change request.

jeremygold02 added a commit to jeremygold02/Leonida that referenced this pull request Nov 22, 2026
@jeremygold02

Copy link
Copy Markdown
Contributor Author

Thanks for catching the --dds wording. At 3b598a9b, the guide, index and rendered CLI help describe both defaults, and the guide links directly to the merged effect lookup tool.

I ran both modes on the same 4,213-vertex mesh with no shader overrides. The vertex module and mesh bytes matched, the selected pixel modules differed, and the four-color test texture changed all 12,804 covered pixels. The 3,580 background pixels remained identical. With the local fixture and harness enabled, 52 focused tests and 18 subtests passed.

I also checked one limitation of the fixture. Two synthetic BC1 DDS inputs with identical midtone blocks and different DXGI tags (71 and 72) produced byte-identical images. In a separate diagnostic build, changing the sampled Vulkan image and view to sRGB moved the red sample from 0.517578 to 0.230469 at every covered pixel. The shipped harness currently creates a UNORM view in both cases. These runs establish the fixture's sampling behavior. The game's choice of image view and material for this draw remains open.

Intel Core Ultra 7 265K and NVIDIA GeForce RTX 5070 (621.01, subgroup 32), Windows 11 Home 25H2 build 26200.9974, Python 3.12.10. AI-assisted by Codex.

@zneel

zneel commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Reviewed and tested 3b598a9b on Windows 11 Pro 10.0.26300, AMD Ryzen 7 9800X3D CPU (64 GB RAM), AMD Radeon RX 9070 XT (AMD 26.11.2), Python 3.12.10: looks good, one wording suggestion.

run result
python -m compileall -q make_game.py tools tests clean

Review: Read the three changed files at the head, which sits on current main (aa2988cc) and so includes main's --dds textured mode. The description's claims hold for the guide and index: the new title, status paragraph and index row cover both modes, "Section 6" is the textured recipe, ../tools/sgd5_effects.py exists and its --shader-hash takes the Materials[].Shader value the paragraph names, and no "its own translated" wording is left in the tree. python -I tools/first_light.py --help from a temp copy of the head prints the new description, and the --ps help names PS_Copy as the --dds default, so the rendered help is accurate. No open first_light PR or main rewords these texts. The effect, technique and pass counts need the package and were not checked. One sentence the PR rewrote in the module docstring is wrong.

  1. tools/first_light.py:8: "Without a DDS texture, the vertex shader forwards clip-space POSITION and TEXCOORD." This makes the vertex shader depend on --dds, but it does not change: --vs defaults to DEFAULT_VS in both modes (:591), and only the pixel shader switches (:656, DEFAULT_TEXTURED_PS if a.dds else DEFAULT_PS). The paragraph also never names the --dds pixel shader. Suggested: "The vertex shader forwards POSITION and TEXCOORD; the default pixel shader writes the interpolated TEXCOORD (the model's UV map), or with --dds is PS_Copy, which samples that texture."

AI-assisted (Claude Code); I checked the results.

@thirteenhustler

Copy link
Copy Markdown

Tested 3b598a9 on Linux 6.12.113+, Python 3.12.3 (no GPU, no game data): pass, one wording fix.

Ran: python -m compileall -q make_game.py tools tests; python -I tests/test_docs_links.py (6 OK), test_docs_design_rows.py (2 OK), test_docs_list_items.py (2 OK), test_docs_repo_paths.py (2 OK), test_docs_table_rows.py (2 OK), test_docs_cli_flags.py (3 OK), test_i18n_index.py (5 OK), test_text_write_line_endings.py (3 OK), test_first_light.py (19 tests, 15 passed, 4 skipped; no package or harness). python -I tools/first_light.py --help prints the new description, and --ps names PS_Copy as the --dds default.

The new title, status paragraph and index row cover both modes. Section 6 is the textured recipe. ../tools/sgd5_effects.py exists, and its --shader-hash takes the Materials[].Shader value. MeshShaders is the per-geometry material index (tools/rpf9dump/Program.cs:304, docs/models.md:294). The effect, technique and pass counts for this model need the package and were not checked.

tools/first_light.py:8-9: "Without a DDS texture, the vertex shader forwards clip-space POSITION and TEXCOORD. The default pixel shader writes the interpolated TEXCOORD." --vs stays DEFAULT_VS in both modes (:591). Only the pixel shader switches (:656, DEFAULT_TEXTURED_PS if a.dds else DEFAULT_PS). Suggested: "The vertex shader forwards POSITION and TEXCOORD. The default pixel shader writes the interpolated TEXCOORD (the model's UV map), or with --dds is PS_Copy, which samples that texture."

@DenRakEiw

Copy link
Copy Markdown
Contributor

Tested

@kapitche

Copy link
Copy Markdown
Contributor

Tested 0e960fe merged with main 98fa503 on Linux (Python 3.12.16): pass. test_first_light.py, test_first_light_bad_json.py, test_first_light_harness_paths.py, test_first_light_mesh_draw.py and 1 more; the four tests/test_docs_*.py 9/9 ok. Negative control with main's tools/first_light.py: all still pass, so these tests do not exercise the change.

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested 4c6ea0cc merged onto main dde82f27 on Windows 11, CPython 3.14.3, CPU only: pass.

This PR changes no test file, so I ran the test files that use the changed modules.

  • python -I tests/test_first_light.py: 47 tests OK (skipped=8).
  • python -I tests/test_first_light_bad_json.py: 9 tests OK.
  • python -I tests/test_first_light_harness_paths.py: 4 tests OK.
  • py_compile on the 1 changed Python file: OK; git diff --check: clean.

No game files. AI-assisted (Claude Code).

@isfcrctfs isfcrctfs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read 4c6ea0cc on Linux (CPython 3.12.16): the docstring matches the code.

DEFAULT_VS does forward clip-space POSITION/TEXCOORD (tools/first_light.py:55), --camera selects CAMERA_VS (:977), and with --dds the default pixel shader is DEFAULT_TEXTURED_PS = PS_Copy_3ea4b38a_Wrapped (:1009). Dropping "its own translated VS/PS" from the docs/README.md row also removes the one claim that contradicted section 1 of docs/first_light.md (the chosen pair is two ordinary containers, not the model's authored assignment).

On the docs guards: test_docs_table_rows, test_docs_table_ids, test_docs_repeated_lines, test_docs_repo_paths, test_docs_list_items and the other test_docs_* pass. test_docs_cli_flags and test_docs_links fail identically at the PR base dde82f27 and at 8575d36e (the --ssa-rewrite in docs/embedded_shaders.md is a spirv-opt flag, and the docs/dev-tools.md anchor), so they are pre-existing and not caused by this change.

One nit: PS_Copy alone is not a name choose() accepts (:148-157 matches the exact carve-index name), so say PS_Copy_3ea4b38a_Wrapped as docs/first_light.md:126 does, or write "the PS_Copy shader".

AI-assisted.

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.

10 participants