Hi,
I have figured out how to build vertices from a heightmap. I currently load 33*33 heightmaps in my game. When I move in game, I delete the heightmaps and vertices that are too far away and build new ones at the right location. But when I load these vertices into the GPU memory, the framerate is dropping down to about 30 for a second, then it is 60 until new vertices are loaded and so on...
What my program is doing:
At initialization: Create buffers (with D3D11_USAGE_DEFAULT)
Multithreaded: Create arrays and store them in RAM
in render thread: Load arrays into the buffers (if updated) using the following code:
DeviceContext->UpdateSubresource(m_Buffers->VertexBuffer, 0, 0, m_vertices, 0, 0);
DeviceContext->UpdateSubresource(m_Buffers->IndexBuffer, 0, 0, m_indices, 0, 0); I don't know how to increase the performance, I tried almost everything, but nothing seems to solve this problem...
There are 33*33 vertex arrays, each one for a 64x64 meter chunk, with 4 different quality levels (there are less vertices per chunk in chunks that are far away). At quality 0 there are 256*256 quads (4 vertices, 6 indices) per chunk, at quality level 3 only 32*32. 5*5 chunks have quality level 0, 9*9-5*5 have quality level 1, 13*13-9*9 have quality level 2 and the other chunks have quality level 3. So there are 33+13*2+9*2+5*2 chunks that are updated when I cross the border of a chunk.
Am I doing something basically wrong or should this work with a little bit of optimation?
Greetings,
Magogan
PS: Sorry for my bad english :(