Improve render performance#499
Open
Zuzka-Cat wants to merge 6 commits into
Open
Conversation
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.
I used Opus 5 to speedup the rendering as the slice and preview tab was sluggish on my high refresh monitor, with success. I don't know if ai code is wanted but it is an improvement. I also still feel some hitches sometimes when dragging around a model, i don't know if that was the case beforehand or not. I haven't tested if there are regressions, i suspect there could be on non fdm modes. I feel like i can work on it a bit more and let opus look how other slicers improve the performance. I also saw WebGL2 in the changes, i don't know if this K:M supposed to work with WebGL 1.0 then it would need further changes definitely.
Opus says:
I stopped Kiri from rebuilding every object's world matrix each frame, made layer materials shared and correctly opaque instead of per-slice and falsely transparent, merged each slice's geometry (and the whole ruler's per-glyph label meshes) into single draw calls, and added GPU occlusion culling that skips bands of layers proven hidden by a depth query.
Draw calls dropped from 120–539 to 8–41 and CPU time inside renderer.render fell from 3.3–5.6 ms to 0.16–0.56 ms — roughly 15–20×.
Measured in Firefox at 520 Hz: slice view went 201 → 355 fps and preview 207 → 353 fps on a 2.36 M-triangle model, while a solid 9.5 M-triangle model went 97 → 512 fps in slice view (occlusion culling drops it to 35 k triangles drawn, pixel-identical) — median frames now hit the 520 Hz cap, though dense previews while orbiting still sit around 108–318 fps.