Fix glass block translucency: use CPU uniforms and auto-detect block.png layout - #467
Merged
Merged
Conversation
…png layout The authored block shader hardcoded glass opacity to 0.82-0.97, ignoring FragmentUniforms.reserved2 written by viewMaterials (intended 0.30-0.78). Restore reading glassMin/glassMax/Fresnel power from uniforms so video can show through the crystal center like the go.1ink.us reference. Also auto-select atlas vs single-tile crop when block.png dimensions differ (2816×1536 atlas vs 768×768 single tile) so wrong subregion coords do not crop a corner sliver and break metal/glass masks. Co-authored-by: Noah Cohn <noahc42@gmail.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe change adds image-dimension-based block texture configuration during image loading and updates authored glass opacity to use configurable Fresnel parameters from shader uniforms. ChangesBlock rendering updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Problem
test.1ink.us/tetris-webgpublocks looked much less translucent thango.1ink.us/tetris— not because of PHP, htaccess, or UTF-16 encoding.Root causes
Shader ignored CPU glass tuning —
fragmentMain.wgslhardcodedglassMin=0.82/glassMax=0.97whileviewMaterials.tswrites artist-tunable values (default ~0.30–0.78) intoFragmentUniforms.reserved2. Glass centers stayed ~82–97% opaque, so the video portal barely showed through.Different deployed assets —
go.1ink.usserves a 768×768block.png(~1 MB) loaded as a single tile.test.1ink.usserves the 2816×1536 atlas (~6.5 MB) with subregion extraction. Same Apache COOP/COEP headers on both hosts; PNGs are served as binaryimage/png.Wrong crop if atlas coords used on a single tile — subregion defaults target the middle tile of the 2816 atlas. Applying them to a 768 image crops a corner sliver and breaks metal/glass mask baking.
Fix
glassMin,glassMax, and Fresnel power fromfUniforms.reserved2in the authored sampling path.applyBlockTextureConfigForImageDimensions()picks atlas vs full-image crop based on image size before tile extraction.Testing
npm test— 213 passedSummary by CodeRabbit
New Features
Bug Fixes