Results 1 to 9 of 9

Thread: 3D->2D projection of a cube world?

  1. #1
    Guild Novice
    Join Date
    Feb 2012
    Location
    28° 32′ 1″ N, 81° 22′ 33″ W
    Posts
    7

    Default 3D->2D projection of a cube world?

    Hello everyone! I'm working on a strategy game that can be briefly described as chess around the surface of a cube. However, in keeping with the classic board game feel, I would like to maintain a 2D birds-eye view, thus requiring some sort of projection.

    I've found ways to capture 3 faces of the cube with triangular* or hexagonal maps, but creating a contiguous looping map is proving quite a challenge. I'm not sure if curving the grid lines is necessary, or if there is a simpler geometric tessellation that can do the trick. Spatial distortion isn't really an issue, so long as all the cells on the map are roughly the same size, there are no points at which more than 3 faces meet, and the same face doesn't wind up adjacent to itself.

    Any help or suggested reading material would be highly appreciated.


    *(http://api.ning.com/files/c6NeU9ShK6...rtianChess.jpg)

  2. #2
    Software Dev/Rep Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,333
    Blog Entries
    1

    Default

    Well, your existing board looks like it's a rectilinear projection of the cube centred at one of its corners with the projection point at the opposite corner (Which makes it very similar to a stereographic projection). That can be extended to cover the entire cube except for the corner opposite the one in the centre, which would end up at infinity, and the 3 spaces sharing it would be stretched around the entire perimeter of the board. They would also be extending to infinity, and the squares near them would be huge compared to those int he middle. An equidistant azimuthal projection would mitigate that though it would be more complex to figure out as you would have to project everything from the cube onto the cube's circumsphere first.

  3. #3
    Guild Novice
    Join Date
    Feb 2012
    Location
    28° 32′ 1″ N, 81° 22′ 33″ W
    Posts
    7

    Default

    Thanks for the response, Hai.

    The image I posted was actually a game I found called Martian Chess, which helped inspire this 3D board game project.

    I probably should have mentioned that this is going to be a computer game, not an "actual" board game. I'm not planning on having the entire cube visible to any player at any time; at most, one hemisphere. Players will be able to pan the center of the projection to different points on the cube, so the area in focus will be least distorted at any given time. I've been doing more research, and I think an orthographic projection is going to be the easiest to interpret from the player's seat.


    I think the steps involved will be something like this:
    1. Create a cube with grid lines
    2. Stretch the cube into a sphere
    3. Create an equator and prime meridian plane (which will be hidden in gameplay)
    4. Create an orthographic projection based on points relative angles to those planes

  4. #4
    Software Dev/Rep Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,333
    Blog Entries
    1

    Default

    Quote Originally Posted by heavyrocks View Post
    I probably should have mentioned that this is going to be a computer game, not an "actual" board game. I'm not planning on having the entire cube visible to any player at any time; at most, one hemisphere. Players will be able to pan the center of the projection to different points on the cube, so the area in focus will be least distorted at any given time. I've been doing more research, and I think an orthographic projection is going to be the easiest to interpret from the player's seat.
    No, orthographic wouldn't work as you wouldn't be able to cover the full sphere, just one hemisphere of it. That would put you in about the same position as the "martian chess" board. In fact you don't need the sphere, you can do an orthographic projection of a sphere directly, it's just an ordinary drawing of a cube without perspective.

    The polar aspect of the equidistant azimuthal projection is fairly simple to work with. If you can transform between Cartesian and Spherical coordinate systems, that's pretty much all you need to do.

  5. #5
    Administrator waldronate's Avatar
    Join Date
    Mar 2007
    Location
    The High Desert
    Posts
    3,549

    Default

    As you're only interested in showing one hemisphere at a time, wouldn't a simple three-face isometric display be sufficient? http://docs.bentley.com/en/MicroStat...s/standard.jpg shows a basic isometric projection of a cube and also offer the suggestion of using a "faded" and reversed backdrop for the backside of the cube. Then left and right directions would rotate the cube around the axis through the top and bottom faces, while up and down would make the top or bottom face visible. It would be, in effect, an "actual" 3D board while using only simple 2D graphics. If you'd like to have all faces visible at once, simply have two views.

  6. #6
    Guild Novice
    Join Date
    Feb 2012
    Location
    28° 32′ 1″ N, 81° 22′ 33″ W
    Posts
    7

    Default

    I think you might be on to something, waldronate. I guess the map should really just look like what you see when you rotate a rubik's cube in your hand.

  7. #7
    Software Dev/Rep Hai-Etlik's Avatar
    Join Date
    May 2009
    Location
    48° 28′ N 123° 8′ W
    Posts
    1,333
    Blog Entries
    1

    Default

    This is topologically equivalent to a cube with 4x4 grids on its faces as long as you treat the 3 outermost "squares" as touching at a corner.

    Click image for larger version. 

Name:	path28215.png 
Views:	13319 
Size:	377.7 KB 
ID:	42039

    Oh and if directions at a corner are important, then you need to reverse directions for the outside one. Clockwise at any of the inner corners is equivalent to counterclockwise around the outermost spaces.
    Last edited by Hai-Etlik; 02-07-2012 at 03:54 PM.

  8. #8

    Default

    @heavyrocks,

    I'm a little confused about what you want. In particular, you wrote
    I guess the map should really just look like what you see when you rotate a rubik's cube in your hand.
    I know of at least two free realtime 3D display programs that can show a perspective view of an object of whatever shape you define, which the player could rotate and view in realtime.

    Click image for larger version. 

Name:	cube.jpg 
Views:	1311 
Size:	61.5 KB 
ID:	42050
    (it took me about 15 minutes to create this object in my favorite display program, mostly because I kept making typos.)

    The programs include programming languages which would allow you to define the motions of the pieces.
    e.g. click on piece, rotate playing field, click on destination, check validity
    Selden

  9. #9
    Guild Novice
    Join Date
    Feb 2012
    Location
    28° 32′ 1″ N, 81° 22′ 33″ W
    Posts
    7

    Default

    Selden, that's pretty much the direction I'm going in now. I've been working largely on the conceptual end of the game (rules, game mechanics, basic perspective), but I have an associate with a strong background in graphic compositing and animation. He realized the simplest way to go about it, is to create a cube as such, but place the virtual camera from which the player views the world inside the cube. That way the screen is always completely full of spaces, and the image distorts realistically around the edges as you pan. We still have some tweaking to do with the camera's lens, but it seems to be an extremely elegant and flexible solution. I'll post pictures when things start to develop more.

    I really appreciate all the feedback from everyone. Some time down the road I'm also going to need a play-testing team. We worked out most of the game mechanics in an earlier, completely 2D version using GameMaker Pro, but we're adding the extra 5 cube faces for a new version using the Unity engine. I'm hoping to have some rough Beta in a month or so. Once we get over this initial 3D hurdle, most of the work will just be translating the scripts we were using before.

    I only stumbled across the Guild a few days ago while trying to figure this problem out, but I can already tell that this is quite a nexus of creative minds. Thanks again everyone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •