I need to show rectangular heightmaps in TerrainQuad for a scenario viewer I’m working on.
How can I remove the unused triangles and still benefit similar performance to a square heightmap with the same area.
I want to utilize all the functions in TerrainQuad, e.i.: LOD, heightpolling, normalpolling… Will these functions need to be modified?
I want others to benefit from a solution since it will probably time consuming. Are there things I should be specifically aware of when it comes to integrating the solution?
You can’t, it’s not easy with the LOD and doesn’t play nice with quad trees.
Removing some triangles from it won’t benefit performance much at all. LOD is much more successful at that.
Make a terrain grid instead and just load in tiles to make it a rectangle with length twice the width. TerrainGridTileLoaderTest loads in some saved tiles and not others. You can use it as an example for a rectangular terrain.
If you are worried about performance, always profile your app before you optimize it. Shaving off some triangles from the edge will do little for performance when lowering the LOD will do so much more. You can also make your terrain patches larger if the number of objects going to the video card is a problem. Video cards can handle lots of triangles easily.
I have a defined envelope of terrain to show based on the position of objects in the scenario viewer.
I think I will just increase the envelope in the shortest direction until it matches the longest, since from what you’re saying there are better ways to optimize.
Do you have any tips on how I can orthographically project an aerial photo in the same projection as the terrain onto the terrain?
Any tips/guides on how best to profile a jme based app?
Treat the terrain as a 2d surface like a piece of paper or your computer monitor. And then draw the aerial photos directly onto it (set the scale of the texture layer to 1 and set full alpha in the alpha map for that layer). Some of the terrain will have the projected image and some won’t. There will be areas without the texture, but you can always not paint any texture (alpha=0) there and thus the terrain will not appear in those areas. Same goes for heightmaps and in particular DEMs (digital elevation models): sample from the heightmap every 1 unit and build up a heightfield (for terrain), with points that were not over the DEM being a default value of zero.
Terrain cannot support reprojection as it is right now, the performance hit for everything from collision/physics to dynamic height modification would be too great. So it has to be used as a 2.5d canvas.