chunky-dev / chunky

A path tracer to create realistic images of your Minecraft worlds.
https://chunky-dev.github.io/docs
GNU General Public License v3.0
643 stars 76 forks source link

Improve biome blending in 3D #1637

Closed aTom3333 closed 8 months ago

aTom3333 commented 11 months ago

This PR improves performance of doing biome blending during chunk loading. The combined time of step 3 and 4 (loading chunks and finalization ; biome blending occurs during step 4) has roughly been halved based on my rough timings. (Sorry, no precise timings provided, I've been winging it a bit). The improved performance and the improved asymptotic complexity of blur make it reasonable to do blur bigger than 333 so that's now possible and exposed in the UI. As an added bonus that wasn't really intentional, memory usage has decreased when using trivial 3D biome structure (by virtue of not storing biome color for every block, more on that later).

The improved performances are achieved for 3 reasons:

The setting for enabling/disabling biome blending has been replace for a setting to choose the biome blending radius (and a radius of 0 means biome blending is disabled)

Sorry no screenshot of bigger radius, I'm too lazy and my test scene is stupid looking anyway

aTom3333 commented 11 months ago

The third optimization is smart… Could that save memory in 2d biomes too because we could have a "don't care" biome then? Similar how we have any nodes in the octree?

It could be applicable with limited changes to the 2D case as well, if no block in the chunk uses biome color, the color for the biome doesn't need to be stored. We don't even need a "don't care" thing, we just won't store the color in the world texture in the first place.

leMaik commented 8 months ago

Something strange is happening with the biome colors… image

leMaik commented 8 months ago

Rebased and resolved conflicts, I'll test again and merge this if it works now. :+1: