Skip to content

Fix enchanted held-item placement and glint rendering - #85

Open
HarnoorC wants to merge 1 commit into
NVIDIAGameWorks:mainfrom
HarnoorC:fix/enchanted-tool-rendering
Open

HarnoorC wants to merge 1 commit into
NVIDIAGameWorks:mainfrom
HarnoorC:fix/enchanted-tool-rendering

Conversation

@HarnoorC

@HarnoorC HarnoorC commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #65 (also reported as #84).

Enchanted tools held in first person drift as the camera turns. Vanilla's glint unions can flatten item poses before capture, and the projected-glint wrapper used by compasses and clocks emits fully posed vertices, so correcting only captured bones misses that geometry. Once the tool holds still, main's glint shows as purple artifacts around it: glint is an opaque cutout shell 0.0005 blocks out from the item, and the 0.1 view-model scale shrinks that gap tenfold.

Apply camera/FOV correction and the view-model scale once at the common capture root. Preserve local meshes and hand-owned transforms through vanilla's unions and sprite wrappers, and keep projected-glint UVs written after the normal. Streamed and projected parts use transient meshes, and block-breaking cracks keep a block-local pose. Wrapper dispatch stays typed and allocation-free.

Draw glint with the runtime's color-additive emissive blend instead of as a cutout. Layers keep main's request-order identity and shell depth, except glint: vanilla requests it before its substrate, so it sits one shell past the deepest non-glint shell, banner patterns included. Layer and text spacing are compensated for the view-model scale. Vanilla's two glint textures scroll at vanilla's phase and Glint Speed through the existing texture-update API, at intensity 300 so the band stays visible in daylight, and Glint Strength scales them. The hidden first-person body, which only secondary rays see, draws its items without glint, so its emission does not light the scene around the player. No native signature or runtime pin changes.

Add Fabric integration tests that run capture and submission through the production path against a counting API: camera turns with both hands, pose replay, crack reuse, instance reuse for layers vanilla rebuilds on every call, text spacing, glint and glowing-sign depth read from the built mesh vertices, and the hidden body drawing no glint.

This PR covers first person only. In third person, a held tool's glint still covers the item's whole square card instead of just its opaque texels (screenshot in the comments). That is left for a follow-up.

Validation on 408bdee:

  • gradlew.bat check: 813 JVM tests and 67 Fabric integration tests, no failures or skips.
  • tools\rtx.bat check --tests with the commit-message scan over this branch: 1,162 tests and 178 subtests.
  • In game, the latest main against this PR's head (408bdee), from the same position at night (before and after screenshots in the comments): on main the enchanted golden pickaxe held in first person is out of place and sits on a purple rectangle. On this head it stays in its corner and shows its glint with no purple artifacts around it, and nearby stone is not lit purple. When moving around, the tool no longer drifts as described in First-person held item is placed in world space and drifts with camera direction #84.

Signed-off-by: Harnoor Chima harnoorchima1@gmail.com

@HarnoorC HarnoorC changed the title Fix camera correction for enchanted first-person tools Preserve rigid capture for enchanted held items Nov 2, 2026
@HarnoorC HarnoorC changed the title Preserve rigid capture for enchanted held items Fix enchanted held-item capture and projected glint Nov 2, 2026
@HarnoorC HarnoorC changed the title Fix enchanted held-item capture and projected glint Fix enchanted held-item capture and glint blending Nov 2, 2026
@HarnoorC HarnoorC changed the title Fix enchanted held-item capture and glint blending Fix enchanted held-item capture and overlay rendering Nov 2, 2026
@HarnoorC HarnoorC changed the title Fix enchanted held-item capture and overlay rendering Fix enchanted held-item placement in first person Nov 3, 2026
@HarnoorC HarnoorC changed the title Fix enchanted held-item placement in first person Fix enchanted held-item placement and glint rendering Nov 3, 2026
@HarnoorC
HarnoorC force-pushed the fix/enchanted-tool-rendering branch from 789fb67 to 87e1d7c Compare November 3, 2026 08:33
@HarnoorC

HarnoorC commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Tested with enchanted golden pick axe in game:
(Before):
image

(After):
image

Third person has issues with transparent purple rectangles underneath the tool head.
Screenshot 2026-11-03 000950_pickaxe_glint

Fixes NVIDIAGameWorks#84.

Enchanted tools held in first person drift as the camera turns.
Vanilla's glint unions can flatten item poses before capture, and the
projected-glint wrapper used by compasses and clocks emits fully posed
vertices, so correcting only captured bones misses that geometry. Once
the tool holds still, `main`'s glint shows as purple artifacts around
it: glint is an opaque cutout shell 0.0005 blocks out from the item,
and the 0.1 view-model scale shrinks that gap tenfold.

Apply camera/FOV correction and the view-model scale once at the common
capture root. Preserve local meshes and hand-owned transforms through
vanilla's unions and sprite wrappers, and keep projected-glint UVs
written after the normal. Streamed and projected parts use transient
meshes, and block-breaking cracks keep a block-local pose. Wrapper
dispatch stays typed and allocation-free.

Draw glint with the runtime's color-additive emissive blend instead of
as a cutout. Layers keep `main`'s request-order identity and shell
depth, except glint: vanilla requests it before its substrate, so it
sits one shell past the deepest non-glint shell, banner patterns
included. Layer and text spacing are compensated for the view-model
scale. Vanilla's two glint textures scroll at vanilla's phase and Glint
Speed through the existing texture-update API, at intensity 300 so the
band stays visible in daylight, and Glint Strength scales them. The
hidden first-person body, which only secondary rays see, draws its
items without glint, so its emission does not light the scene around
the player. No native signature or runtime pin changes.

Add Fabric integration tests that run capture and submission through
the production path against a counting API: camera turns with both
hands, pose replay, crack reuse, instance reuse for layers vanilla
rebuilds on every call, text spacing, glint and glowing-sign depth read
from the built mesh vertices, and the hidden body drawing no glint.

This covers first person only. In third person, a held tool's glint
still covers the item's whole square card instead of just its opaque
texels. That is left for a follow-up.

Validation:

- `gradlew.bat check`: 813 JVM tests and 67 Fabric integration tests,
no failures or skips.
- `tools\rtx.bat check --tests` with the commit-message scan over this
branch: 1,162 tests and 178 subtests.
- In game on `7f01dd0`, which renders like this change apart from the
hidden body's glint: an enchanted golden pickaxe held in first person
at night shows its glint with no purple artifacts around it. That
build's hidden-body glint lit nearby cobblestone purple; the hidden
body's change is not yet rechecked in game.
- Not yet checked in game: enchanted tools in both hands while turning,
a held compass and cracks at FOV 30, 70 and 110, patterned shields,
glowing signs, charged creepers and breeze wind.

Signed-off-by: Harnoor Chima <harnoorchima1@gmail.com>
@HarnoorC
HarnoorC force-pushed the fix/enchanted-tool-rendering branch from 87e1d7c to 408bdee Compare November 3, 2026 08:55
@HarnoorC
HarnoorC marked this pull request as ready for review November 3, 2026 09:18
@HarnoorC
HarnoorC requested a review from sambvfx as a code owner November 3, 2026 09:18
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.

Enchanted items render with large purple/black quads and incorrect movement when rotating the camera

1 participant