Skip to main content
GameDev.net gamedev.net
🔒 Locked

terrain engine texturing prob

Started by CProgrammer Jan 2, 2004 at 2:27 AM 6 replies 1.1k views
Original Post
CProgrammer
CProgrammer
Well in my terrain engine I only save each vertex in the vertexbuffer once. The problem is that if I want to texture a single tile in the terrain seperately that wont work, cause the texture coords are only fit for the whole terrain. What can I do? Must I add more vertices, but that would mean a lot more 6 per tile. -CProgrammer
Fidelio66
Fidelio66
Just create an additional quad and draw that. You can use a z that''s 0.01 higher or a z-bias to ensure it''s seen.
Check out tutorials for decals, because basically that''s what this is.
Raloth
Raloth
Can you afford giving each vertex another texture coordinate?
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
CProgrammer
CProgrammer
Raloth: No I suppose I cant.
Fidelio66: Yeah I guess I''ll have to do that.
Thanks guys
-CProgrammer
CProgrammer
CProgrammer
quote:
Original post by Raloth
Can you afford giving each vertex another texture coordinate?


Actually what exactly are you getting at. Do I need a new VERTEX or just a new pair of texture coords in my custom vertex? How would I do that then?
-CProgrammer
yckx
yckx
Keep your texture info in the triangles, or tiles, instead of in the vertices. I keep a list of vertices and a list of triangles for my meshes. The triangles are set up like this:


struct
{
int vertex_index[3];
float u[3];
float v[3];
int material_id;
};


The vertex_index holds the index to the triangle''s certices in the vertex array. The vertices themselves hold no texture info.

Well, actually, I store material_id per mesh, not per tri, but you get the idea. My models can have more than one mesh.

yckx
CProgrammer
CProgrammer
yckx: Wow, thats good. But how does one implement it technically, with coordinates in VERTEX its SetTexture and set the appropriate VERTEX_FLAG. What DirectX calls do you use?
-CProgrammer
yckx
yckx
Um, I don''t I use OpenGL. I haven''t tried to learn DirectX yet, so I can''t really help you with DX implimentation. Hopefully, someone else will speak up and guide you. Also, I should mention that the idea of storing tex info in the tri instead of the vert isn''t mine. I changed my code after I saw the ms3d file format specs.

yckx

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.