Repository navigation
feat(pbr): expand LabPBR 1.3 material properties matrix (#53) - #231
Merged
Merged
Conversation
There was a problem hiding this comment.
Blockers
tools/lib/pbr-rules.json:L456:netherite_blockusesf0: 237, which is the LabPBR 1.3 hardcoded metal ID for silver (230 iron, 231 gold, 232 aluminum, 233 chrome, 234 copper, 235 lead, 236 platinum, 237 silver). Shaderpacks will render netherite with silver's complex IOR. LabPBR has no netherite preset; use255(albedo-driven metal) and update the assertions attools/test/pbr-generator.test.mjs:L301and:L614.tools/lib/pbr-rules.json:L339,:L381,:L521:redstone_ore,deepslate_redstone_oreandcrying_obsidianset a flatemission: 180with nocolorFeatures.evaluatePixelintools/lib/pbr-generator.mjsapplies the material value to every opaque pixel when no feature matches, so the whole face emits, including the stone, deepslate and obsidian matrix. Only the dust and tear pixels should glow. Scope emission tocolorFeatureskeyed to those pixels, the waydiamond_oredoes, and keep the base emission at 0. Unlit redstone ore also does not glow in vanilla, and both block states share one texture, so emission onredstone_oreneeds a stated rationale or should stay at 0.- PR body: the PR does not use the repository's
pull_request_template.md. The Description, Related Issues, Type of Change and Checklist sections are all missing (.github/CONTRIBUTING.md§4.3), and no issue is linked. Restore the template and link the tracking issue.
Nits
tools/lib/pbr-rules.json:L344,:L400:emerald_ore(f0: 40) anddeepslate_diamond_ore(f0: 48) apply gem reflectance to the entire block, including the host rock. The gem F0 belongs incolorFeatures, matchingdiamond_ore, with host-rock F0 around 10–14 for the rest of the face.tools/lib/pbr-rules.json:L610,:L614:*terracotta*also catches*_glazed_terracotta(glossy glaze, not porosity 15 / smoothness 30), and*concrete*catches*_concrete_powder(loose granular, not smoothness 50 / porosity 2). Add explicit patterns for those ahead of the generic ones, or narrow the globs.tools/lib/pbr-rules.json:L11: thenormalStrengthchange from1.0to1is an unrelated reformat. Revert it to keep the diff scoped.CHANGELOG.md: no[Unreleased]entry for the material matrix, unlike the preceding feature PRs.
Scope gem F0 and crying obsidian emission to colorFeatures; netherite uses albedo-driven metal 255. Signed-off-by: Bharath <bharathasl74185@gmail.com>
BharathASL
force-pushed
the
feat/pbr-material-matrix
branch
from
September 23, 2026 19:16
5c31233 to
68904d4
Compare
There was a problem hiding this comment.
Blockers
tools/lib/pbr-rules.json:L758,:L765,:L772,:L779,:L793:resolveMaterialmatches the texture stem exactly (tools/lib/pbr-generator.mjs:L210), andtools/build.mjs:L311passes vanilla texture names as that stem. Vanilla shipsquartz_block_side/top/bottom,basalt_side/topandpolished_basalt_side/top. It has noquartz_block,smooth_quartz,basaltorpolished_basalttexture, and smooth quartz reusesquartz_block_bottom. None of those four entries can ever apply. They fall back todefaultMaterial, and so doesblackstone_top. Key them to the real stems, either with exact entries or with patterns such asquartz_block_*,basalt_*andpolished_basalt_*. Dropsmooth_quartz, and point the tests attools/test/pbr-generator.test.mjs:L325-L352to real stems. Right now they pass only because they query names the build never produces.tools/lib/pbr-rules.json:L410,:L418,:L426,:L434, and the same entries at:L568-L592: the LabPBR 1.3 green channel is linear F0 (value/255). F0 36–42 is F0 0.14–0.16, which works out to IOR 2.2–2.4, the reflectance of diamond. Emerald (beryl, n ≈ 1.57) has F0 ≈ 0.050, which is about 13. As written, emerald gems render with diamond-level reflectance. Derive the value from IOR,((n-1)/(n+1))^2 * 255, and update the assertions attools/test/pbr-generator.test.mjs:L685and thef0 >= 36checks.tools/lib/pbr-rules.json:L903,:L910,:L761,:L768,:L810,:L817,:L825-L866,:L875: the same F0 problem affects the dielectrics. 16 is IOR ≈ 1.67 and 22 is IOR ≈ 1.83. Soda-lime glass (n ≈ 1.52) should be about 11, quartz and amethyst (n ≈ 1.54) about 12, and obsidian (n ≈ 1.49) about 10. Amethyst at 22 is almost double the correct reflectance. Correct the values and the matching assertions attools/test/pbr-generator.test.mjs:L327,:L332,:L358,:L363,:L373,:L392,:L397,:L429,:L668,:L698and:L703.
Nits
tools/lib/pbr-rules.json:L642-L674:deepslate_diamond_oregem pixels emit 10–35. Diamond ore does not glow in vanilla, and this contradicts the rationale the PR gives for keeping redstone and emerald at emission 0. Set gem emission to 0 here, or state why diamond is the exception.tools/lib/pbr-rules.json:L709-L742:raw_iron_block,raw_gold_blockandraw_copper_blockapply hardcoded metal IDs to every opaque pixel. Raw iron is ore chunk (dielectric), and the dark crevices on all three textures are not bare metal. Use dielectric F0 as the base and scope the metal ID to highlightcolorFeatures, or keep them dielectric.tools/lib/pbr-rules.json:L316,:L323,:L330,:L475,:L482,:L489,:L496,:L625,:L705: the iron, copper, gold, lapis and coal ores, including their deepslate variants, have nocolorFeatures. Their elevated F0 (12–15) therefore also covers the host rock, which is the problem this PR fixed for emerald and diamond. Either scope it the same way or keep the host at 10.- PR history: the reviewed commit
5c31233was replaced by a force-push to68904d4during active review..github/CONTRIBUTING.md§4 requires fixes as separate signed-off commits on top. Push later iterations as new commits.
…m IOR Signed-off-by: Bharath <bharathasl74185@gmail.com>
Contributor
Author
|
There was a problem hiding this comment.
Blockers
None.
Nits
tools/lib/pbr-rules.json:L640,:L648,:L656,:L664,:L672:deepslate_diamond_oregem F0 values are 44, 48, 48, 50 and 40. Only 44 comes from n = 2.417. The others are copied fromdiamond_oreand work out to n ≈ 2.3–2.6.CHANGELOG.md:L19-L20says gem F0 is derived from refractive index, so either set every gem feature to 44 or change the entry to say only emerald is derived.tools/lib/pbr-rules.json:L889,:L917: calcite and glazed terracotta use F0 14 (n ≈ 1.61). Nothing states where that value comes from, unlike glass, quartz and obsidian. Calcite averaged over nω/nε ≈ 1.57 gives 13, and a silicate glaze at n ≈ 1.5 gives 10–11. Either derive these values or name the source in the PR..gitattributes:L11:*.txthas no rule, so on Windows withcore.autocrlfthe newtools/test/fixtures/vanilla-1.21.6-block-stems.txtchecks out with CRLF, which conflicts with.editorconfig'send_of_line = lf. The index copy is LF and the test splits on\r?\n, so nothing breaks. Add*.txt text eol=lf.
Closed
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Expands
tools/lib/pbr-rules.jsonwith LabPBR 1.3 physical and optical properties for stone and deepslate ores, metal blocks, minerals and masonry, and architectural blocks, so the_n/_spipeline from #186/#187 produces material-specific maps beyond the initial stone, ore and soil set.Refs #53
resolveMaterialmatches the texture stem the build derives from the master filename, and masters are named after vanilla textures. Every exact material key is either a vanilla 1.21.6 block texture stem or a pattern target. Vanilla ships noquartz_block,smooth_quartz,basaltorpolished_basalttexture, so those faces resolve throughquartz_block_*,basalt_*andpolished_basalt_*patterns, andblackstone_topthroughblackstone_*.smooth_quartzis removed: the block reusesquartz_block_bottom.((n-1)/(n+1))^2 * 255: soda-lime glass and tinted glass n = 1.52 → 11; quartz block and amethyst (quartz, nω = 1.544) → 12; obsidian and crying obsidian (volcanic glass, n ≈ 1.49) → 10; emerald gem pixels (beryl, n ≈ 1.57) → 13. Diamond gem pixels keep the 40–50 range shared withdiamond_oreonmain, which brackets the IOR-derived 44 (n = 2.417).deepslate_diamond_oreanddeepslate_coal_ore. Where only part of the face differs (redstone dust, emerald and diamond gems), the distinct properties live incolorFeaturesalongside host-rock features. Iron, copper, gold, lapis and deepslate coal ores have no vector masters yet, so there are no mineral colours to key; the whole face keeps host-rock F0 10 until each master lands with its owncolorFeatures.colorFeatures(vanilla crying obsidian emits light level 10 at all times).230, gold block231, copper block234. Netherite uses255(albedo-driven metal) because LabPBR has no netherite preset;237is silver. Raw iron, gold and copper blocks are ore chunks with dark crevices, so they stay dielectric (F0 10) rather than applying a metal ID to every pixel.*_glazed_terracottaand*_concrete_powderpatterns are declared ahead of the generic*terracotta*and*concrete*globs;*glass*covers stained glass.tools/test/fixtures/vanilla-1.21.6-block-stems.txtlists theassets/minecraft/textures/blockstems of the 1.21.6 client jar.tools/test/pbr-generator.test.mjschecks that every exact material key is a vanilla stem or a pattern target, that every pattern matches at least one vanilla stem, and that every stem it resolves is a real vanilla stem. Dielectric F0 assertions are computed from the cited refractive indices. Pixel-level specular packing covers tear emission, the non-emissive obsidian matrix, redstone dust and host at emission 0, gem pixels at gem F0 and emission 0 with host pixels at F0 10, raw gold packing dielectric green 10, and netherite packing green255.CHANGELOG.md[Unreleased]entry added.The
colorFeatureshex keys for redstone, emerald and crying obsidian approximate vanilla colours; no vector masters exist for those blocks yet, so the keys should be re-matched against the palette when the masters are authored. Pixels outside the 64-unit match tolerance fall back to the host-rock base values, which are non-emissive.Affected Assets
tools/lib/pbr-rules.jsontools/test/pbr-generator.test.mjstools/test/fixtures/vanilla-1.21.6-block-stems.txtCHANGELOG.mdType of Change
feat: New vector texture master, blockstate, or compiler capabilityfix: Tiling fix, palette correction, or bugfixdocs: Documentation improvementchore/refactor: Maintenance, dependencies, or codebase cleanupContributor Checklist
Please check all applicable boxes before requesting review:
Vector Texture Standards (if adding/modifying SVGs)
viewBox="0 0 512 512"). Not applicable: no SVG masters changed.npm testpasses.rx) matchtextures/block/stone.svgexactly. Not applicable: no ore textures added.Build & Verification
npm run buildlocally and verified that the pack compiles successfully.dist/. Not done in-game; specular channel values are verified bynpm test(test:pbr).Git Hygiene & Standards
feat(textures): ...).git commit -s).mainwith no merge commits..editorconfig(2-space indent, LF endings, trailing newline).