SinisterMJ
SinisterMJ

Reputation: 3509

Height Map of accoustic data

I have the following problem (no code yet):

We have a data set of 4000 x 256 with a 16 bit resolution, and I need to code a program to display this data. I wanted to use DirectX or OpenGL to do so, but I don't know what the proper approach is.

Do I create a buffer with 4000 x 256 triangles with the resolution being the y axis, or would I go ahead and create a single quad and then manipulate the data by using tesselation?

When would I use a big vertex buffer over tesselation and vice versa?

Upvotes: 1

Views: 105

Answers (1)

user1097185
user1097185

Reputation: 1058

It really depends on a lot of factors. You want to render a map of about 1million pixels\vertices. Depending on your hardware this could be doable with the most straight forward technique.

Out of my head I can think of 3 techniques:

1) Create a grid of 4000x256 vertices and set their height according to the height map image of your data. You set the data once upon creation. The shaders will just draw the static buffer and a apply a single transform matrix(world\view\projection) to all the vertices.

2) Create a grid of 4000x256 vertices with height 0 and translate each vertex's height inside the vertex shader by the sampled height map data.

3) The same as 2) only you add a tessellation phase.

The advantage of doing tessellation is that you can use a smaller vertex buffer AND you can dynamically tessellate in run time. This mean you can make part of your grid more tessellated and part of it less tessellated. For instance maybe you want to tessellate more only where the user is viewing the grid.

btw, you can't tesselate one quad into a million quads, there is a limit how much a single quad can tessellate. But you can tessellate it quite a lot, in any case you will gain several factors of reduced grid size.

If you never used DirectX or OpenGL I would go with 1. See if it's fast enough and only if it's not fast enough go with 2 and last go to 3.

The fact that you know the theory behind 3D graphics rendering doesn't mean it will be easy for you to learn DirectX or OpenGL. They are difficult to understand and learn because they are quite complex as an API.

If you want you can take a look at some tessellation stuff I did using DirectX11:

http://pompidev.net/2012/09/25/tessellation-simplified/

http://pompidev.net/2012/09/29/tessellation-update/

Upvotes: 2

Related Questions