SebLague/Marching-Cubes

blocking wait for GetComputeBufferData

SimLeek opened this issue · 6 comments

I've been trying to speed this thing up on my fork and render out further. Increasing the chunk size helps, but I noticed something in the performance window:

image

The main reason larger chunks take longer is because they take longer on the GPU. But the CPU and GPU are different devices, so they can operate concurrently. Unity has a function called AsyncGPUReadback that solves this, though it adds some latency. I think adding that to UpdateChunkMesh would work.

It works, but not with collision meshes. Still good for clouds.

image

How did you implement it?

Er...

Here's my fork, though I may need to update it: https://github.com/SimLeek/Marching-Cubes

I tried to call replace the GPU functions with AsyncGPUReadback and other Async functions as much as possible, undoing a few times that broke things, and I found it works best for very, very large volumes, about 5-10x the size of a good value for the non-async chunks in each dimension.

Yea the last update was Jul 3 and i dont see any signs of AsyncGPU.
large scale voxels is what im working with, Im dealing with up to of 960 Chunks each one at 32x32x32 and updating them fairly frequently. I have got it running fairly smoothly but my attempts to intergrate Async Readback failed.

Right. I'll add notes to my calendar to make sure I push that by Saturday then.

I believe I was able to do chunks with sizes 1024x1024x1024 iirc. Each one took a second or so to generate, and some didn't, but it still ended up with huge worlds.

Here we go: SimLeek@b2a92dc

Look for "blockingGpu"