mrgloom wrote:
I think marching cubes extract something like smoothed surface, but I need "corrugated envelope" in other words I want to see "pixelized" surface not smoothed. maybe i can just modify algorithm?
PolyVox includes both a Marching Cubes (smooth) surface extractor and also a 'cubic' surface extractor. The CubicSurfacExtractor behaves as you describe.
mrgloom wrote:
And closer to practice:
1.How to store the voxels? simplest 3-dim array which contatin 0 if no voxel and 1 if have one.(harder other structures like SVO). or 3-dim array of structures which contain not only visibility of voxel but it's color and maybe some other properties. 1 model - 1 3-dim array, further we can put this model in any point of our scene.
PolyVox provides both a simple 3D array (
RawVolume) and also more advanced approaches including compression and paging (
LargeVolume). In theory you can have several volumes in a scene but I've only ever worked with one large volume.
mrgloom wrote:
2.Ok, have aray of models(made of voxels) or 1 big model, then we want to extract surface by apllying something like marching cubes algorithm. how this surface must be described to draw with OpenGl(or something else)? array of triangles which consist of 3 points in 3D?
The mesh data is output as an indexed triangle list. That is, there is a list of vertices and a list of indices. Each set of three indices denotes the vertices of one triangle.
mrgloom wrote:
I must extract all surface and than cut of with something like frustum culling or I can do it somehow beforehand?
You can choose to generate a mesh for only part of the volume. So you can generate several meshes which touch but don't overlap, and then you can use occlusion culling techniques to decide which meshes to draw for a given viewpoint.
mrgloom wrote:
3.Ok, step 3, we have a surface,but how it must be stored and represented and how to draw it?
You can draw it with any API/engine which supports indexed triangle lists. This includes both OpenGL and Direct3D, as well as higher level engines such as Ogre. You could also convert the mesh to a different format if you needed to.
mrgloom wrote:
and about animation if we have animated 3D model can we convert it on the fly to voxel representation at each frame?
or just have prebuild N voxel models and change them at each frame?
I don't have much experience here but I think you'll have difficulty doing the voxelization on the fly. It's not impossible though - NVidia have
an article where they do it for fluid simulation (but on quite a small volume).
mrgloom wrote:
and where I can read how PolyVox and Ogre works(in general not in particular) ?
Have a read of
this article, which was based on PolyVox. For Ogre you need to check out
their webpage.