Planetary terrain rendering

Hey.

I`m working on a procedural planets project. Implementation details are
resolved and most of them tested in C++.
But since I got interested in Java lateley, I want to complete my project
in J2SE. So my question to you is - which library to use?

I see that most obvious options would be:
Ogre4J - its being updated again and the logic in c++ should give some speed gain(less calls through JNI). But it should also lower flexibility. JOGL - too low-level, since you need to write all culling / scene graph yourself Java3D - dont know much
jME - didn`t make a good impression, looked too specialized and in the other direction of my needs

Bests,
Mirko

I think Java3d wouldn’t be the best choice for terrain experiments (to high level) its more a general purpose scene graph and VERY java like.

It always depends what you like to accomplish. You said pure OpenGL is to low level, if you focus on procedural terrain, any of the options you mentioned would probably be good enough to render your generated mesh (in this case i would recommend jME or Xith - I never used orge maybe its good too). But if you focus on terrain rendering techniques (or both) you will need pretty low level coding.

I would even say 90% of the code you will write for terrain rendering will have something to do with specialized scene graphs/space subdevision (including culling and similar things), triangulation and questions like how to update the terrain fast enough when you move :wink:

here is my (pretty old) procedural planetary terrain engine using JOGL for rendering.

I also would like an opinion on Ogre4J.
By the way, is your source code free?
It`s always interesting to look at different approaches.
I myself will go for quadtree continious LOD, where I
will make a cube of 6 2D planes and map it to a sphere.

You will probably be interested in this: http://www.vterrain.org/index.html Lot’s of resources and papers there. Also there is a MIT licensed Chunked LOD Terrain available on sourceforge: http://sourceforge.net/projects/vlterrain/.

Last year I created a quadtree Terrain engine for Xith3D which is still in progress, but might be interesting to you (or you might want to contribute ;)) It can load and display L3DT terrains by the way (http://www.bundysoft.com/docs/doku.php?id=l3dt:about). This is what it looks like:


http://img2.freeimagehosting.net/uploads/th.ac5b82b64d.jpg


http://img2.freeimagehosting.net/uploads/th.8e0ae1b681.jpg

As I said, I had a working prototype and implementation idea already set. Right now I`m looking ways to do it in Java.
Can anyone comment on Ogre4J?

But vterrain.org is a very good resource. When I worked on the prototype then I got tons of useful information there.

@mirko27
no, sorry my engine is not open source. I used the project mainly for experiments, it was never intended to be a open or commercial project and I simple have not the time to maintain an other open source project.

I myself will go for quadtree continious LOD, where I
will make a cube of 6 2D planes and map it to a sphere.
similar to my approach :wink: my terrain engine is a mix between several techniques. I use quadtrees for space subdivision and ROAM for continuous triangulation. The default ROAM implementation does not scale very well (esp. if you are moving fast), thats the reason why i decided to use a more memory intensive structure to traverse the mesh what simplifies normal calculation as an nice side effect. (what you really want is to access all triangles around a vertex or iterate through all triangles in a quad, right? :wink: ).

The first version was a infinite (procedural) terrain, later I added a box2sphere mapping mode which uses 3d perlin noise for terrain and texture generation.

@cylab
respect! Now I have to improve my texture mapping :confused:

maybe you will find interristing stuff in this simplified ROAM sample applet , source code are available
http://demo.dzzd.net/ROAMSample/

code snipet to build the terrain in Animator class:


this.land=new Landscape3D();
this.land.init(hMap,w,h,14,4);
this.land.computeVariance();
this.land.tessellate(w/2,h/2);

rendering is done by public void render(Graphics g) in Landscape3D class

I have improved this version in 3DzzD (that is still planned to be opensourced… just need time :frowning: ) using different technic for variance computation that take care of terrain silouhette and use a faster tesselation system using more memory and two methods : tesselate that build/precompute all possible triangle at a given quality and render that give the list of triangle for a given point of view with lowest impact on terrain silhouette. doing that should allow you infinite terrain rendering.

ROAM’s and continious-lod’s (constantly varying) datastructures are not optimal for modern GPUs.

Chunked LOD is one of the best algorithms, atm. Inside the ‘chunk’, you can use ROAM to get rid of most tris at initialization time.

I agree with Riven, you won’t be lucky if you use the full ROAM implementation since it was designed to run in “immediate mode”. But ROAM is more or less the mother of most terrain rendering algorithms. The triangulation part with the binary triangle tree and the idea of the “variance” (triangle error) computation is found slightly different in may other algorithms.

Today you should always try to keep your geometry on the GPU and plan updates carefully.

Here is an example for Java3D

http://code.j3d.org/examples/terrain/index.html

Their code is open so you should be able to look through it to see what they did in Java3D.