Sign in to follow this  
Tjaalie

Terrain help

Recommended Posts

Dear Thread reader, I'm working on a simple multiplayer game wich will be using the terrain engine wich I'm writing right now. The problem is that my litle brother needs to be able to play the game and his computer doesn't do shaders a old geforce 4 mx. I own the book Real Time 3D Terrain Engines but it uses shaders for the texturing. So I tough about a other way to do the texturing and came up with the following idea. I color the terrain vertices acording to the ground type (white = snow, brown = dirt) and then I create a few detail maps for each type and put them in one texture, then I change the texture cordinates per vertex so they use the right detail map. The only problem I came across is that I can't use index buffers becouse every triangle needs different texture coordinates for the detail map, so I wanted to ask. Is it possible to create a different tex coord for every entry in the index buffer, and is it even possible what I'm thinking. Tjaalie, I didn't start programming yet becouse I wanted to know if I was going to slove this issue becouse it would be another unfinshed project of mine.

Share this post


Link to post
Share on other sites
I assume that when you say indexed you mean you are using triangle strips? If this is so, you should use triangleslists instead. This way each triangle will have its own vertices and its own texture coordinates. I have found that the difference in speed between the two is not much.

Share this post


Link to post
Share on other sites
No I mean index buffers, this way I create a grid of vertices:


* * * *
* * * *
* * * *



Then I use index buffers to create triangles:


*-*-*
|/|/|
*-*-*



As you can see the second vertex is used twice, so if the first one is a snow thing and the second one is rock then there will be a problem when the texture the detail texture is like this.


*-------*-------*-------*
| | | |
| | | |
| Snow | Dirt | Rock |
| | | |
*-------*-------*-------*



They only way to solve this problem I can think of is to only use vertex buffers and use DrawPrimitive but this will take a greater amount of vram and doesn't allow me to create different index buffers for different distances.

Tjaalie

Share this post


Link to post
Share on other sites
tjaalie, I was sitting with a similar problem and an array of completely seperate triangles was the only way around it. Like that you can apply any portion of the texture image (sand, rock, ect.) to any triangle.

Obviously this is more expensive, but what else!?

Share this post


Link to post
Share on other sites
There must be an other way. How did old games do this? I mean it was possible to do this without shaders and slower cards. Is it possible to use a detail texture and vertex color togetter?

Share this post


Link to post
Share on other sites
I doubt it, perhaps you can use two textures on one vertex, with alpha channels you can fade them into each other, to create a smooth transition, but again this is using seperate triangles. I think i saw age of empires 2 do this.

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