ThomasS wrote:
You are right, in my version for every voxel the density and the texture number are stored separately. Only storing the material volume and then averaging the voxels sounds interesting, but this will only allow for smooth geometry - I'd prefer a mixture between smooth parts and parts with hard edges for things like buildings or hallways, which are possible with my approach by using values like 1 for ground and -128 for air so that the surface is very close to one voxel.
True, but you could always check the value of the material and use that to decide whether or not to average it with its neighbours. So it you got a terrain voxel you would average it, if it is a brick voxel you wouldn't. In fact, I should have thought about that for my castle - maybe I'll go back and add it. I can imagine there could be discontinuities where smoothed voxels meet non-smoothed ones though.
ThomasS wrote:
Merging back to using your version of PolyVox would be tempting because of all the cool features you're implementing, but having a separate version has also some benefits:
- as said above, the way I store the voxel data works really well for me (but it looks like I could use two volumes for the data and write a custom surface extractor to do that in PolyVox, is this correct?)
Yes, you could just have two volumes and have your own marching cubes implementation. However, rather storing two seperate volumes, you could take advantage of the fact that the BlockVolume class is templatized on the VoxelType. So you could just create a custom struct containing your material, density, and whatever other parameters you want and use it directly with the existing BlockVolume. Of course, you would still need your custom marching cubes implementation. This probably wouldn't get added to PolyVox, but you can just add it at the 'application' level.
So what would be the advantage of just having one volume? Firstly it's probably more elegant. Secondly, your material and density for any given voxel will sit next to each other in memory, whereas they are currently being pulled from very different areas of memory. So it would be better for the cache.
A disadvantage could be that volume compression could be a bit more tricky. This isn't really implemented yet, but I'm just thinking to the future

ThomasS wrote:
- I can implement new features quickly. For example, currently I'm working on paging, so that the volume acts as a window into a larger world which moves with the player. If that would have to be implemented in PolyVox, it would have to be as flexible as possible, while my implementation just has to be good enough for my game

But using PolyVox would be good because ...
- you are working on it and improving it

- it would help PolyVox because it's used in a real application
I'm currently not sure if I should merge back to use it.
I would say that for the time being you shouldn't merge back. What you have works for you and you probably want to concentrate on the game. However, you might want to consider merging in the future (maybe in a few months) and try not to duplicate features. I will try to give you some idea where I'm heading in the next few months:
- I'm cleaning up interfaces and ensuring a clean split between the PolyVox library, the Thermite game engine, and the game. I guess this will be important for you.
- I'm experimenting with porting to Qt. This will reduce the number of dependencies and the complexity of the build process. More importantly, it will provide a flexible GUI which can be customised by style sheets.
- I will be writing an in-game editor, hopefully built on the new Qt framework.
- I will be polishing the shadowing support and large volume support. Both of these are currently in the prototype stage.
ThomasS wrote:
But for example the paging feature is a must-have for my game.
Ok, this had occurred to me but I wasn't prioritising it. As mentioned above I will be working on large volume support, and paging could be an extension of that.
Currently my volumes are 256x256x256 - I assume yours are the same? Actually I was impressed by how big your volumes seemed as I believe you could already have a death-match style game in there. I hope to push the volume size up to 1024x1024x1024 but of course there are no guarantees yet

ThomasS wrote:
The texture atlas works for me now almost without artefacts (at least in OpenGL, in DirectX there are still strong seams visible) due to the way it is generated. Every texture in the atlas is only 480x480 in size and centered in a 512x512 area. The unused border is filled with texels colored like the border texels of the 480x480 image (like in the clamp texture address mode). Only if you look closely you can still see small seams in the texturing. At least with my graphics card - did you notice any seams?
I did notice seams, but I was probably looking more carefully than your average gamer

ThomasS wrote:
The bigger problem with the texturing is the blending between the textures. One triangle can have up to 3 different textures, so I now have 9 texture accesses in my shader without any normal map or something similar! And if you use multiple alpha blended triangles to simulate texture blending, there has to be a pass with a ground color first because the result is always translucent. Or is there a better way?
Argh, the texturing has been a pain in the ****. I will give you a little history:
- Initially I was creating a separate mesh for each material in each block. I also had to deal with the edges between adjacent materials. I *think* that I was creating three meshes for each edge (one for each of the materials which could belong there) and then doing some blending magic. This all worked but I wanted to lower the batch count.
- I then moved to the texture atlas approach. Then, for each block, I would have two meshes. The first mesh contained all the triangles which used exactly one material (and so didn't requre any blending). The second mesh contained the triangles along the material boundaries, and I think it actually contained each triangle three times. These two meshes were referred to as something like 'SinglePatchRenderable' and 'MultiPatchRenderable'.
- Finally, I have ditched texture atlases and now pass the textures in different texture units. I now use exactly one mesh per block which handles both single and multi material triangles. PolyVox generates a slightly simpler structure, and the details of the rendering are now the concern of Thermite. It is possible that Thermite receives a triangle from PolyVox which contains three different materials - in this case Thermite discards the triangle and replaces it with three separate triangles.
There will doubtless be more changes. Firstly I want texture arrays. Secondly, I can see that I some cases I really do want a separate mesh for a material - for example if that material is semi-transparent (you could have ice in your game). Transparent meshes need to be rendered separately.
ThomasS wrote:
Anyway, thanks for your support and work on PolyVox and Thermite

No problem, I'm really glad someone is using it. Back to one of your original points, would you mind if I added a 'Projects using Thermite/PolyVox' page and included your screenshots in there? It would then be clear what was yours and what was mine. Also, when do you intend to start promoting your work more publicly (Ogre Forums, GameDev, etc)?