Marching Cubes

User projects written in or related to FreeBASIC.
Post Reply
Gunslinger
Posts: 103
Joined: Mar 08, 2016 19:10
Location: The Netherlands

Marching Cubes

Post by Gunslinger »

I came across a term called Marching Cubes on youtube somewhere.
He pointed me to this source http://paulbourke.net/geometry/polygonise/
So i tested my freebasic skills and made this from it.
With the help of the nice openB3D lib it was not so hard.

http://ac1.servegame.com:88/Screens/Screenshot05.png
http://ac1.servegame.com:88/Screens/Screenshot06.png

Code: Select all

http://ac1.servegame.com:88/download/MarchingCubesBeta.zip
Tell me what you think of it.

Things to do
- Improve is light smoothing at vertex points
- Marching Cubes special case check.
- Add detail resolution option
- Optimize speed
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: Marching Cubes

Post by angros47 »

Nicely done. Since you use OpenB3D, you may like to know that it supports Marching Cubes rendering, and it uses it for metaballs, and for isosurfaces (they can be defined with an array, or with a function pointer)

OpenB3D uses a variant of marching cubes that allows to change level of details according to the distance from camera, to reduce rendering time

Here is an example:
https://freebasic.net/forum/viewtopic.p ... 3&p=212124
UEZ
Posts: 972
Joined: May 05, 2017 19:59
Location: Germany

Re: Marching Cubes

Post by UEZ »

@Gunslinger: looks very nice. Thanks for sharing.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Marching Cubes

Post by BasicCoder2 »

Gunslinger wrote:Tell me what you think of it.
Looks good. Moving about is a bit slow? Couldn't see any marching cubes.
Gunslinger
Posts: 103
Joined: Mar 08, 2016 19:10
Location: The Netherlands

Re: Marching Cubes

Post by Gunslinger »

BasicCoder2 wrote:
Gunslinger wrote:Tell me what you think of it.
Looks good. Moving about is a bit slow? Couldn't see any marching cubes.
what is your fps in window title?
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Marching Cubes

Post by BasicCoder2 »

There is no window it is full screen so I can't see the fps in the window title.
When I say slow I should have asked can the speed be changed by changing some increment or decrement somewhere?
Gunslinger
Posts: 103
Joined: Mar 08, 2016 19:10
Location: The Netherlands

Re: Marching Cubes

Post by Gunslinger »

BasicCoder2 wrote:There is no window it is full screen so I can't see the fps in the window title.
When I say slow I should have asked can the speed be changed by changing some increment or decrement somewhere?
No there is no setting for speed i just feel like show it as it is
If you get 60 fps it is still kind of slow. you can modify the code to your one likes :)

In mean while i keep working on this project, when i got something better i post it again.
I already know what whats the first game i'm going to make from it. ^^
Gunslinger
Posts: 103
Joined: Mar 08, 2016 19:10
Location: The Netherlands

Re: Marching Cubes

Post by Gunslinger »

Update to voxels
I don't have a lot of time to work on mij hobby projects like this.
recently i have become full time father for mij dochter.

Here is a update
move around with W,A,S,D and E, Z
space = jump with red bal.
Mouse left-button = paint green
Mouse right-button = add voxels
Mouse wheel to change size or go negative to remover

Image http://ac1.servegame.com:88/Screens/ScreenshotA.png
Image http://ac1.servegame.com:88/Screens/ScreenshotB.png
Download http://ac1.servegame.com:88/download/ForumTest11.zip
Post Reply