One of the main sources of time for chunk generation currently is the greedy mesher. currently it's a handful of monolithic jobs (one per direction).
I am in the process of a rewrite of the greedy mesher which will split the greedy meshing into multiple smaller jobs for better parallelization. This rewrite of the greedy mesher aims for a few things:
- Split into multiple stages each with jobs designed to be ran on data in parallel for better job system utilization, and smaller individual jobs to not block important Unity jobs and affecting framerate.
- Employ binary greedy meshing, using binary representations of the chunks to speed up most operations involved in the greedy meshing and culling steps.
- Unification of the jobs regardless of direction. Instead of having multiple jobs for different directions employing similar logic, the logic will be laid out in a way that allows it to work for all 6 sides, this will make it easier to maintain as a change to the algorithm doesn't need to be implemented 6 times.
- Trying to optimize the jobs instructions by optimizing for SIMD and reducing instruction count where possible (ie. instead of calculating an index from x, y and z with multiplication and division, if the loop's are ordered correctly this can be replaced with a single increment operation per loop instead of multiple multiplications and additions)
My hope is the result will be significantly more performant. The bulk of the code is done already, though it's largely untested, so if all goes well PR may be soon, otherwise a bit longer. I wanted to post this issue to let you know that I'm currently working on that area of the engine, in case you were thinking of spending time there as well so potential conflicts and time can be saved.
One of the main sources of time for chunk generation currently is the greedy mesher. currently it's a handful of monolithic jobs (one per direction).
I am in the process of a rewrite of the greedy mesher which will split the greedy meshing into multiple smaller jobs for better parallelization. This rewrite of the greedy mesher aims for a few things:
My hope is the result will be significantly more performant. The bulk of the code is done already, though it's largely untested, so if all goes well PR may be soon, otherwise a bit longer. I wanted to post this issue to let you know that I'm currently working on that area of the engine, in case you were thinking of spending time there as well so potential conflicts and time can be saved.