Jump to content

Terrain Height Lookup


photo

Recommended Posts

Hey, there are a few spots in our code where we are doing terrain height lookups.  We do this using intersections Unigine::World::get()->getIntersection( start, end, TERRAIN_MASK, ray ); I don't know exactly how many we are doing per tick but its in the neighborhood of 10.  we did this in 2.4 on object terrain without any noticeable issues.  Now that we are on 2.7 with object terrain globals, this lookup is very expensive.  I was reading another thread which said that the lookups don't function if the terrain isn't visible as well.  What is the correct way to get the terrain height at an x/y point?

Link to comment

Hi @dred,

Terrain Global tiles are rendered around active camera only. If you want to cast an intersection ray in some distant point you need to use this flag.

More info on tiling here: https://developer.unigine.com/en/docs/2.7.3/objects/objects/terrain/terrain_global/#tiling

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

I want to know the terrain hight at a point, I don't care if I do this with a ray or something else. but knowing the terrain height is important for lots of our calculations.  Is using the now incredibly slow ray cast while turning on an even slower flag the best(only) way to do it?

Link to comment

Hi Dred,

ObjectTerrainGlobal is much slower than ObjectTerrain - that's known limitation. This happens due to the complexity of the object. You can slightly speed up the intersection by removing ObjectTerrainGlobal from GeodeticPivot (make it 'flat').

ObjectTerrain intesections are fast due the fact that data is always available in memory and its pretty much simple object.

There is another way to get the heights of ObjectTerrainGlobal: use fetchTopologyData() method. Here is more details about usage: 

Btw, do you have any exact performance numbers? If you can send us results of microprofile_dump_html command during your normal usage of the intersections - it would help a lot to understand where is the bottleneck.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...