• Advertisement

Archived

This topic is now archived and is closed to further replies.

Simple Heightmap and Vertex (Array) questions

This topic is 5024 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve begun work on a simple heightmap terrain engine using fixed size, tileable patches. I plan to use vertex arrays to store the vertices for each patch and then index them each frame using some LOD technique based on projected screen space. Anyways, because the patches are fixed in size, I would think the UV coordinates would be the same for all patches, assuming a single texture was stretched fully across each patch. This would also be the case for the X-Z coordinate data the vertices in each patch (assuming Y is up). Reusing the texture coordinates would be easy via glTexturePointer but is there someway to re-use X-Z data and just vary Y data with glVertexPointer? Somehow specify X-Z coordinates independantly of Y coordinates? Also, how important is aligning coordinate data to 32-bits? I want to save on memory using the above technique but also by only using 16-bit shorts to represent vertex coordinates. Is this a waste of time? Already the size for vertexes in the terrain patches is approaching 28-32 bytes and seems a bit much.

Share this post


Link to post
Share on other sites
Advertisement
profile, profile, profile.


Reusing the texture coordinates would be easy via glTexturePointer but is there someway to re-use X-Z data and just vary Y data with glVertexPointer? Somehow specify X-Z coordinates independantly of Y coordinates?


this would only be worth doing if you were bandwidth limited.

Share this post


Link to post
Share on other sites
Telling me to profile is not an answer to my question of whether or not coordinate data can be specified independantly of one another for vertex arrays.

And I plan on paging many of these tiles in and out at runtime, so yes, bandwidth limitations are a concern.

Share this post


Link to post
Share on other sites
From my experience (including what I have read in these forums on my many searches) it is not possible to independently specify x,y, and z co-ordinates. I also sincerely doubt that it is possible to only use 16 bits, since OGL coords are always specified as floats.

Vertex arrays are designed to be fast and efficient and (relatively) easy to use. As soon as you can start specifying separate x,y and z data sources it becomes harder to use, and possibly less efficient. Of course some of us wouldn;t mind it being a bit harder if it is more efficient, but it''s not up to us at the moment!

I know what you mean though, in a heightmap-based terrain engine it seems pointless to waste all that bandwidth (and memory) specifying (in your case) x-z co-ordinates when they lie in a grid and can therefore be calculated easily. Unfortunately that is the way it has to be when using vertex buffers (or indeed Vertex Buffer Objects...)

Hope that helps, sorry it''s bad news!

Share this post


Link to post
Share on other sites
I''m also working on heightmaps rendering. Currently I''m getting about 2Mtris/sec with vertex arrays (non compiled) and 65x65 patches on GF FX 5200 (both with or without textures) . I''m using triangle lists with 3 floats for position and 2 floats for texture (no normals). 3D mark reports a transform rate of about 20Mtris/sec with a single light. What would be the best way to maximize the vertex throughput (assume that its not cpu or fillrate bound)? VBOs? If so, are there any optimal sizes for it?

What about triangle strips? Do they offer any significant speedups in general?


Regarding reusing the X-Z data, it might be possible with the texturing support in the vertex shader. Take a single flat patch and displace it each time with the relevant heightmap.

Thanks!

Share this post


Link to post
Share on other sites

  • Advertisement