smealum / SPACECRAFT

SPACECRAFT
53 stars 2 forks source link

Add technical documents/descriptions #3

Closed augustl closed 8 years ago

augustl commented 9 years ago

I'd love to see some technical docs that explains how the engine works. In particular, I'd love to read about how you manage to project a cube based world (?) onto a sphere.

ArthurSonzogni commented 9 years ago

The trick is our cubes aren't really cubics. There is a slightly deformations depending on where the user is on the planet.

This image is a good illustration : http://acko.net/files/making-worlds/planets-1-cubemap.png

The world is made of 6 face of a cube, then coordinates are projected into a sphere. There is 8 special place on each planet where the junction is made by 3 cube instead of 4. Hopefully, planet are sooo huge that it is very difficult to find these extrem places.

AkashaRepo commented 9 years ago

So there are 8 distorted cubes?

posva commented 9 years ago

@Nsheppard01 No, each distorted cube is a planet, I don't remember how many planets there are but that's more than 8 :smile:

AkashaRepo commented 9 years ago

No I mean when the cube becomes a globe, the cube's 8 vertexes become highly distorted blocks?

ArthurSonzogni commented 9 years ago

You can see initially a planet as a cube of 8 faces. Then we subdivide each faces in 4 faces recursively until the resolution is high enough. We get a sphere and not a cube because faces vertex are pushed in order to be at constant distance to the center of the sphere.

posva commented 9 years ago

Yeah, each face is subdivided and the initial cube becomes highly distorted. this distortion is visible in each of the 8 vertices of the initial cube which, as you can imagine, is where the distortion is at its highest degree. Is that what you were looking for? The best way to get yourself answers is to play with Spacecraft by yourself. It runs on Linux, Windows ans OS X.

We will love to hear what you think about it and any suggestions even if we are not going to implement them.