# 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
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

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

7 Likes

First test with directional light:

: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 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?

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)

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

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