Basic 2D Background Tile Transition

Started by
0 comments, last by freeworld 14 years, 10 months ago
I am making a 2D tile based game using SDL with OpenGL. Lately, I've been working on world generation, filling in the gaps of the design, since things like AI and player choices depend on the world in which he is playing. I finally made my terrain choices; before all I had was grass and water. The transitions were easy, but still took some time graphically in gimp. Now that I've finalized world generation, I have 8 terrain types. I also, would like seamless transition between these types as well. So I found: GD Article on Terrain Transition: "Tile/Map-Based Game Techniques: Handling Terrain Transitions ". Now this technique seems nice and saves some work, but since I'm using OpenGL perhaps there is a newer, better way? [article is from 2000, fwiw.] Is there a better way with OpenGL to accomplish seamless tile transitions on the GPU? I am a neophyte at OpenGL, but when researching this question I've looked into blending and opacity masks.... I am also open to any other efficient suggestions. Please offer some advice/guidance. I would like an efficient, quick, painless solution (if one exists). All I require is some simple guidance or an introduction to the technique a veteran programmer would use. I can research the specifics on my own. Thanks in advance.
Advertisement
Firstly I would use some sort of hierarchy, such as grass will always be on top of grass or rocks or water is on top of dirt.

Then I would use a set of alpha maps that represent transition fom one texture another, and in a shader I'd apply those to the two the textures.

IE. Say a grass texture borders a dirt texture. I'd draw the dirt texture, then I'd draw the grass texture on top of it using the alpha map/texture.
[ dev journal ]
[ current projects' videos ]
[ Zolo Project ]
I'm not mean, I just like to get to the point.

This topic is closed to new replies.

Advertisement