I am creating marching cubes terrain which needs to run realtime. Currently, when generating more than 9 chunks at 32x32 cubes per chunk, my computer experiences performance problems which cause freezes, and this is a computer built for rendering 3D scenes. How could I optimize the attached script.
This script is already executed in a separate thread, as I leave generating chunks to the WorkerThreadPool.