Jump to content

big terrain(step 10, height 1000) got bumped when reload


photo

Recommended Posts

the terrain has been smoothed in the editor and looks ok, but got bumped when save and reload from the disk.

 

I think it's happened due to the precision problem, the terrain height infomation is stored in disk with unsigned short.

post-213-0-82866300-1310982400_thumb.png

Link to comment

the terrain has been smoothed in the editor and looks ok, but got bumped when save and reload from the disk.

 

I think it's happened due to the precision problem, the terrain height infomation is stored in disk with unsigned short.

Hi!

Could You please send us a minimal scene for reproduction?

Link to comment

Hi!

Could You please send us a minimal scene for reproduction?

 

sorry, it's hard to make a minimal scene because of much material, texture is used, but it should be easy reproducible, just create a big terrain(say step 10, max height 10000) and paint terrain in height mode, then smooth the terrain, when you save and reload, you will notify the terrain not smooth as you seen in editor previous.

 

void TerrainSurface::save() {

assert(heights != NULL && "TerrainSurface::save(): heights is NULL");

// compress heights
float height = 32767.0f / terrain->getHeight();
Vector<unsigned short> surface_heights(TERRAIN_SURFACE_SIZE * TERRAIN_SURFACE_SIZE);
for(int i = 0; i < TERRAIN_SURFACE_SIZE * TERRAIN_SURFACE_SIZE; i++) {
	surface_heights[i] = clamp(Math::ftoi(heights[i] * height),0,32767); //this may lead to problem if height is small, diffrent heights[i] will got the same surface_heights[i]
}
...
}

Link to comment

It is not quite clear what the height is in the end, 1000 or 10,000?

 

In any case, you need to decrease the Height parameter value. It should be set as low as possible. Each terrain vertex stores its height with a 15-bit precision, that is, there are 32768 height levels available to describe elevation changes in range from 0 to the maximum height in units.

 

For example, if you set Height to 1000 (let's say 1 unit = 1 meter), you can create 3 cm height change. That should be enough for making terrain fine and smooth.

But if you set Height to 10,000, the minimum height change increases up to 30 cm! No wonder the terrain would look edgy.

Link to comment

It is not quite clear what the height is in the end, 1000 or 10,000?

 

In any case, you need to decrease the Height parameter value. It should be set as low as possible. Each terrain vertex stores its height with a 15-bit precision, that is, there are 32768 height levels available to describe elevation changes in range from 0 to the maximum height in units.

 

For example, if you set Height to 1000 (let's say 1 unit = 1 meter), you can create 3 cm height change. That should be enough for making terrain fine and smooth.

But if you set Height to 10,000, the minimum height change increases up to 30 cm! No wonder the terrain would look edgy.

 

yes, our artist set the height to 10000, that's the problem, could be better mentioned this limit in document.

Link to comment
×
×
  • Create New...