Fix major rendering bug of semi-transparent blocks#55
Fix major rendering bug of semi-transparent blocks#55KokeCacao wants to merge 1 commit intomisode:mainfrom
Conversation
|
I'm hesitant to merge this PR, both as I don't fully understand what is going on, and rebuilding the meshes every rendering frame doesn't seem like a super good idea. Translucency sorting is complicated and it's not my goal to have Sodium-level accuracy. Though of course if there are quick wins without impacting performance too much, I'm still interested in that. |
The current algorithm only sorts transparent portions (which is small). It is currently done in |
|
Edit: To people who care, in addition to commits above, Some litematic I used for testing (for future reference): |
|
I've done some profiling of this PR when used in my jigsaw previewer. When rendering a trial chamber, this increases render time per frame from <3ms to around 75ms. About 60% of that comes from the inefficient use of The |
|
I will maintain this feature on my own repo for offline rendering. |
|
@jacobsjo Thanks for the profiling. Didn't realize I have also improved loading speed of the schematics and rendering becomes the new overhead. The sorting now (with some improvements on my own repo), now costs nearly nothing. It is very implementable. I believe the main overhead comes from the mapping function in mapping |
|
@KokeCacao Just to note: you didn't add any commits to match your latest comments. |
Yes. I will do it when I get time. Although my local version is up-to-date with all |
Related Issue: #54
Related PR:
Purpose: Mainly, this PR fixes issues when rendering multiple semi-transparent blocks stacked together.
How it's done:
Specifically:
getMeshes()is removed and replaced withgetTransparentMeshes(cameraPos: vec3)andgetNonTransparentMeshes()drawColoredStructureanddrawStructureshould change accordingly, and non-transparent chunks should be rendered first.The result was tested on various chunk sizes and view angles. Feel free to reorganize my code.