#### Archived

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

# problem with setting vertices blend weight

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

## Recommended Posts

well, my terrain is coming out good, i know the triangles can blend together but i can''t make the vertices set that to happen. the way its set up, it generates sets of three vertices in a triangle, and what i need to happen is to set all the other vertices on that same spot-of different triangles, to the same blend weights. this sounds trivial, but i cannot do it. i''m going to try a brute force find all vertices on the same point method, but does anyone have any other ideas?

##### Share on other sites
ok, i just tried the brute force method, this is OBVIOUSLY not the way to go as it was taking about 20 minutes before i endtasked it. i can''t believe something this simple is getting me down after setting up something as complicated as directx. how in the hell do i set all the vertices on that point to the same blend weight?

##### Share on other sites
Umm, this can be tricky, can you tell us details how you store your terrain? Do you mean you''re trying to find all the triangles that share a vertex and set that vertex to a certain value?
Without seeing how you''re managing things it''s difficult to comment or advise. Why not consider generating all the vertices, and building the triangles around them so the vertices are automatically shared instead of trying to match up the triangles?

John 3:16

##### Share on other sites
there is a load routine to fill terrain_HeightMap[x][y] with random values for now, soon to be a file loader.

{
ty = ty + terrain_Tex;
if(ty > 1)
{
ty = 0;
}
tx = 0;
tx = tx + terrain_Tex;
if(tx > 1)
{
tx = 0;
} //if the texel coords go past 1, start repeating
//upper right triangle
terrain[vert].z = float(h1);
terrain[vert].nx = 0.0f;
terrain[vert].ny = 1.0f;
terrain[vert].nz = 0.0f;
terrain[vert].tu1 = float(tx);
terrain[vert].tv1 = float(ty);
terrain[vert].tu2 = float(tx);
terrain[vert].tv2 = float(ty);
terrain[vert].tu3 = float(tx);
terrain[vert].tv3 = float(ty);

here is setting everything for a terrain vertex, there are 5 more but i didn''t include them because they are more or less the same, just a few +1''s here and there. i took out the blend weight setter, becuase it was doing no good, but i can''t set the triangles to share a common vertice, because some things about the vertice need to be different. like the texture coordinates, the way i set it up (i did not know that you could wrap textures, i thought the texture coords couldn''t go past 0 or 1). there are a few other things where the vertice share an xyz but not something else. i need to set the terrain[vert].specular = D3DCOLOR and set that for ALL the vertices on that particular x,y. i think i might ahve to create some kind of buffer to remember which ones it needs to set, but this is way beyond what i expected.

##### Share on other sites
also, a is there a way to ''unallocate'' arrays? there is a VERY large one that after the terrain is loaded, does absolutley nothing...

##### Share on other sites
int *p;

p=new int[10000000];

delete [] p;

int **d;
d=new int *[height]
for i = 0 to height
d=new int[width;

for i=0 to height
delete [] d[i];

delete [] d;

John 3:16

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 14
• 14
• ### Forum Statistics

• Total Topics
633385
• Total Posts
3011600
• ### Who's Online (See full list)

There are no registered users currently online

×