Sign in to follow this  
Waaayoff

Chunked LOD vertex data?

Recommended Posts

If i use a single mesh to represent all chunks, how do i pass the height data to the shader? Do i create a float array parameter, update it with heights for every chunk and send it to the shader?

Wouldn't using different meshes and switching vertex buffers be faster?

Share this post


Link to post
Share on other sites
I don't know if it's relevant but i'm implementing the [url="http://www.terrain.dk/terrain.pdf"]Rendering Very Large, Very Detailed Terrains[/url] version.

Share this post


Link to post
Share on other sites
Ok how about this, I can use a single vertex and index buffer if i use VTF. The vertex buffer would only contain x and y coordinates. For every chunk i set two uniform parameters, translation and scaling of chunk. I would then calculate the texture coordinates by applying the translation and scaling the {x,y} vector. The texture coordinates can then be used to sample the heightmap! (Also sample diffuse textures)

Three questions:
1) Would that work?

2) The size of my world is approx 250Km squared. A PNG texture of size 16384 x 16384 is 16.7 MB. Would uploading and sampling this in a vertex shader be a problem? What's a better format to use?

3) How can i edit my terrain if i use VTF? Is it possible to edit such large textures in realtime? Edited by Waaayoff

Share this post


Link to post
Share on other sites
[quote name='mark ds' timestamp='1341000643' post='4954067']
Just so you're aware, a 16384x16384 heightmap is going to be a heck of a lot bigger then 16.7mb.
[/quote]

But, i already have one that's 16.7MB...

Share this post


Link to post
Share on other sites
That is highly compressed, which won't be suitable for a gpu: 16384*16384*1 = 268,435,456 bytes, or 256mb. For a 16bit heightmap that's 512mb.

However, that isn't really a problem as long as you use a suitable LOD - i.e. only use the high res data close to the player, and a low res heightmap further away. This basically what I'm doing.

As to your question about editing, don't forget you only need the small subset you're working on in memory at any one time. You can just stream data from the HDD when needed.



EDIT - when I say 512mb isn't suitable for the gpu, it may actually be OK, it just depends on what lower limits you want to set in terms of target hardware. I'm actually in a very similar situation, but I haven't yet made a choice - but i'm kinda thinking that nowadays (on a PC) 1gb vram is pretty much entry level... Edited by mark ds

Share this post


Link to post
Share on other sites
Pfft i hate terrains. So basically i have 2 choices:

1) Store a huge chunked quad tree in memory, load different chunks when i need them and use a couple dozen vertex buffers.

2) Store a huge heightmap in memory, load all of it to the gpu (because honestly i can't see how i can divide it...) and use one vertex buffer.

Share this post


Link to post
Share on other sites
I suggest another two choices[list=1]
[*]Actually look at something modern such as geometrical clipmaps. Becouse seriously, you're looking at something targeting Geforce4? No way. Vertex textures are pretty much the best thing since sliced bread for those kind of applications.

[quote]This page describes our midway project (spring semester 2003) at the Technical University of Denmark, supervised by Niels Jørgen Christensen.[/quote]I do not know those guys. Perhaps I'm just ignorant but why their mid-semester project would have to add something better than industry standard worth reading 100 pages? I apologize for not reading them. It just does not seem worth it.
[*]Actually review all your code and figure out the number of vertex buffers is really minor detail (albeit I admit using static resources instead of dynamic has some charm).
[/list]

Share this post


Link to post
Share on other sites
The reason i don't want to use gpu geometrical clipmaps is because i don't think it's possible to use texture splatting with more than 4 textures. With Chunked LODs, the quadtree pretty much makes texturing a breeze.

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