Skip to main content
3 of 6
added 58 characters in body; added 67 characters in body
Engineer
  • 30.3k
  • 4
  • 75
  • 123

To keep things simple, I'd do the following:

We assume as a starting point something like your target tile shape at the top - a 1-bit bitmap which I assume tesselates correctly - if not, get the tesselation working first.

Create a Tuple<float, float> array[64][31]. Each such array cell is a UV coordinate (0.0->1.0 exclusive range) into the original image you'd like to project onto your isometric tile format. For cells that aren't part of the tile, just use e.g. Float.MaxValue for x and y (and remember to check for those and skip them when processing - see below).

Populating this is a matter of using a mapping formula from iso to ortho space . There are plenty of posts around on isometric conversion formulae, see for example this answer. The end result is essentially that you will map every isometric-space tuple to an image-space UV coordinate.

Once you've populated this conversion array with the mappings, you could write a nice wrapper function that uses the mappings for any tile that wants to populate itself from an image:

tile = new Tile();
tile.FromImage("/images/myimage.jpg");

...which will run through the isometric array tuples and pull the corresponding coordinates from the named image, and possibly apply some smoothing / subtexel sampling.

Engineer
  • 30.3k
  • 4
  • 75
  • 123