2D Tilemap transitions using layering

I’m working on a 2D project which uses a tile based map/world with an orthograpic camera. The camera is positioned directly above the player at all times (the angle of view perfectly perpendicular to the tilemap).

The map has a possibility of having a large amount of different types of ground tiles, for example, deep water, shallow water, beach, grass, so on. To make the resulting map look smooth I need to have transitions between one type of tile to another. Classically (in 2D engines) this is done by use of transition tiles, something in the order of 16 different transition tiles per each type of ground tile. Without these transitions the 2d tile map looks like a bunch of square blocks (see an example at: Tile/Map-Based Game Techniques: Handling Terrain Transitions - General and Gameplay Programming - Tutorials - GameDev.net ). I don’t want to create all these extra tiles, they’re too time consuming, and I don’t need that level of transition detail. What I would rather do is use 3D terrain mapping techniques that blend textures together, such as this LayerShader. However, this type of shader requires 4 texture units on your video card just for 2 different textures, and more if you want more textures. I would like to support upwards of 16 different types of ground tiles. So I’m scratching my head trying to figure out how I could do that.

My current idea is as follows:
-For each terrain type present in the map create a 2D plane with that terrain texture and a AlphaMaskShader which bascially makes the terrain texture invisible in the regions where that terrain doesn’t exist on the map

-Layer all the planes for all the terrain textures on top of each other (in some order of precedence).

-Since the game view is restricted to 2D orthographic with camera at 90 degree angle to the tilemap the result should look just like the LayerShader linked above, but with support for any number of ground tiles, at the cost of rendering a seperate plane for each one.

What do you guys think? I’m a little new to the whole texture shader business, so I’d like to see if there are other ideas that would blow mine out of the water… Maybe there is a way to support many ground tiles on one plane with use of less texture units?

That’s what I was thinking when I started reading your post, so it gets my vote. :slight_smile: Another possibility is to use splat maps like the terrain in 2.0 does, though I haven’t looked at the shader yet so I don’t know what’s involved in making it work with arbitrary objects.

–Eric