> > what is the algorithm for deciding the facing of a voxel under a slope?
> > the things we know are:
> > 1) the facing of voxels that are on the outside.
> > 2) the diagonals that the 'outside' is accessible on.
> > This is going to be a complicated switch statement, I can feel it.
> I wonder if you couldn't take a different approach :
> If you take a voxel and surround it with neighbouring voxels, you get a 3x3x3 grid, with the targeted voxel being in the middle.
> Assuming you give that voxel a temporary coordinate system,
> you can that look up if there is a voxel above, at 45° or next to it.
> when in the Y plane it'd look like this :
> [-1,0,1] [0,0,1] [1,0,1]
> [-1,0,0] [0,0,0] [1,0,0]
> [-1,0,-1] [0,0,-1] [1,0,-1]
> if you store every voxel in an array, it would be fairly easy for a gifted programmer like you, to look up if there exist a voxel above/next/under/etc of this voxel.
> In un-optimized form, this would mean you'll have to perform 26 checks per normal identification.
> A 45° slope could be identified by looking for a voxel that has either [nx-1,ny,nz-1] or [nx+1,ny,nz+1.
> Having a [nx,ny,nz-1] voxel below it would be an absolute requirement to identify this voxel as part of a 45° angled upwards slope.
> pffff.. so far for a non-technical topic.. :)
This would increase the number of "facing combinations" from 2^6 (we look from top, bottom, left/right, etc, etc) to a total of 2^26 combinations. That's a 67MB file just to store the auto-normals.
Isn't the 3x3x3 grid a bit too much? You could leave out the 'edges' making the following 3 slices:
xxxxxxx [0,0,1] xxxxxx
[-1,0,0] [0,0,0] [1,0,0]
xxxxxxx [0,0,-1] xxxxx
[-1,0,1] [0,0,1] [1,0,1]
[-1,0,0] [0,0,0] [1,0,0]
[-1,0,-1] [0,0,-1] [1,0,-1]
xxxxxxx [0,0,1] xxxxxx
[-1,0,0] [0,0,0] [1,0,0]
xxxxxxx [0,0,-1] xxxxx
I hope you get the idea. That makes only 18 possibilites, which is still 2^18=262 KB and a lot of possible facings. Then there's nowhere to start with handcorrecting the database... Not even to speak about adding support for special things like 1-layer thick wings!