Original Post
Hi.
I am trying to use VTF, to create a terrain. I have a heightmap of 1024x1024.
I have sampled this for vertex heights on a grid that is 2048x2048, stretching the heightmap so there are 2 vertices for every pixel. I want to be able to stretch it further. For the vertices that have no pixel, they will interpolate (If I'm not mistaken, HLSL handles that when you sample a texture).
To work out my texture coordinates I am taking the vertex position and dividing by the grid size.
My problem is the 1st 2 rows of vertices along 1 axis are giving me the same heights.
In theory the texture coordinates should be:
for the 1st row 0/2048 = 0.
for the 2nd 1/2048 = 0.00048828125.
I have used PIX to try and debug it but on both rows the coordinates both are calculated as 0.000
It seems to be rounding after 3 decimal places. therefore both rows sample the same pixels and the heights are identical.
Can I use better precision or is there another way to sample using exact coordinates? rather than 0.0-1.0
I'm guessing this would occur elsewhere on the terrain also, but its harder to find. at a glance it looks like its all used correct pixel samples and interpolated the ones that are in between.
Cheers
I am trying to use VTF, to create a terrain. I have a heightmap of 1024x1024.
I have sampled this for vertex heights on a grid that is 2048x2048, stretching the heightmap so there are 2 vertices for every pixel. I want to be able to stretch it further. For the vertices that have no pixel, they will interpolate (If I'm not mistaken, HLSL handles that when you sample a texture).
To work out my texture coordinates I am taking the vertex position and dividing by the grid size.
My problem is the 1st 2 rows of vertices along 1 axis are giving me the same heights.
In theory the texture coordinates should be:
for the 1st row 0/2048 = 0.
for the 2nd 1/2048 = 0.00048828125.
I have used PIX to try and debug it but on both rows the coordinates both are calculated as 0.000
It seems to be rounding after 3 decimal places. therefore both rows sample the same pixels and the heights are identical.
Can I use better precision or is there another way to sample using exact coordinates? rather than 0.0-1.0
I'm guessing this would occur elsewhere on the terrain also, but its harder to find. at a glance it looks like its all used correct pixel samples and interpolated the ones that are in between.
Cheers