Terrain Mesh Performance

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
crancran
Greenskin
Posts: 138
Joined: Wed May 05, 2010 3:36 pm
x 6

Terrain Mesh Performance

Post by crancran »

Like most large expansive worlds, I've broken my game's terrain into equally divided tiles. But one thing I have come to realize is that each tile uses the same x/y coordinates for each vertex, its just that for each tile those coordinates are offset by the grid position of that tile.

That said, I have been wondering whether it would be faster to construct a single VBO with the common x,z vertex pattern and pass to the vertex shader a few parameters such as the tile's x/z offset and a heightmap texture that I would sample to get the height. The idea is to try and minimize the video memory used for terrain, saving it for models and other objects in a large scene.

Any thoughts or ideas? Would that be feasible or would just passing the Vector3 to the shader with the full X/Y/Z already resolved the best way?
User avatar
SolarPortal
OGRE Contributor
OGRE Contributor
Posts: 203
Joined: Sat Jul 16, 2011 8:29 pm
Location: UK
x 51
Contact:

Re: Terrain Mesh Performance

Post by SolarPortal »

Yes, this is very much feasible in my eyes. It's a form of instancing where you have 1 tile that is reused over and over and all the manipulation is done in the vertex shader.

I used this technique for instanced grass to some good results. Basically I make either 1 or a few different tiles of grass and reuse them in the pages. This saves a lot of memory as each tile can be instanced and uploaded in a single draw call.

In the vertex shader, I then adjust the heights, shadows and remove the vertices using a depth map, and everything else required to make then render correctly.

This method leads to extremely fast grass patches that you can zoom across an entire area without any pops or stutters. It does have the downside of having a slight repeated look but rotations and different tiles could work.

I know you asked about terrain but I have only used the technique for grass.

Ogre 2.x terra system runs on GPU, is fast and uses little memory, perhaps have a look at that. I don't use terra though and instead have our own terrain system based on CPU which does use a lot of memory for larger worlds with higher resolution but it much easier for manipulating height data and painting.

Hope this helps :)
Lead developer of the Skyline Game Engine: https://aurasoft-skyline.co.uk
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Terrain Mesh Performance

Post by paroj »

crancran wrote: Tue Jul 02, 2019 4:08 am That said, I have been wondering whether it would be faster to construct a single VBO with the common x,z vertex pattern and pass to the vertex shader a few parameters such as the tile's x/z offset and a heightmap texture that I would sample to get the height.
actually this is pretty much what Ogre1 Terrain does, if you enable "Vertex Compression"
Post Reply