ker wrote:
David Williams wrote:
I can imagine we would want some kind of VoxelType::hasSurface(Material1, Material2) function, which uses the materials to determine whether a surface exists between them.
I would prefer this to the other proposed methods for then it's not limited to "solid -> opaque -> air" but could create many other combinations, too.
and also...
DefiniteIntegral wrote:
As to not restrict to specific categories like "solid", "water" etc, the material register could simply map a material to a layer number. Then layer interactions could be defined - eg Layer 0->1 renders a face, and Layer 1->0 does not. The extractor can call a function in register to inquire what faces to be generated from material A to B, and register can return something like NONE, FRONT ONLY, BACK ONLY, or FRONT AND BACK
Yep, your both talking about the same kind of system here which is also what I was describing. It seems flexible, however I think it is also going to move quite some logic into the Voxel class rather than the surface extractor. Maybe this makes it more complex to write new Voxel classes. Or maybe it's not so bad, I'm just thinking aloud really.
The other aspect is that there's more to PolyVox than the surface extractors - for example how should the raycasting respond to transparent voxels? Or the ambient occlusion generator? Simply flagging voxels as solid or transparent might be more useful here.
And maybe it's possible to get the best of both... it just requires some thought
DefiniteIntegral wrote:
It seems like storing render/pass, solid/non-solid, transparent/opaque settings per-voxel would use up heaps of extra memory. And since each material is likely to always have the same settings, it might make sense to just have a material register where material settings are defined. Then the extractor can refer to this when comparing neighbor materials for determining how many faces need to be generated.
PolyVox wouldn't dictate what data should be stored per voxel - just what data a voxel should be able to provide. For example, a voxel already has both getMaterial() and getDensity() methods, but if only a material is being stored (e.g. Material8) then the density is simply computed based on the material (material 0 has a low density, any other material has a high density). So I agree with you, and the 'material register'would be an implementation detail of the voxel type.