Skip to content

PBR: derive diamond, calcite and glazed terracotta F0 from IOR, and zero diamond_ore emission #239

Closed

Description

@BharathASL

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_ore uses 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_ore has 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) and L650 (Diamond crystal facet Green is F0 48). Assert iorToF0(2.417), like the emerald checks at L260 and L300.

Dielectrics with no stated derivation

  • calcite uses F0 14 (tools/lib/pbr-rules.json:L889), which is n ≈ 1.61. Calcite averaged over nω/nε ≈ 1.57 gives 13.
  • glazed_terracotta uses 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:L436 to use iorToF0. Add a glazed terracotta F0 assertion next to L465-L467.

Diamond ore emission

  • diamond_ore gem 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 set deepslate_diamond_ore gem emission to 0 for that reason (asserted at tools/test/pbr-generator.test.mjs:L317-L320), and every other ore is 0. Set diamond_ore gem 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 same every((f) => (f.emission ?? 0) === 0) check used for the deepslate variant. The synthetic emissive-core fixture in tools/test-shader-fixtures.mjs builds its own specular map and does not read pbr-rules.json, so it is unaffected.

Line endings

  • .gitattributes has no rule for *.txt, so tools/test/fixtures/vanilla-1.21.6-block-stems.txt checks out with CRLF on Windows with core.autocrlf, against .editorconfig's end_of_line = lf. Nothing breaks today (the index copy is LF and the test splits on \r?\n). Add *.txt text eol=lf to the text block at .gitattributes:L2-L15.

Acceptance criteria

  • Every gem, glass, quartz, obsidian, calcite and glazed terracotta F0 in pbr-rules.json equals iorToF0(n) for a stated n, and the tests assert it through iorToF0.
  • No ore material emits light, diamond_ore included, and a test covers it.
  • .gitattributes pins *.txt to LF.
  • The CHANGELOG.md [Unreleased] entry matches the final values, and npm test passes.

Activity

  1. added
    type: taskAtomic (<1 hr) development task
    priority: P3Low priority / specialized or decorative (<5% occurrence)
    epic:particles-shadersEpic 14: Cinematic Vector Particles & LabPBR Shader Pipeline
    on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:particles-shadersEpic 14: Cinematic Vector Particles & LabPBR Shader Pipelinepriority: P3Low priority / specialized or decorative (<5% occurrence)type: taskAtomic (<1 hr) development task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions