For the past couple weeks, I’ve been contributing to a game engine that uses an Octree for spacial representation.
As I really love the concept (it’s blatantly easy to create caves), I’ve been thinking about creating a small level editor that is basically just a view of the engine with some simple level editing controls embedded and an “export to Panda3d” button.
Upon pressing the button, a number of scripts would be run, first exporting the whole landscape to a mesh (.obj file), then converting it to an egg file and running egg-octree on top of that.
Do you guys think this would be viable? Are there any apparent downsides, aside of LOD issues? Is there anything special about Panda3d’s own terrain system that couldn’t possibly be replicated? As trees aren’t part of the terrain system, I guess I could still use instanced tree geometry and tie them to the terrain mesh, right?
(1) Inefficient storage of data, since the XYZ positions of the terrain are all stored in 32-bit floats, whereas with terrain you can get away with just one 16-bit number for height it most cases. Both on disk, in memory, and when sending to the GPU (and in video memory).
(2) Hard to apply effective LOD to limit the amount of terrain being rendered at one time, this would all have to be pregenerated, meaning even more bandwidth and memory is used.
(3) Hard to modify on the fly, if dynamic terrain is desired.
(4) Computing collisions is expensive if you don’t have a height map (though this can be improved partially by effectively quadtreeing, but still not perfect. A hybrid solution - using a terrain mesh, but also storing a calculated height map for collisions is an option.). Especially for placing things on the terrain, whether it be trees or the character, looking up the Z position is as easy as calculating the pixel offset and reading the grayscale value at that pixel.
However. Can’t this be slightly alleviated by reorganizing the mesh back into an octree, using EggOctree?
My main beef with simple, height map based terrains is that one can’t possibly hope to design all of the terrain in it. In our engine, I can first create a terrain from a height map (or any random noise) and then, if I find a spot I’d like to have a cave at, "punch in a few holes.