FalsePattern / FalseTweaks

Multithreaded rendering plus a large collection of improvements, fixes, optimizations and additions to 1.7.10 clients.
https://falsepattern.com/mc
Other
58 stars 6 forks source link

Poor ambient occlusion performance #26

Closed makamys closed 1 year ago

makamys commented 2 years ago

If smooth lighting is enabled, the mod reduces the framerate while chunks are being updated. This happens even with all options in the config disabled. When smooth lighting is turned off however, the mod doesn't affect framerate.

Comparing profiler snapshots, I have found renderStandardBlockWithAmbientOcclusion to be the culprit: its CPU time increases from 10% to 25% with Triangulator. So the issue seems to be caused by @embeddedt's smooth lighting fix.

Frametime graphs (chunk updates begin in the middle)

Without Triangulator (~130 fps): With Triangulator (~100 fps):

Snapshots (.nps)

snapshots.zip

Mods

falsepatternlib-mc1.7.10-0.9.4.jar
mixingasm-1.7.10-0.2.1.jar
sampler-1.60.1.jar
SpongeMixins-1.4.0.jar
triangulator-mc1.7.10-1.7.3.jar

World

Seed: -2819719315308026247 XYZ: (-29, 64, 81)

embeddedt commented 2 years ago

This might be due to the Inject allocating a CallbackInfo object every time. Maybe the Redirect version pushed recently to master would fix that?

makamys commented 2 years ago

I'm using 1.7.3, which has the latest commit.

FalsePattern commented 2 years ago

i am currently working on a full rewrite of the solid block rendering system inside the https://github.com/FalsePattern/Triangulator/tree/rewrite branch, replacing vanilla code, using a full overwrite, with improved and more modular render code

FalsePattern commented 1 year ago

Should be fixed in 2.0 alpha 1, i made the mixin for the target an @Overwite instead, which has zero overhead (with a fallback config option for enabling @Inject mode in case another mod also mixes into those 2 methods.)

makamys commented 1 year ago

Nice! I repeated the experiment with 2.0, and the issue appears to be gone.

Without Triangulator (~133 fps)

With Triangulator 2.0 (~134 fps)

With Triangulator 1.7.3 (~111 fps)

Mods

00gasstation-mc1.7.10-0.3.2.jar
falsepatternlib-mc1.7.10-0.10.10.jar
sampler-1.60.1.jar
[nothing] OR triangulator-mc1.7.10-2.0.0-alpha0001.jar OR triangulator-mc1.7.10-1.7.3.jar