Jump to content
  • Advertisement
Sign in to follow this  

3D Smoother voxels through marching cubes: GPU or CPU

Recommended Posts



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? 



Share this post

Link to post
Share on other sites

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.

Edited by taby

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!