Terrain geometry - ObjectTerrainGlobal


Recommended Posts

Hello, 

I just want to ask if anyone knows a straightforward approach how to get to the terrain geometry of LOD0 in ObjectTerrainGlobal.

Thanks for any help.

 Michal R.

Link to post

Hi michal,

fetching complete terrain data for ObjectTerrainGlobal is not very easy because of internal layouf for this object. I would suggest you can have a look at this discussion:

You can use fetchTopologyData() as a first entry point but you can't be sure that you will receive the height for LOD 0. Maybe you will have better luck by using the texture data from the input and calculate the mesh by yourself.

  • Like 1
Link to post

In attachment you can find code that can generate mesh for the OjbectTerrainGlobal (for old API from 2.9 SDK). But triangles of the terrain and generated mesh would not match since there is no way to get the original triangles position and orientation from the GPU (due to the tessellation).

Attached code exposes create_mesh_terrain console command that you need to execute in the loaded world with terrain. This is very naive approach (it doesn't handle too dense heights and terrains that can be larger than 16x16km). It works for the cases when terrain is less than 10x10 km. In order to maintain meshes precision you will need to split the terrain in to the grid and export multiple files.

Thanks!

 

 

AppSystemLogic.cpp

  • Like 1

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

Link to post
  • 2 weeks later...

Hello guys,

I am checking the approach sent by silent for I am interesting about the geometry. I have a grid prepared that we can understand as a set of corner points that define "squares" (viewing to XY plane). Now, I am going to divide a "square" into 2 triangles. I am going to cut it diagonally and I have 2 possibilities: from Lower-Left corner to Upper-Right corner (LL-UR) or from Lower-Right corner to Upper-Left corner (LR-UL). When 4 "square" points are not coplanar (and mostly they are not) there can be quite a big difference in "triangulated" geometry

When I watched a sample project named 'tank' (API version 2.7.1), I could see that some tiles have its squares divided like LL-UR and some uses LR-UL direction. In silent's code, only one direction division is used (it looks to me that LL-UR direction is used). Can I get somewhere an information which direction is used for the specific tile or I can rely on an information that only one direction is used for all tiles?

 

Thank you.

Branislav

 

P.S. michal is my much more experienced colleague and he started this thread on my request

Link to post