Neomex wrote:
Firstly, how did you intend on storing data in voxels?
The volume classes are templatized so you can use your own classes/structures as voxel types. At least, this is if you are working with C++. If you are using the bindings then you have to use one of the predefined voxel types (or modify the bindings to define your own).
Neomex wrote:
What I wanted to do, is simply set voxel value to greater than zero and use it as ID for voxel type.
It would work with cubic worlds, but I have found that in order for marching cubes extractor to see voxel as full, value needs to be set as greater than half of size of selected datatype.
Indeed, the marching cubes algorithm works on continuous density fields, not simply 'on' or 'off'. So the density field controls the shape of the mesh. You can also choose to store a separate material identifier with each voxel if you wish.
Neomex wrote:
Why is it so? I suppose I could still use greater than half values as ID's, but then I think low pass filter would overwrite these values as I am guessing it is using them as a way of storing density/its data (?)
Indeed, you should probably keep your density and material identifier separate within the voxel. See the MaterialDensityPair class as an example.
Neomex wrote:
And how does it look with non-numeric datatypes? If I use my own class as template parameter for volume, how will surface extractor know wheres the half?
Have a look at the DefaultMarchingCubesController class. I think the comments should help but ask if it's still not clear.
Neomex wrote:
Other thing, how would you go about texturing such terrain? I've implemented simple triplanar mapping shader, but am not sure how to go about actually using voxel data to texture it.
There's some useful information in the manual about this, though there's no single solution. It's a good starting point though:
http://www.volumesoffun.com/polyvox/doc ... pping.html