Archived

This topic is now archived and is closed to further replies.

Terrain, do it with indexes or not?

This topic is 6186 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I''ve built a heightmap loader and terrain generator using indexes because i figured it would be faster using fewer points, but i''ve realized using a set of indexes messes up proper texturing and normals because you''re reusing a single point several times for different triangles. So is it better to use a regular triangle list with no indexes but more triangles, or is there a decent way of getting around this problem?

Share on other sites
I just started a terrain engine and that''s a really good question. I would like to know the answer also to before I start everything.

[Edited by - kmsixpence on October 17, 2005 6:03:33 PM]

Share on other sites
Hmm..

It sounds like you might be trying to solve the wrong problem. About shared normals...

This is usually the desired behavior, but you should average the normals. For instance, if a particular vertex is used by two triangles, find the 2 surface normals and then average then to get the per vertex normal. This will give you smoother results.

As for texture coordinates... I would think that the colocated vertices would all have the same texture coordinates, at least that''s a good way to ensure that the texture does not have seams at triangle edges. If you are doing something more involved, you may need to keep the vertices separate, but I would guess you could find a way to use indices...

Share on other sites
Ok, maybe i''m understanding texture coordinates wrong, but this is how i''m picturing the points and texturing coordinates in an indexed set of triangles:

Where the points 3 and 4 are shared by the two squares, but the problem is they only have one texture coordinate for the top square, which don''t work for the bottom square.

Share on other sites
Just rotate the texture for the botttom square and everything should be fine... Or am i missing something?

Share on other sites
do you really want to have one texture for one quad?
with a 64*64 terrain you''d have 4096 textures, or do you reuse allways the same texture?

as far as I know, many terrainengine split their terrain in smaller blocks e.g. 16*16 quads and put one texture over the whole part. this way it''s possible to optimise the quad with indices for a vertex-cash, which is importante for a high polycount, ''cause the vertices share the texturecoordinates.

rapso->greets();

Share on other sites
That is how my terrain works. 8x8 "patches" of terrain forming 256 terrain patches. Each patch has one texture. Each vertex in that patch (which has varying numbers of vertices since it is a dynamic level-of-detail algorithm) shares a texture.

Mal.

Share on other sites
A vertex can have upto 8 texture coordinate pairs. Check your directx sdk docs.

Possibility

Share on other sites
There can be up to 8 texture coordinates? Interesting. Thanks for all the suggestions everyone, i''ll try them out.

1. 1
2. 2
3. 3
Rutin
19
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• Forum Statistics

• Total Topics
633658
• Total Posts
3013205
×