Hello,
I am currently trying to get my textures in my heightmapped terrain to blend together. What I do is create a vertex array for different "height groups" if you will, then render them individually with the interpolate texture combining method. I use the alpha value of the second texture unit's texture environment to interpolate between the first and second texture unit's texture color. However, the problem I am having is in order for this to work, not only will I need, say, a dirt vertex array and a grass vertex array(upper and lower height groups) but I will also need three or so "in between" height groups, and consequently vertex arrays, so that the texture doesn't simply jump from dirt to grass because the way I am running it now is that I set the texture environment alpha for the second texture unit(which has the grass texture bound to it) to completely transparent, then I render the dirt vertex array(so only the first texture unit's texture really gets rendered because of the second texture units transparency, and the first texture unit has the dirt texture bound to it), then I set the second texture unit's texture environment alpha to just slightly transparent then render the grass vertex array, but you can still see a defined border between the lower and uppper vertex arrays, so the blended effect just ins't really working. I know that I could be on the right track here, because the texture combiners are perfect for this sort of work, especially with the interpolate method. However, what am I missing here, am I going about this completely the wrong way? Thank you in advance.
Help With Blended Terrain
Started by isolier, Sep 24 2005 07:59 AM
5 replies to this topic
#1
Posted 24 September 2005 - 07:59 AM
#2
Posted 24 September 2005 - 10:16 AM
You use the same vertex array, you just index it differently. that's the beauty of vertex arrays, otherwise you'd just use display lists.
Jesse Coyle
#3
Posted 24 September 2005 - 05:58 PM
Ok, so I would use sort of an interleaved approach or what do you mean? Also, how does this help with blending the textures together?
#4
Posted 25 September 2005 - 02:42 AM
ok, lets say you are using an extremely simple approach and your entire mesh is just 3 vertecies
A--B--C
Lets say A is low down and C is a mountain peak, and you have two textures that you want to blend along the way. You have one vertex array that holds all 3, then when you render the low texture you tell it to render indecies 0-1, and when you render the high one you tell it to render with verticies 1-2, Since B is the vertex at index 1 it ends up getting used twice, but you see how it isn't actually stored twice in the list?
A--B--C
Lets say A is low down and C is a mountain peak, and you have two textures that you want to blend along the way. You have one vertex array that holds all 3, then when you render the low texture you tell it to render indecies 0-1, and when you render the high one you tell it to render with verticies 1-2, Since B is the vertex at index 1 it ends up getting used twice, but you see how it isn't actually stored twice in the list?
Jesse Coyle
#5
Posted 25 September 2005 - 07:20 PM
Ok, that makes sense. But, again, how do I go about blending the textures together with this method? If I render vertices 0-1 with the low texture and the vertices 1-2 with the high texture, there is going to be a huge difference in the two textures even if I render a base texture over vertices 0-2 first and then interpolate, via OGL's texture combining method, between this base texture and the low texture for the low land and interpolate between the base texture and then high texture for the high land...
#6
Posted 26 September 2005 - 12:17 AM
Doh, bad example for two resolutions Let me give a more reasonable example
In this example you see tex1 on the line A-B, then Tex1Tex2 blend with mostly Tex1 on the line B-C, then the blend continues but this time mostly Tex2 on C-D Then totally Tex2 on line D-E, then it goes through the same process to blend to Tex3.
In this example you see tex1 on the line A-B, then Tex1Tex2 blend with mostly Tex1 on the line B-C, then the blend continues but this time mostly Tex2 on C-D Then totally Tex2 on line D-E, then it goes through the same process to blend to Tex3.
A-B-C-D-E-F-G-H Tex 1 Alpha 1.0 1.0 0.5 0.0 Vertex A B C D Tex 2 Alpha 0.0 0.5 1.0 1.0 0.5 0.0 Vertex B C D E F G Tex 3 Alpha 0.0 0.5 1.0 1.0 Vertex E F G H
Jesse Coyle
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











