Author Topic: Are HYP_Mesh methods correct for scaled hightmap terrains?  (Read 6624 times)

0 Members and 1 Guest are viewing this topic.

ekalap

  • Associate
  • Posts: 3
Are HYP_Mesh methods correct for scaled hightmap terrains?
« on: October 31, 2008, 04:01:52 PM »
Hi all,
I am having problems with getting the correct y-height value of a hightmap terrain's vertix belonging to a certain face (of which I 've got the index).
I believe that the problem might be that my heightmap mesh has been scaled (vertical_scale="150.0", patch_size="1200.0") and that the HYP_Mesh.GetVertexPosition method does not return the right height for the scaled mesh but for the original un-scaled one.

I may be wrong of course! Here is what I am trying to do:
Code: [Select]

faces_number = HYP_Mesh.GetNumFaces( "islands_terrain" ) - 1

while ( clusters<tree_clusters ) do
cluster_face = math.random( 0, faces_number ); -- find a random face of the terrain
a_cluster, b_cluster, c_cluster = HYP_Mesh.GetFaceIndexes( "islands_terrain", cluster_face ); -- return the 3 vertices of that face
cluster_x, cluster_y, cluster_z = HYP_Mesh.GetVertexPosition( "islands_terrain", a_cluster ); -- return the x,y,z position of the first vertix
if ( cluster_y > 0 ) then -- if the cluster_y is above water level (There is a water level at y=0)
blah, blah, blah...

Any ideas?
« Last Edit: October 31, 2008, 04:03:54 PM by ekalap »

SPRINGER

  • Thug
  • *
  • Posts: 44
Re: Are HYP_Mesh methods correct for scaled hightmap terrains?
« Reply #1 on: October 31, 2008, 04:39:58 PM »
I experienced some heightmap issues too
when the distance to the camera grows the interpolation of the scale factor
causes the heightmap position relative to fixed meshes to drift slightly.
eg : a heightmap modeled lake basin doesn't keep its correct position relative to the water level (a plane mesh)