Sign in to follow this  
MARS_999

VTF to do terrain rendering

Recommended Posts

Anyone here used VTF to do terrain rendering vs. old school methods? Would there be any speed increases from using VTF? Other than the mesh being dynamic easier I would guess with VTF, is there any other reason to use it for terrain. I know water is a good choice. Also what about taking a mesh of say 17x17 or 33x33 and load that up as VBO and use the texture array extension to load up each 33x33 chunk of the terrain as a layer for the whole terrain? Then you would only have a VBO of 33x33 vertices and a small IBO for that mesh, and reuse it over and over again to render whatever size terrain you want?

Share this post


Link to post
Share on other sites
The reason that I use VTF is that I can have only one vertex and index buffer and tile them. It saves on memory. Basically what you were saying in your second paragraph.

However, I tried small sizes like 17x17 and 33x33 and had hard times rendering a large mesh(4k x 4k). By making the size larger, such as 129x129, there was a large speed increase (2.5x if I remember correctly). The bottleneck seemed to be coming from the many draw calls that were needed. Remember, vbo's are optimized for rendering large numbers of triangles, nor repeatedly rendering small numbers.

Also, you can implement LOD easily by simply having more than one index buffer (one for each level). If you want to keep things simple, keep track of the adjacent patches and using the vertex shader move some of the vertices on the finer patches to make sure there are no cracks. This keeps you from making many index buffers for each level.

Hope this answers you questions.

Share this post


Link to post
Share on other sites
Hello, SO would you say the VTF method for terrain rendering is faster than using a VBO that holds say a 512x512 mesh and smaller? ANd larger meshes the VBO was faster?


Thanks

Share this post


Link to post
Share on other sites
No, I use vertex texture fetch along with a single VBO to render my terrain. The combination of the two saves memory and seems to render faster (because I can make use of really efficient LOD).

I don't really know if there is a big speedup with VTF but the fact that everything is handled in my vertex shader greatly increases the amount of flexibility i have. I don't have to ever write my vertex buffer again, so it is really efficient. VBO's that are static are heavily optimised, while dynamic VBO's are slower, if I remember correctly. So I guess you would get a speed boost from that if you were changing your mesh many times.

Oh, and I just thought of this, you could theoretically use a single terrain object to render hundreds of terrains. You just pass a texture to the render function. The vertex shader will take care of the rest for you. So even more memory efficient :)

Share this post


Link to post
Share on other sites
On the other hand you limit yourself to heightmap terrain without overhangs or caves. Did benchmark the costs of a vertex texture fetch? I guess it should be equally fast as TFs in the fragment shader due to the unified architecture

Share this post


Link to post
Share on other sites
Well in terms of overhangs or caves, what I do is replace the patch that has that feature by a 3d model. The adjacent patches automatically adapt to the LOD of the center model (it took a while to figure out how).

As far as I know, there are no terrain methods (besides voxel terrain) that allow caves.

Also, the vtf is really fast on most recent graphics cards, and even if I do lose a few fps (i haven't benchmarked, so i don't really know), the trade off in ease of use is more than worth it.

Share this post


Link to post
Share on other sites
Perhaps, but I thought that the number of triangles that could be outputted were limited because gs are slow in comparison to the other shaders. Thus making the maximum size of the caves small. Please correct me if i'm wrong.

Share this post


Link to post
Share on other sites
Hi,
I'm not sure : by VTF, you mean vertex texture format ? If so, I'm using it with geometry clipmaps. And yes, it speeds things up in the case of geometry clipmaps.

But you don't have "VTF" terrains. You can have <insert_terrain_algorithm_name_here> using vertex textures. The advantage of using vertex textures is that you can reuse the same static mesh over the whole terrain, simply changing the texture. But if you start to add LODs you'll have to take care of gaps between LODs, and you will need to update the vertex / index buffer (except if you can come up with a full vertex buffer based solution) and there's no point in using vertex texture.

Quote:

Also what about taking a mesh of say 17x17 or 33x33 and load that up as VBO and use the texture array extension to load up each 33x33 chunk of the terrain as a layer for the whole terrain? Then you would only have a VBO of 33x33 vertices and a small IBO for that mesh, and reuse it over and over again to render whatever size terrain you want?


This is the idea of the use of vertex texture. But if you do that without having a LOD scheme, you will probably be fillrate limited, and in this case, there's no point in using vertex textures. Except maybe simplicity of implementation.

Share this post


Link to post
Share on other sites
Quote:
Original post by paic
by VTF, you mean vertex texture format ?


VTF or Vertex Texture Fetching. VTF is fast on all DX10 cards, slower on DX9 cards but has acceptable performance.

[Edited by - filousnt on July 31, 2008 5:10:20 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by paic
Hi,
I'm not sure : by VTF, you mean vertex texture format ? If so, I'm using it with geometry clipmaps. And yes, it speeds things up in the case of geometry clipmaps.

But you don't have "VTF" terrains. You can have <insert_terrain_algorithm_name_here> using vertex textures. The advantage of using vertex textures is that you can reuse the same static mesh over the whole terrain, simply changing the texture. But if you start to add LODs you'll have to take care of gaps between LODs, and you will need to update the vertex / index buffer (except if you can come up with a full vertex buffer based solution) and there's no point in using vertex texture.

Quote:

Also what about taking a mesh of say 17x17 or 33x33 and load that up as VBO and use the texture array extension to load up each 33x33 chunk of the terrain as a layer for the whole terrain? Then you would only have a VBO of 33x33 vertices and a small IBO for that mesh, and reuse it over and over again to render whatever size terrain you want?


This is the idea of the use of vertex texture. But if you do that without having a LOD scheme, you will probably be fillrate limited, and in this case, there's no point in using vertex textures. Except maybe simplicity of implementation.


Actually with a GS you could be able to fill in those gaps correct.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this