Repository navigation
PBR: derive diamond, calcite and glazed terracotta F0 from IOR, and zero diamond_ore emission #239
Copy link
Copy link
Closed
Labels
epic:particles-shadersEpic 14: Cinematic Vector Particles & LabPBR Shader PipelineEpic 14: Cinematic Vector Particles & LabPBR Shader Pipelinepriority: P3Low priority / specialized or decorative (<5% occurrence)Low priority / specialized or decorative (<5% occurrence)type: taskAtomic (<1 hr) development taskAtomic (<1 hr) development task
Description
Non-blocking findings from the final review of #231 (LabPBR 1.3 material matrix), plus one inconsistency it left on the existing diamond_ore entry. Verified on main. The CHANGELOG.md:L19-L20 entry says gem, glass, quartz and obsidian F0 is derived from refractive index as ((n-1)/(n+1))^2 * 255, but several values do not follow that.
Gem F0
- Diamond (n = 2.417) gives F0 44.
deepslate_diamond_oreuses 44, 48, 48, 50 and 40 across its five gem features (tools/lib/pbr-rules.json:L640,L648,L656,L664,L672), which work out to n ≈ 2.3-2.6.diamond_orehas the same five values (L67,L75,L83,L91,L99). Set every diamond gem feature on both entries to 44, the way emerald uses one IOR-derived value (13) for every gem feature. - Update the assertions that pin the old values:
tools/test/pbr-generator.test.mjs:L313-L316(f0 >= 48) andL650(Diamond crystal facet Green is F0 48). AssertiorToF0(2.417), like the emerald checks atL260andL300.
Dielectrics with no stated derivation
-
calciteuses F0 14 (tools/lib/pbr-rules.json:L889), which is n ≈ 1.61. Calcite averaged over nω/nε ≈ 1.57 gives 13. -
glazed_terracottauses F0 14 (L917). A silicate glaze at n ≈ 1.5 gives 10-11. - Derive both from IOR (or name the source for 14) and update
tools/test/pbr-generator.test.mjs:L436to useiorToF0. Add a glazed terracotta F0 assertion next toL465-L467.
Diamond ore emission
-
diamond_oregem features emit 20, 30, 30, 35 and 10 (tools/lib/pbr-rules.json:L69,L77,L85,L93,L101). Vanilla diamond ore emits no light. feat(pbr): expand LabPBR 1.3 material properties matrix (#53) #231 setdeepslate_diamond_oregem emission to 0 for that reason (asserted attools/test/pbr-generator.test.mjs:L317-L320), and every other ore is 0. Setdiamond_oregem emission to 0 as well. - Replace
tools/test/pbr-generator.test.mjs:L652(Diamond crystal facet Alpha has emission > 0) with an assertion that it is 0, and add the sameevery((f) => (f.emission ?? 0) === 0)check used for the deepslate variant. The synthetic emissive-core fixture intools/test-shader-fixtures.mjsbuilds its own specular map and does not readpbr-rules.json, so it is unaffected.
Line endings
-
.gitattributeshas no rule for*.txt, sotools/test/fixtures/vanilla-1.21.6-block-stems.txtchecks out with CRLF on Windows withcore.autocrlf, against.editorconfig'send_of_line = lf. Nothing breaks today (the index copy is LF and the test splits on\r?\n). Add*.txt text eol=lfto the text block at.gitattributes:L2-L15.
Acceptance criteria
- Every gem, glass, quartz, obsidian, calcite and glazed terracotta F0 in
pbr-rules.jsonequalsiorToF0(n)for a stated n, and the tests assert it throughiorToF0. - No ore material emits light,
diamond_oreincluded, and a test covers it. .gitattributespins*.txtto LF.- The
CHANGELOG.md[Unreleased]entry matches the final values, andnpm testpasses.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
epic:particles-shadersEpic 14: Cinematic Vector Particles & LabPBR Shader PipelineEpic 14: Cinematic Vector Particles & LabPBR Shader Pipelinepriority: P3Low priority / specialized or decorative (<5% occurrence)Low priority / specialized or decorative (<5% occurrence)type: taskAtomic (<1 hr) development taskAtomic (<1 hr) development task
Activity