Sign in to follow this  
signal_

Basic 2D Background Tile Transition

Recommended Posts

signal_    366
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.

Share this post


Link to post
Share on other sites
freeworld    341
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this