Advertisement

Smoother voxels through marching cubes: GPU or CPU

Started by September 13, 2019 06:01 PM
1 comment, last by taby 5 years, 4 months ago

Hi, 

 

I'm currently getting started with learning about computer graphics. To do so, I am planning on doing a project such as a small minecraft clone or something to learn various techniques. 

Since I thought it'd be nice to have something "better looking" than just blocks, the marching cube algorithm seemed to be a nice option to smooth the blocks into some other mesh shape. 

However, I had a question regarding that. 

As far as I understood, the neat thing about voxels is that you can just send the position of the voxel, ie one vertex per voxel, to the GPU, and a geometry shader can then take care of building the actual blocky mesh from that data. Therefore, I thought it'd be useful to include something like the marching cubes algorithm in the geometry shader, since it'll save work. However, I read online that marching cubes is usually only executed on the CPU and not in a shader, for various reasons. 

 

I was wondering if anybody had any thoughts on this? Wouldn't using it on cpu before shading make me lose the advantage of just sending 1vertex per voxel to the gpu instead of a whole mesh? 

 

Thanks! 

I run Marching Cubes on the CPU. Well, that's not entirely true: I have offloaded the vertex interpolation step onto the GPU, which accelerates the Marching Cubes algorithm as a whole.

You would also likely partition your voxel field, so that way you don't have to update the entire terrain every time a voxel's value changes.

Sorry that I don't have much other to add. Best of luck.

This topic is closed to new replies.

Advertisement