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:
https://bitbucket.org/sinbad/ogre/src/cf6c42374443584e96b02a605aab285768090040/Components/Volume/src?at=v1-9-0RC1
This is the website of the creator of the ogre volume component where he explains how the things are working
http://www.volume-gfx.com/

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.

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

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

minSplitDistanceDiagonalFactor
Don’t split the OctreeNode if nothing is inside.

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

Repository:
https://code.google.com/p/jmedualmarchingcubes/

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

7 Likes

http://hub.jmonkeyengine.org/forum/topic/jme3-marching-cubes-smoother-method/#post-195197

http://hub.jmonkeyengine.org/forum/topic/voxel-terrain-2/#post-194311

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).)

http://www.ogre3d.org/forums/viewtopic.php?f=13&t=69449

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.
(http://imageshack.us/a/img826/1492/beztytuuwxc.png)

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

http://hub.jmonkeyengine.org/forum/topic/my-marhcing-cube-algorithm/

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)

3 Likes

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:

https://bitbucket.org/philiplb/ogrevolumeterrain/

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
http://www.volume-gfx.com (description)
https://bitbucket.org/sinbad/ogre/src/cf6c42374443/Components/Volume?at=v1-9-0RC1 (c++ source)

And here is what I have done:
https://mega.co.nz/#!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)

3 Likes

Better yet upload to a version control site like bitbucket…

1 Like

Uploaded it to googlecode:
http://jmedualmarchingcubes.googlecode.com/svn/trunk/IsoDualContour/
https://code.google.com/p/jmedualmarchingcubes/

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

Maybe someone wants to make the calculation of the screenSpace Error?
Description: http://www.volume-gfx.com/volume-rendering/level-of-detail/runtime-selection-of-chunks-to-draw/
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: