Drawing 2D terrain

Started by
2 comments, last by matthughson 18 years, 10 months ago
I'm trying to think of a good way to draw 2D terrains using DirectX. The game is from a side perspective, and the ground has to be defined by some continuous f(x) for collision detection purposes. My ideas so far: -Just use regular polygons. Advantage is that it's simple, but disadvantage is that the curve won't be smooth on the surface and I don't think I can blend multiple textures as I'd like to. -Use a shader to generate 128x128 textures and put them on adjacent quads. I could get it smooth this way, but I'd have to frequently destroy and re-render textures since the entire game world couldn't fit in all at once (not sure how fast it could go), and it would limit who can play the game (it would need PS 1.4, some people don't have any shader support). Can anyone think of a better way to do this / does anyone have the experience to know if the pixel shaders approach would be fast enough? Thanks, Max
--------------Trans2D - 2D library for C# / Managed DirectX
Advertisement
I'm not positive, cause I'm not exactly sure what you want this to look like, but I think straight polygons is the way to go.

You're right that you need alot of polygons for it to look smooth but you can actually trim that down alot. This is because the eye doesn't really pick up on the low-polyness of an object, except around the edges.

So, since your game is 2.5D, I'm assuming the camera is always looking at the terrain from relativly the same angle, you can make the edges nice and high poly/smooth, but on the parts that face directly at the camera, you can drop the poly count by a huge amount with very little difference visually. And if you average the normals of the verts, you probably won't notice it at all!

Let me know if that makes sense; if not I'll try to explain again.

Matt Hughson
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]
Not totally sure what you mean. The verts have no normals...the game is completely 2D, everything is on a plane, and the camera always views it from the same angle.

I've been fooling around with the texture shader method, still not sure I'm going to use it, but I realized that for people with low end video cards I can still procedurally generate textures in software (just not very fast).

[Edited by - _Flecko on June 11, 2005 1:24:43 PM]
--------------Trans2D - 2D library for C# / Managed DirectX
Quote:Original post by _Flecko
Not totally sure what you mean. The verts have no normals...the game is completely 2D, everything is on a plane, and the camera always views it from the same angle.


Ahh sorry dude. Not sure why, but I thought you were making a 2.5D game (Super Smash Bros. etc).

Best of luck,
Matt Hughson
__________________________________[ Website ] [ Résumé ] [ [email=contact[at]matthughson[dot]com]Contact[/email] ][ Have I been Helpful? Hook me up! ]

This topic is closed to new replies.

Advertisement