JMonkey Dual Marching Cubes

JMonkey Dual Marching Cubes

This projects tries to port the dual marching algorithm from the ogre volume component to Jmonkey

Ogre Source:
This is the website of the creator of the ogre volume component where he explains how the things are working

At the moment the project contains two executables, Main which generates a terrain:

And the NiftiyTest where to play arround with constants:

Explanation of constants:

Geometric Error
This is the tolerated geometric error that decides whether to split the node of an Octree into eight children or not.
Smaller Geometric Error generates a more detailed mesh.

This limites the values the density grid is allowed to have.
A small value and less Octrees are split.
0 is no limit.

The width of a cell cannot be smaller than this value.

Don’t split the OctreeNode if nothing is inside.

Value for Marching Squares to fix cracks between chunks with level of detail


What needs to be done:
-Level of Detail
-Make the terrain editable


First test with directional light:

:smiley: :lol:

I read a bit more and dual marching cubes sounds pretty nice:

(This image compares the source (upper left), the marching cubes version (lower left), the dual contouring version (lower right) and the dual marching cubes version (upper right).)

1 Like

Hm, the dual methods both use a Quadtrees and it seems to be difficult to implement this into a minecraft style world.
Marching Cubes has problems with sharp edges.
It seems that Castle Story does not use such a method at all.
They divide each block in 3 parts in the height. Now they use different variations of ramps.

I used a modified version of this marching cubes implementation for 3089:

I’d love to try out dual marching cubes, but I haven’t been able to find an implementation for it that I can understand how to use :stuck_out_tongue: I’m curious how quick dual marching cubes creates the meshes… it might take longer to calculate a mesh with fewer polygons, negating some of the net performance gains. Let me know if you figure anything out…

Hi, I am back and at the moment I port the Ogre Volume Dual Marching Cubes to JMonkey.
I think I am allowed to share the code with you because Ogre is open source, am I?

Terrain with marching cubes:

Terrain with dual marching cubes (there are some small mistakes but most of it is working)


If you’re reimplementing, you’re free to publish anyway. There’s no copyright on algorithms.
Patents are different, they allow you to publish an algorithms but you’re required to obtain a license before you can run a patented algorithm. (Yes that’s silly. Google for “software patents” to appreciate the full silliness.) Marching Cubes used to be patented under U.S. law, but that patent expired 2005 so this one is in the clear.

<cite>@ogerlord said:</cite> Hi, I am back and at the moment I port the Ogre Volume Dual Marching Cubes to JMonkey. I think I am allowed to share the code with you because Ogre is open source, am I?

If you’re talking about this:

It’s released under MIT license (along with the rest of Ogre) which is basically a do what you want as long as you keep the copyright notices.

I also thought about converting this code to JME, so I would be very interested in your work. Please post!

I am talking about the GSoC 2012 Project (description) (c++ source)

And here is what I have done:!eU4DyC6S!UkUyBCO72UMBqT24744ECzP5vvM5roFsdmuzAbhOQD8

Now I am looking at the lod implementation but it is confusing because all the code is in only one long class (Chunk) .

Wow, nice! If i get some time maybe I can help. I have experience converting other Ogre projects to JME.

I’d love to help out with this too. Can you upload it to another site, like MediaFire? I don’t trust anything that says it can’t work in Chrome Incognito mode…

Nice, maybe we need a repository?

I modified the triplanar textur shader of the jmonkey terrain:

Here is the download from another hoster (project now with unfinished chunk classes)


Better yet upload to a version control site like bitbucket…

1 Like

Uploaded it to googlecode:

(I hope its working, never done anything with subversion & co)

Maybe someone wants to make the calculation of the screenSpace Error?
He uses the method camera->getFOVy() which is not included in jmonkey

1 Like
@phr00t said: I'd love to help out with this too.
Oooh, time to leak some 3099 rumors! :P
@aaronperkins said: Better yet upload to a version control site like bitbucket..
This, please. Edit: That's it!
Oooh, time to leak some 3099 rumors! :P

Hey now! :stuck_out_tongue: I’d definitely replace the current marching cubes implementation with this if it provides better terrain with fewer polygons :slight_smile:

What about an IRC Channel (or something similar) for better communication?
I notice I get more and more stuck and not that everyone is waiting for the others to make new commits.

We have to be given commit rights… I’m jvight at the usual gmail dot com. I don’t necessarily see whats wrong with posting here about it? :expressionless: