My problem is actually described completely with the following picture:
[img]http://imagr.eu/up/5...1200d9b8163.jpg[img]
As you can see the border of all the chunks (each of them is one draw-call) is visible. As i have observed its repeating a tiny part from below on top and from right on the left which means the texture begins to repeat somehow.
Of course for me it seems to be a problem with the texture coordinates as the sampler sets AddressU and AddressV to Wrap which means the texture gets repeated beyond 1 and below 0 and thats exactly whats happening. So i checked my function that generates the texture coordinates which looks like that:
[source lang="csharp"]
private static void LoadTexCoords()
{
uint counter = 0;
float tx, ty;
// 17 rows of vertices
for (int j = 0; j < 17; ++j)
{
// All even rows have 9 vertices, the odd ones only 8 and are shifted half the unitsize into the middle
for (int i = 0; i < (((j % 2) != 0) ? 8 : 9); ++i)
{
tx = (float)i;
ty = (float)j * 0.5f;
if ((j % 2) != 0)
tx += 0.5f;
TexCoords[counter, 0] = tx;
TexCoords[counter++, 1] = ty;
}
}
}
[/source]
Just a quick explanation:
Im repeating the texture 8 times on the chunk. The vertices are aligned the following way:
x x x x x x x x x
x x x x x x x x
x x x x x x x x x
x x x x x x x x
x x x x x x x x x
x x x x x x x x
...
After all i couldnt find an error with the coordinates or why they would repeat once more at the end. All the last vertices have either u or v set to 8.
In my shader i have the following:
[source lang="cpp"]
sampler BlendSampler1 = sampler_state
{
texture = <blendTexture1>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};
[/source]
Does anyone have a clue where the error could come from or if my calculations are wrong for the texture coordinates?
Greetings and thanks in advance
Plerion