Jmeplanet

[video]http://www.youtube.com/watch?v=Si4P8ACTFyg[/video]

It’s a planet generator that renders efficiently from space to ground level using quadtree based LOD, skirt based seam correction, and a fractal height generator.

The goal of the project is to keep things simple. When exploring how to do this, a lot of the examples were really complex, and the code, often in C++, wasn’t very easy to understand. Most of the work was distilling all these ideas and code samples into something clean and concise.

The code can be found here

UPDATE
2/23/2012
New video of physics and shadow integration. Added Jaime walking across the surface by popular demand. :wink:
I also removed the logarithmic depth buffer for now and switched to a dual viewport scheme. this allows me to utilize stock jme3 materials and filters.

UPDATE:
1/27/2013
Added physics integration! Going to fast will end in clipping through the terrain but otherwise you can now travel along the surface of the planet.

5/13/2012
Added atmosphere and other effects. New video!

5/8/2012
Added water (using t0neg0d’s deformation shaders), some stars and a moon. New screenshot below.

4/29/2012
Added rickard’s lighting material.

TODO:

Generate terrain patches on a different thread to speed things up
More complex atmosphere (clouds)
Sun
Foliage (possibly with Forester)

37 Likes

Small update.



Messing around with water and other cleanup stuff. New code and screenshot posted above.



I’m using t0neg0d’s deformations shader for water. It looks nice from a distance, but do to the scale it gets pretty washed out up close. Suggestion welcomed!

1 Like

Hey, cool. Think there could be some transitioning/data transfer to go down to terain quad level with this when zooming in?

Not quite following you on that.



When you zoom the terrain splits and get more complicated in a way very similar to the jme3 terrain engine. I actually explored modifying the jme terrain engine for this, but it got a little to complicated for my sanity.

Yeah, basically like that but in the end, when you get close to the ground it technically becomes just a terrainquad like the ones that already exist so I thought of some blending option. e.g. when you look at the whole planet you see your algo’s results but when you zoom in to a continent you eventually see the terrainquads…

oh hey sweet, this looks nice!

Now I want to make a space game and use it… hehe



What normen means is when you get down close enough it switches to jme3’s TerrainQuad system. Might be tricky but not impossible I should think.

I understand now.



Conceptually a jmeplant is constructed from 6 quads arranged in a cube. The quad’s vertices are normalized around a center point to make it a sphere. I initially tried to make those 6 quads jme3 TerrainQuads. I’m missing a lot of the nice features jme3 terrain has, like collision detection, splatting, and terrain manipulation.It would be nice to leverage all those features somehow, but like I said, trying to get jme3 terrain to be curved hurt my brain.



I’ll be integrating collision detection for sure, so you can walk (or drive, or crash) on the surface. Not sure about the other features.

But thats what I say. When I walk around in the field I don’t have the feeling I walk on a curved surface. So a normal TerrainQuad should do, shouldn’t it?

The idea is to make the planet very large. Hence you won’t notice the curve just like you don’t notice the surface of Earth is curved.

…hence you can just as well use a TerrainQuad with all its goodies… got me mate? :slight_smile:

@normen said:
But thats what I say. When I walk around in the field I don't have the feeling I walk on a curved surface. So a normal TerrainQuad should do, shouldn't it?


When viewed from space (or even an airplane sufficiently high) though that field would be part of a curved surface. It's just flat at the human scale.

Maybe the solution would be to generate a TerrainQuad hightmap from the data and then switch it in when you get close enough then switch back when you leave?
@zarch said:
When viewed from space (or even an airplane sufficiently high) though that field would be part of a curved surface. It's just flat at the human scale.

Maybe the solution would be to generate a TerrainQuad hightmap from the data and then switch it in when you get close enough then switch back when you leave?

Exactly, when viewed from space you see like a million people. No way you can keep simulating bullet characters and all collision shapes at that scale. So you have to switch stuff anyway and it makes only sense to have this stuff going on when you are zoomed in anyway. As in any good game that thrives to go to planet scales, your data about the entitites is decoupled from the visual output. So you only need to switch the algorithm from say particles that simulate the characters locations to the actual characters roaming on the collision shape of the TerrainQuad when you zoom in and then you don't have any curvature anymore.

Hmm.

I got you…



I just don’t know how I’d go about integrating a TerrainQuad into this.



I’ll give it some thought.

I uploaded a video of it in action. Take a look up top.

2 Likes
The idea is to make the planet very large..

It would be interesting to see some images showing planet in real scales.

Maybe the solution would be to generate a TerrainQuad hightmap from the data and then switch it in when you get close enough then switch back when you leave?

I doubt it will work smooth because of the curvature.
@KayTrance said:
It would be interesting to see some images showing planet in real scales.


I doubt it will work smooth because of the curvature.


The point is that on a reasonably sized planet by the time you get close enough to do the switch then the visual field will essentially be flat anyway so you won't see the difference. A full sized planet would map to millions of terrain quads but you would only switch in a max of 4 at once, and then only once you got close enough.
1 Like
The point is that on a reasonably sized planet by the time you get close enough to do the switch then the visual field will essentially be flat anyway so you won’t see the difference. A full sized planet would map to millions of terrain quads but you would only switch in a max of 4 at once, and then only once you got close enough.

yes, I understand that, and that is why I placed a word "smootly" - doing blending won't give nice results and as well save extra time rather than implement some similar approach that is used in TerrainQuad, but for spherical terrain, imo.
A full sized planet would map to millions of terrain quads but you would only switch in a max of 4 at once, and then only once you got close enough.

Not millions, since quadtree based level of detail is used.

I like this very much! Thumbs up!

Why not millions? He said it’s generated using fractals which means you can keep zooming in for ever…You just adjust the level of detail on your fractal as you “zoom in” on an area.