🔒 Locked
Texturing
Advertisement
Original Post
You will need to make a new vertex for every vertex with a different texture coordinate. I have the same problem and I can''t figure out a way around it. I could make my terrain engine so much more efficient
. (If only I could make the index buffer apply to only one vertex stream...)
It *is* efficient to duplicate the vertices when you need different texture coordinates. When the UV, color, normal and xyz coordinates are stored together it''s much easier for the GPU than if they were stored in separate locations in VRAM. (Reading sequentially is faster than jumping around)
Using index buffers and texturing are not, by any means, mutually exclusive techniques.
Why do you hold the necessary data duplication issue in such high regard when it comes to difficulty? It is not really that complex, you know
Kind rgds,
-Nik
EDIT: My point being - while index buffers are used to reduce data duplication, one can still duplicate the vertex data if necessary (and in case of different texture coordinates, the vertices actually are different).
[edited by - Nik02 on April 27, 2004 12:18:15 PM]
Why do you hold the necessary data duplication issue in such high regard when it comes to difficulty? It is not really that complex, you know
Kind rgds,
-Nik
EDIT: My point being - while index buffers are used to reduce data duplication, one can still duplicate the vertex data if necessary (and in case of different texture coordinates, the vertices actually are different).
[edited by - Nik02 on April 27, 2004 12:18:15 PM]
I recommend that you study the arts of texturing and using indices separately and thoroughly. One of them does not, in any way, prevent or even make very difficult to use the other.
Try to understand how geometry indexing really works instead of copy-pasting the code from some tutorial; when you do, this will be as clear as morning dew
-Nik
PS. Sorry about the lack of links...
Try to understand how geometry indexing really works instead of copy-pasting the code from some tutorial; when you do, this will be as clear as morning dew
-Nik
PS. Sorry about the lack of links...
I understand what your saying. And i do understand indexing. So basically i have to create a seperate vertex to use for each different texture coordinate right? Since I''m basically rendering a 10x10 array of textured squares I need 4 texture coordiantes for each vertex (except for edges of course). This means i need four different vertices right?
If you need to have discontinuous texture coordinates, then you have to use multiple vertices in the same position. They are not the same vertices, despite the exact same position - the texcoords make them different.
I''m sorry I can''t explain this more intuitively; to me, it just made sense one day in the past.
I could prepare a graphic explanation, if you want, but I''m quite busy with my studio. However, I''m glad to help if I can
Kind rgds,
-Nik
I''m sorry I can''t explain this more intuitively; to me, it just made sense one day in the past.
I could prepare a graphic explanation, if you want, but I''m quite busy with my studio. However, I''m glad to help if I can
Kind rgds,
-Nik
Here's an easy way to explain it.
Say you have one texture and want to stretch it
you do it like this
x----x----x
|......|......|
|......|......|
x----x----x
Each x is one vertex, and has one texture coordinate. Along X this would be (0, 0.5 and 1)
So if you are going to have this kind of model, one texture wrapped over several polygons, you don't duplicate anything.
Now say you you have two textures, you will have to map it like so:
x----xx----x
|......||......|
|......||......|
x----xx----x
(it's so hard to do ascii here)
Thhe middle is actually stuck together, but it illustrates the point.
Indexing is great for terrains, since you are stretching one big texture over a grid of vertices. It's awfulf for cubes, since you have to make a copy of every vertex.
However, most complicated geometry is the former rather than the latter. If you look at quake models for instance, they all use one texture, and each vertex has a unique coordinate. The texture is literelay wrapped on it.
People realize you have to make copies of vertices when indexing a cube, but that is literaly the worst case scneario, usually, there are big gains to be made by indexing, even if you have to make some copies.
[edited by - ataru on April 28, 2004 6:05:33 PM]
[edited by - ataru on April 28, 2004 6:06:07 PM]
Say you have one texture and want to stretch it
you do it like this
x----x----x
|......|......|
|......|......|
x----x----x
Each x is one vertex, and has one texture coordinate. Along X this would be (0, 0.5 and 1)
So if you are going to have this kind of model, one texture wrapped over several polygons, you don't duplicate anything.
Now say you you have two textures, you will have to map it like so:
x----xx----x
|......||......|
|......||......|
x----xx----x
(it's so hard to do ascii here)
Thhe middle is actually stuck together, but it illustrates the point.
Indexing is great for terrains, since you are stretching one big texture over a grid of vertices. It's awfulf for cubes, since you have to make a copy of every vertex.
However, most complicated geometry is the former rather than the latter. If you look at quake models for instance, they all use one texture, and each vertex has a unique coordinate. The texture is literelay wrapped on it.
People realize you have to make copies of vertices when indexing a cube, but that is literaly the worst case scneario, usually, there are big gains to be made by indexing, even if you have to make some copies.
[edited by - ataru on April 28, 2004 6:05:33 PM]
[edited by - ataru on April 28, 2004 6:06:07 PM]
quote:
Original post by Ataru
Indexing is great for terrains, since you are stretching one big texture over a grid of vertices.
Ohhhh, so if I have a 10x10 array of squares for the terrain I set the top left vertex to (0, 0), middle square vertex to like (0.5, 0.5), bottom right vertex (1, 1), etc?
[edited by - Squirell on April 29, 2004 9:40:29 AM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement