Sunday, August 9, 2015

Sacrificing Optimization for...Something That Works

In the previous post, I mentioned that I finally got the terrain (300K+ points and all) rendered onto the screen. Unfortunately, only a slice of the terrain was rendered, and I was still to put collision on the land. For the slice problem, the example I was following from Microsoft for loading index buffers did not foresee indices that went above the 65536 range, so I fixed the index buffer to allow 32 bit integers.

As for the actual shape, I had a choice between the btBvhTriangleMeshShape and the btHeightfieldTerrainShape. The latter was, according to performance and the name, definitely the one preferred. However! I found out that the heightfield centers based on the bounding box, meaning there was little to no hope of me being able to match the terrain rigidbody with the actual terrain. Bullet has little to no explanation or help on the matter online (as usual), so I'm sticking with the btBvhTriangleMeshShape regardless of the insane amount of performance loss during initialization. At least until something works.

And luckily enough, the terrain works and does not slow down during the actual rendering cycle, along with a great reaction to the fog shown below:


Seems perfect for a bit of snow. I'm thinking a post-processing effect will be ideal for the situation.

No comments:

Post a Comment