Tiled Height Field question?

I am writing a terrain editor, the terrain is editable by squares.
ie 100 x 100 = 10000 editable terrain squares, in one square you could place a grass tile, in another water etc…

my problem is the number of polygons 20,000 if I use quads.

I was hoping to use tessalation to remove unneeded triangles by joing squares that have the same elevation.

BUT then I will loose my tile coordinates for the squares, so I will not be able to have 100 tiles by 100.

example normal
(a letter = tile)

ABCDE
FGHIJ
KLMNO

But if I use tesselation
ABBCC
DEFCC
GHIJK

I will have to texture B and C as one quad
wont I?

as certain tiles will have been eaten up into a larger one, Is there a way round this?

Ironduke

>I was hoping to use tessalation to remove >unneeded triangles by joing squares that >have the same elevation.
>BUT then I will loose my tile coordinates >for the squares, so I will not be able to >have 100 tiles by 100.
> <cut>
>I will have to texture B and C as one quad
>wont I?

Could you not detect the fact that you’ve merged two quads together, and then modify texture coordinates appropriately?

eg. normal quad has texture coordinates 0,0) (1,0) (1,1) and (0,1);

merge two together:
(0,0) (2,0) (2,1) and (0,1);

That would draw the texture twice, side by side, as if there were two separate quads.

You’d need to set texture properties to GL_REPEAT rather than clamp.

Hope that helps,

Steve

Thanx.

There is still a problem what if the larger squares requires more then 1 tiles as it is taking up four cells.

I suppose I create a texture by fusing the two tiles together and then applying it right?