1

As I have mentioned in a few previous posts I am creating a minecraft like engine thing.

I have seperated the terrain into regions, and only the regions which are in the camera's viewing frustum are rendered. When the vertex buffers of each region are bulit they check each block if they can be seen, if not the are not added to the buffer, in the case that they are, it checks which sides are not surrounded by other blocks and builds thoose faces. Also I have counter-clockwise culling enabled.

Could anyone suggest any other ways to increase performance (Note: that I haven't added index buffers yet but am only rendering using vertexbuffers)? The previous reason mentioned may be the reason for my low frame rate... And I would also like to know if adding indices to this engine would increase performance.

I also don't think this has anything to do with memory allocation.

EDIT: Ok, I have implymented index buffers, performace has greatly increased but I still think it could be increased even more...

Darestium
  • 643
  • 2
  • 11
  • 29
  • Did you implement some kind of Marching Cubes algorithm instead of pushing all the triangles to the display? – Emond Dec 10 '11 at 06:15
  • Marching Cubes? I just checked the wikipedia article and... I still don't understand what it does ;) – Darestium Dec 10 '11 at 07:27
  • The algorithm turns a voxel world into a polygon-soup, eliminating the internal triangles and only showing those that are on the outside of objects. If you did not implement something similar you might be doing a lot of superfluous calculations. – Emond Dec 10 '11 at 10:52
  • Well, the thing is I have already done something similar to that. When building the vertex buffer it checks which faces are hidden and which blocks are hidden and doesn't add them to the buffer. – Darestium Dec 10 '11 at 21:13
  • The reason I pointed this out was that often the algorithm is the first thing you should have a look at. Measuring might help you to find the bottle neck. Without the code we can't really help. Index buffer can help but there is no guarantee and there might be other 'bad' spots in your program. – Emond Dec 11 '11 at 07:06
  • Would you like the code? ;) and would you know of anyway to not add faces to the buffer when they not in the players view but are still on the "outside" of the chunck? – Darestium Dec 11 '11 at 20:50
  • The way to keep out the faces that are not visible is to test them against the viewing frustum. If your world is completed built out of aligned boxes you could use a kind of ray-tracing that checks the visibility of a box instead of testing all the triangles, that might be quicker. All depends on the way you constructed your code and what you are trying to accomplish. I do not have the time to look at your code. I advise you to go to http://gamedev.net and search the forum for minecraft. It will give you tons of reading materials. – Emond Dec 11 '11 at 21:39
  • Well, I have already implemented something similar, I have (as mentioned above) separated the terrain in 32x32x32 sized regions, and when about to be drawn these regions are checked if they are in the viewing frustum, is that what you mean by the above? – Darestium Dec 12 '11 at 21:48
  • Yes, and more. Read Gamedev.net and search the forum for minecraft or voxel engine. – Emond Dec 13 '11 at 05:20

1 Answers1

2

In times like this, we turn to a Profiler :) I would suggest CLR and SlimTune (Thanks A-Type). Depending on which .NET Framework you're using, you would download the appropriate one. Then you can find out where your bottlenecks are and where you should be focusing your attention instead of stabbing in the dark.

Caleb Jares
  • 6,163
  • 6
  • 56
  • 83