Sunday, October 16, 2011

63 – Barrellands

Using the technique I created and used for adding 15000 high poly barrels or 90000 low poly barrels to a scene, I started experimenting to see if I could make this my main method of world creation. I also had an eureka moment and with one single line of code changed I got an extra 50 FPS on the 90000 barrel scene.

So first step was to improve stability of the system and see how many low poly barrels I can fit in one scene:


That's 307800 barrels! I'm sure that I can fit more than 15000 high poly barrels now, but not by a lot. 307800 is the rough equivalent of 15000 when we change detail level. Don't get me wrong, I can actually fit a lot more high poly barrels, but I end up exhausting the resources of the GPU and this causes it to render the shape of the meshes, but with a fully white texture. The places where the GPU drops textures is actually quite indicative of the make up of the scene: I can practically see my algorithm mirrored in that pattern.

So considering this a successful test, I started using this method for terrain. I reimplemented the terrain generator using the new systems and it was quite a hard task. Again, the GPU did not behave in a rational way and my successes were due more to trial and error than applying my knowledge of the GPU and it behaving accordingly. But I managed to create a world renderer capable of rendering and empty landscape with full elevation with over 1000 FPS. Without borders.

Adding borders drops the FPS by 200-300. I tried adding more materials to a scene node to avoid this drop, but in the end it did not work so now I have multiple scene nodes, one for each border type.

Bringing all the techniques together, I created this video where we have adjustable elevation slicing, digging of walls and a nice topping of barrels on top of the elevation:


As a stress test I render all of the barrels ignoring slicing. In the final engine I'll stick to rendering items only on active levels. The performance is still good enough for FRAPS to almost be able to keep up 60 FPS. There are some drops bellow this value, but if you look carefully at the video, you will see that these drops coincide with level change, which is a very CPU intensive operation.

So with digging implemented (change of landscape) and adding meshes (populating with items) the 3D engine is theoretically finished. I need to add meshes to everything and polish, polish, polish! I hope that in the next post we'll see dwarves actually doing the digging.

But not everything is rosy. I still can't turn on the GUI under DirectX because it will lock my FPS to 40. I started investigating this and I can say that neither the calculations the GUI does (which do drop the framerate by a negligible 10 at most) nor image blitting are the cause. The primary suspect is rectangle drawing, but I can't say for sure yet. And LOD switching needs to be reimplemented for the new system.

3 comments:

  1. it's really good to see your thoughts in more detail :)

    I'm glad we're getting close now to a workable system that we just need to populate with artwork and a actions/situations.

    I bet the curve ball i've thrown you regarding rigged and animated models will keep you occupied for a while too though :D

    ReplyDelete
  2. What are your poly/texture requirements for models? Also, do you have a guide for the kind of art style you want to pursue with this game?

    ReplyDelete
  3. To Beautifulgrunge:

    Can't give you and exact number yet and it depends a lot on the complexity of object and frequency of its use. I can say that the number should be low if possible, without compromising too much visual quality, and generally it should be tens or hundreds, not thousands.

    Don't know yet which is the best style to use.

    ReplyDelete