In PolyVox we seperate the storage of the volume data from the way surface extraction is perfomed. That is, the volume may or may not consist of a set of blocks, and even if it does then the size of these blocks may or may not be the same as the size of the extracted meshes. For example you might decide that 32x32x32 is the ideal size for storing blocks in memory, but 64x64x64 is better for the rendered meshes. Or maybe that you want the rendered blocks to be 16x16x128 but you don't want the memory to be broken into blocks at all (perhaps you'd rather use an octree?).
So basically we focus on just providing fast volume data structures which are independant of the algorithm which is executed on them. Surface extraction is just one task you need to perform, and raycasting (for example) can have a different set of characteristics.
That doesn't exactly answer your question... but maybe it's something to think about.
Yep, you can do it :-) However, be aware that I have heard that there can be problems perhaps on the edges of polygons. Maybe the ddx/ddy is not well defined here... I forget. I've never seen an issue in practice though.
I would also be interested in knowing about any lightweight open-source graphics engines. I'm not so interested in full game engines as there are lots of those, and I'd rather handle integration myself. Some ones that I've found include:
Does any body know of any complete scenes which are available for use by the research community? As shown above there are various resources for individual models but a complete scene is more than that. Perhaps a complete level from a real game, but in an easily accessible format? Ideally this would include material, lights, etc.
I guess the modding community has produced plenty of free maps for various games so maybe it's possible to get those in a useful format?
For the benefit of anyone else who comes across this thread it's worth pointing out that I have run into some difficulties with the above approach. My real world example is obviously more complex that what I showed above, but I have applied the same principles and got it to compile successfully on both GCC and VS2010. However, I have since discovered that it causes problems with VS2008.
In particular, with VS2008 is causes an internal compiler error but only if compiling with the /Gm (Enable Minimal Rebuild) compiler option. Without this option it appears to work fine, but as VS2008 projects have this on by default it can be a problem.
I think for now I'll stick with preprocessor defines to use the right line for each platform, but I may revisit this in the future.
I know there are some template wizards around here so hopefully someone can help :-) I have a simple code example which I can't get to compile on both VS2010 and GCC. I can make simple changes to allow it to compile on either platform, but I haven't found the one correct solution which works on both. See the two commented lines in the code below:
template <typename Type>
template <typename NestedType>
template <typename Type>
class Derived : public Base<Type>
class Nested : public Base<Type>::Nested< int > //This line works on VS2010
class Nested : public Base<Type>::template Nested< int > //This line works on GCC
int main(int argc, char** argv)
In both cases, the line which works on one platform does not work on the other. If I get it the wrong way round the VS2010 error is:
error C2955: 'Base<Type>::Nested' : use of class template requires template argument list
And the GCC error is:
main.cpp:17: error: non-template ‘Nested’ used as template
main.cpp:17: note: use ‘Base<Type>::template Nested’ to indicate that it is a template
I've often thought that Falcon look interesting, but haven't tried it myself yet. From their webpage:
Falcon is an Open Source, simple, fast and powerful programming language, easy to learn and to feel comfortable with, and a scripting engine ready to empower mission-critical multithreaded applications.
Falcon provides six integrated programming paradigms: procedural, object oriented, prototype oriented, functional, tabular and message oriented. And you don't have to master all of them; you just need to pick the ingredients you prefer, and let the code to follow your inspiration.
Personally I'd just take the approach of having a single LOD level for the whole world, because I'me pretty sure it would be hard to get the meshes to join up in a nice way. Of course, you want to make sure that your single mesh has as few triangles as possible, so don't just render it as a bunch of cubes. Personally I extract a surface from the voxels and then use a vertex collapse algorithm.