•      Sign In
• Create Account

## A tile system... for a sphere?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

12 replies to this topic

### #1Jossos  Members

343
Like
0Likes
Like

Posted 10 May 2013 - 06:04 AM

So I'm trying to work out how I would go about doing a tile system wrapped around the shape of a 3d sphere (like a planet). I can do this in the shape of a Torus quite easily, but it's a sphere I'm after. I'm not even sure where to begin to be honest.Computer generated spheres (like in maya or 3ds max) seem to use triangles for the poles and the squares squash and stretch to fill the shape, which is just no good for a tiling system for a game.

Any help is appreciated.

Edited by Jossos, 10 May 2013 - 06:05 AM.

### #2Olof Hedman  Members

5699
Like
1Likes
Like

Posted 10 May 2013 - 06:54 AM

I think the easiest would be to have triangular tiles all over the sphere, and generate a sphere like this: http://sol.gfxile.net/sphere/

### #3AllEightUp  Moderators

5613
Like
2Likes
Like

Posted 10 May 2013 - 08:28 AM

Actually, I have always seen the subdivided cube approach as probably being easier for this particular item.  You start with 6 faces (2 triangles each of course), when you subdivide you push the new verts out to the sphere boundary repeat.  The advantage is ending up with rectangular areas after each subdivision which keeps the texture mapping simple.

### #4LorenzoGatti  Members

4080
Like
0Likes
Like

Posted 10 May 2013 - 09:54 AM

Do you really need to tile the whole sphere at the same time? Maybe you can get away with a tangent plane; whenever the "camera" moves you switch to a nearby tangent plane, pretending that the sphere is flat.

Omae Wa Mou Shindeiru

### #5C0lumbo  Members

4065
Like
6Likes
Like

Posted 11 May 2013 - 12:30 AM

POPULAR

The one you see most often from modelling tools is made by starting with an icosahedron and subdividing each triangle. As I think you're getting at, triangles aren't very good cells for a strategy game.

But, if you take your subdivided icosahedron and truncate it (http://en.wikipedia.org/wiki/Truncated_icosahedron), then you get an awesome shape sometimes known as a buckyball, which is made up of lots and lots (number depends on how subdivided the icosahedron was) of hexagons (which are great for strategy games) and 12 pentagons (which are rather inconvenient). However, if you can live with those pesky pentagons somehow, then this is a great option.

If you want square cells (or just a simple life), then as AllEightUp says, take a cube, subdivide it, then warp it into shape. When you warp your cube into a sphere, the squares become misshaped and inconsistently sized. This approach http://mathproofs.blogspot.co.uk/2005/07/mapping-cube-to-sphere.html is slighty better than the obvious approach of just normalising each vertex.

### #6Dir3kt  Members

166
Like
1Likes
Like

Posted 13 May 2013 - 03:09 AM

Beside using some ico sphere, there is another way to do it. It might work or not depending on the kind of game you are implementing.

Have your classic 2D tilemap with squares. Make it wrappable. That's it if you got to the end left you will come back to the right, etc.. Like Asteroid but make the camera move instead of the player. Navigating through such a space already give a 'sphere impression' because if you keep going in a direction at some point you will come back to your initial position. It's not 100% accurate though because if you go in diagonal the path would be longer than if you go in a straight direction.

Then the trick is to use a spherical vertex shader to make the 2D plane looks like a sphere. The idea is to rotate each point in function of their distance from the center of the screen. There is not much about it on the web but it's not difficult to implement if you know a bit of GLSL.

The nice thing is that all the logic is very simple because it's still 2D however it gives to the player the illusion that he is playing on a sphere. Here is a proof of concept (a project that I sadly abandoned) :

http://www.zappedcow.com/sphere/

### #7Jossos  Members

343
Like
0Likes
Like

Posted 14 June 2013 - 03:21 AM

Have your classic 2D tilemap with squares. Make it wrappable. That's it if you got to the end left you will come back to the right, etc.. Like Asteroid but make the camera move instead of the player. Navigating through such a space already give a 'sphere impression' because if you keep going in a direction at some point you will come back to your initial position. It's not 100% accurate though because if you go in diagonal the path would be longer than if you go in a straight direction.

This more of a torus really. But I like this idea a lot, and might just do that.

### #8Zennoya  Members

178
Like
0Likes
Like

Posted 14 June 2013 - 05:58 AM

And what you think about hexagon sphere? Its possible to be done as easy as triangles (becuase its made of them), and also hexagons are nice fields for strategy game (a lot of games use those already).

Edited by Zennoya, 14 June 2013 - 05:59 AM.

### #9Sik_the_hedgehog  Members

2950
Like
0Likes
Like

Posted 16 June 2013 - 08:11 AM

Have your classic 2D tilemap with squares. Make it wrappable. That's it if you got to the end left you will come back to the right, etc.. Like Asteroid but make the camera move instead of the player. Navigating through such a space already give a 'sphere impression' because if you keep going in a direction at some point you will come back to your initial position. It's not 100% accurate though because if you go in diagonal the path would be longer than if you go in a straight direction.

This more of a torus really. But I like this idea a lot, and might just do that.

In case you're curious, the perspective would end up looking something similar to this:

Actually those special stages pull off that very same trick (OK, not exactly given the hardware that was on, but I mean it was just a 2D plane with a fake sphere look). I don't think anybody ever bothered to wonder how those special stages would map to an actual sphere.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

### #10Olof Hedman  Members

5699
Like
0Likes
Like

Posted 17 June 2013 - 02:58 AM

And what you think about hexagon sphere? Its possible to be done as easy as triangles (becuase its made of them), and also hexagons are nice fields for strategy game (a lot of games use those already).

It's not possible to make a sphere out of hexagons, without a few pentagons

### #11Camilo  Members

189
Like
0Likes
Like

Posted 30 June 2013 - 01:49 AM

The one you see most often from modelling tools is made by starting with an icosahedron and subdividing each triangle. As I think you're getting at, triangles aren't very good cells for a strategy game.

But, if you take your subdivided icosahedron and truncate it (http://en.wikipedia.org/wiki/Truncated_icosahedron), then you get an awesome shape sometimes known as a buckyball, which is made up of lots and lots (number depends on how subdivided the icosahedron was) of hexagons (which are great for strategy games) and 12 pentagons (which are rather inconvenient). However, if you can live with those pesky pentagons somehow, then this is a great option.

If you want square cells (or just a simple life), then as AllEightUp says, take a cube, subdivide it, then warp it into shape. When you warp your cube into a sphere, the squares become misshaped and inconsistently sized. This approach http://mathproofs.blogspot.co.uk/2005/07/mapping-cube-to-sphere.html is slighty better than the obvious approach of just normalising each vertex.

I second the buckyball idea. Actually, you could use triangle tiles to draw it (just squishing the tiles that make up a pentagon a tiny bit), but for game logic purposes use the center of the pentagons/hexagons as tiles. Or alternatively, if you want all your faces to be the same size and shape (but irregular triangles) draw a pentakis dodecahedron and use the vertices as game positions. Either way, each of the 32 "game tiles" still has 5 or 6 neighbors.

### #12Legendre  Members

981
Like
0Likes
Like

Posted 30 June 2013 - 04:19 AM

Look at the sphere on the extreme right in this: http://sol.gfxile.net/sphere/

Take two triangles, they form a distorted square (where triangle join at the diagonal of the square).

Perhaps you can distort your square tiles in the same way and use them to tile the sphere?

### #13WorldPlanter  Members

266
Like
0Likes
Like

Posted 02 July 2013 - 11:07 AM

If you don't care about non-uniform tile sizes/morphology you can always try a quad sphere.

http://www.youtube.com/watch?v=N-X1eevWU9s

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.