First, sorry about the title and the rest of the confusing stuff in the question - you are correct I meant the marching cubes extractor, and I am using a fairly recent version of the develop branch
It seems to be a problem with paging boundaries - I modified my code to extract one large mesh and I still see miscalculated data (my additional voxel data) on 16-voxel boundaries (that is the size of my volume pages.)
In addition, by default all my voxel densities are 'max', and the whole solid volume uses the same material. As I mentioned though, if I vary the material with the occlusion data, my occlusion data suddenly becomes correctly calculated on boundaries
My voxel data looks like:
Code:
struct Voxel
{
uint8_t material_;
uint8_t occlusion_;
public:
typedef uint8_t MaterialType;
typedef uint8_t DensityType;
typedef uint8_t OcclusionType;
Voxel() : material_(0), occlusion_(0) {}
Voxel(uint8_t material, uint8_t occlusion) : material_(material), occlusion_(occlusion) { }
operator uint8_t() const { return material_; } // to make the cubic extractor happy
DensityType getDensity() const { return material_ == 0 ? 0 : std::numeric_limits<DensityType>::max(); }
MaterialType getMaterial() const { return material_; }
OcclusionType getOcclusion() const { return occlusion_; }
};
And this is my controller:
Code:
class MarchingCubesController
{
public:
typedef gl::vox::Voxel::MaterialType MaterialType;
typedef gl::vox::Voxel::DensityType DensityType;
typedef gl::vox::Voxel::OcclusionType OcclusionType;
DensityType convertToDensity(gl::vox::Voxel voxel) { return voxel.getDensity(); }
MaterialType convertToMaterial(gl::vox::Voxel voxel) { return voxel.getMaterial(); }
gl::vox::Voxel blendMaterials(gl::vox::Voxel a, gl::vox::Voxel b, float weight)
{
auto material = a.getDensity() != b.getDensity()
? (a.getDensity() > b.getDensity() ? a.getMaterial() : b.getMaterial())
: std::max(a.getMaterial(), b.getMaterial());
auto occlusion = std::max(a.getOcclusion(), b.getOcclusion());
return { material, occlusion };
}
DensityType getThreshold() { return 127; }
};
Im not sure how helpful a screenshot will be but Ive attached one that shows occlusion data at the y=15 -> y=16 threshold
Thankyou again for your help