3D Tunnel/Cave Effect

Hello Every One,



I need some basic documentation for implementing tunnel effect in jmonkey3



I am done with Basic Terrains but i am confused regarding the concept of ““Procedural Terrain Generation”” and its linkage to Cave 3d Effect



I have read some forum threads regarding Cave 3d but never found it on Google Code



Could some one provide the basic implementation …



i am using Eclipse as IDE



Thanks…

Jme’s TerrainQuad does not support caves/tunnels.

There are procedural terrain cave implementations throughout the forums. This is one of them: http://hub.jmonkeyengine.org/groups/user-code-projects/forum/topic/procedural-infinite-3d-cave-generation/?topic_page=1&num=15

It was built from this document: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html



If you want free code for it you might be out of luck. I cannot remember if anyone posted their implementation on the forums. But do start by reading the GPU Gems article I linked.

Thanks for the reply,



is it possible to implement a simple tunnel effect like camera flying through an infinite tunnel



just provide the links for implementing this in jmonkey …

You are going to need dig into this yourself, as there is nothing already built in jME…



I have not read that through, but the topic sounds promising

Procedural 3D Tunnel Generation - General and Gameplay Programming - GameDev.net



You are probably going to need this knowledge as well:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes

Thanks a lot man …



I just needed good documentation as you have provided …



In Open Gl ES 1.1 I made a Cylinder based on the triangles, textured it on inside and then rotated it 90 degrees and moved it outwards giving a crude tunnel effect but it was too hectic and also not very detailed …



Anyways Thanks…

The random nature of the perlin noise used by terrain algorithms such as cave 3D makes it hard to make an ‘infinite tunnel’. Your tunnel will either be VERY wide ( setting a high threshold for solid / void ) or be prone to close ( setting a low threshold ).



If I was making an infinite tunnel, I would use a nurbs curve as a centerline and generate a cylinder with a few permutations of noise around it. This way, the nurbs curve could be used by you to control both the path and length of the tunnel.



I think using marching cubes and perlin noise is a bad idea. Especially if you need the terrain to load fast - not sure if that is the case…

Scroll down in the thread @Sploreg posted and you’ll find the “free code” posted a bit further down:

http://code.google.com/p/cave3d/



I believe @phr00t is generating the terrain in his new game using this system. He might have some updates to share.

Download section hosted on Google code only contains some .jpg or .png files



but the code file is missing… I am still searching the web …



Anyone having the updated code may like to share



Thanks

You probably won’t be able to get endless tube-like caves from cave3d. cave3d generates more complex spaces which are more interesting, in my opinion. I don’t use it to generate caves, though… only mostly above-ground terrain. I also modified it quite a bit to squeeze out some more performance.


I think using marching cubes and perlin noise is a bad idea. Especially if you need the terrain to load fast – not sure if that is the case…


I believe cave3d is marching tetrahedrons and it doesn't use perlin noise, but a modified noise function that is much faster. Who uses perlin noise when you have simplex noise these days? :P

EDIT: You can get cave3d here: http://code.google.com/p/cave3d/source/browse/trunk#trunk%2Fjme3%2Fcave3d

Thanks @phr00t



SO what do u suggest … in order to create a simple tunnel effect ???



I am trying to get hold of cave3D …



Cheers

You could make a handful of tube-shape models (straight lines, bends, forks etc.) and then connect them together in your scene… that’d be pretty easy, but it’d be rather limited to the number of tube models you create.

Take the marching tetrahedrons from cave3d, change the noise algorithm to one that generates tunnels.



Simplest would be project a cylinder to infinity in both directions and then use noise to modify the edges of the cylinder.



Then next step is to vary the size of the cylinder.



Then add curves, branches, etc.



Really its down to you how far you want to take it :slight_smile:

@zarch, @phr00t



Could you refer some tutorials or documentation regarding the algorithm of cave3d so that i might be able to configure the code according to my needs…



Thanks in Advance

There is no documentation on cave3d, as far as I know. You have to understand what marching tetrahedrons is first before you’ll understand what cave3d is doing… you have to modify the density function (e.g. the “scalar field” stuff in cave3d) to return non-dense values inside your tube (less than 1, I think) and dense values outside of your tube (>1). This is why I suggested skipping the whole cave3d thing, because it can be hard to wrap your head around and modify accordingly… although, it is probably the best method once you understand it.

1 Like

Thanks Once again @phr00t ,



I am looking into marching cubes [tetrahedrons] algorithm and your above post made a lot of sense regarding the scalar field and the Threshold Value…



in the mean time i would like to share this stuff i found



Introduction to Catmull-Rom Splines



The zip file has the demo and is quite nice and close to what i need to implement…



May be u would have a look into this …



Cheers…