# thelordposeidon

Member

9

0 Neutral

• Rank
Newbie

• Interests
Programming

## Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

1. ## Marching Cubes "Fun"

Unfortunately I can't read c++, I try and fail miserably, but thanks for the code. I'll see if anyone I know can talk me through it.
2. ## Marching Cubes "Fun"

So the only difference between mine and scrawks code seems to be the code below. Scrawk's code : //Get the values in the 8 neighbours which make up a cube for (i = 0; i < 8; i++) { ix = x + VertexOffset[i, 0]; iy = y + VertexOffset[i, 1]; iz = z + VertexOffset[i, 2]; Cube[i] = voxels[ix + iy * width + iz * width * height]; } My code : private static boolean checkIfExpose(Voxel[][][] voxels, int x, int y, int z, float[] cube) { Voxel[] surroundingVoxels = getSurroundingVoxels(voxels, x, y, z); boolean bool = false; for (int i = 0; i < cube.length; i++) { cube[i] = 0; } if (surroundingVoxels[0].getMaterial().equals(VoxelMaterial.Air)) { cube[0] = 1f; cube[1] = 1f; cube[4] = 1f; cube[5] = 1f; bool = true; } if (surroundingVoxels[1].getMaterial().equals(VoxelMaterial.Air)) { cube[0] = 1f; cube[3] = 1f; cube[4] = 1f; cube[7] = 1f; bool = true; } if (surroundingVoxels[2].getMaterial().equals(VoxelMaterial.Air)) { cube[4] = 1f; cube[5] = 1f; cube[6] = 1f; cube[7] = 1f; bool = true; } if (surroundingVoxels[3].getMaterial().equals(VoxelMaterial.Air)) { cube[0] = 1f; cube[1] = 1f; cube[2] = 1f; cube[3] = 1f; bool = true; } if (surroundingVoxels[4].getMaterial().equals(VoxelMaterial.Air)) { cube[1] = 1f; cube[2] = 1f; cube[5] = 1f; cube[6] = 1f; bool = true; } if (surroundingVoxels[5].getMaterial().equals(VoxelMaterial.Air)) { cube[2] = 1f; cube[3] = 1f; cube[6] = 1f; cube[7] = 1f; bool = true; } return bool; } Bare in mind my code is Java and his is C#. If anyone has any ideas, please let me know. Here's a link to the file overall : here Edit : when I print out the value of a single cube to be rendered (a grid of 1 x 1 x 1) the corners all return 1, shouldn't that mean they are to be rendered?
3. ## Marching Cubes "Fun"

Do you know of any off the top of your head that is similar enough that I can compare it easily? Edit : So I found that good old scrawk's code is similar to mine (though in c# and using unity). So the plan is to try and use that as a debug tool as that is definitely confirmed working. See where the difference in logic and code is. If I find anything I'll post it here, if there's nothing feel free to offer suggestions on what's wrong in the code as I've probably not solved it.
4. ## Marching Cubes "Fun"

So i took some more pictures and did some debugging. First and foremost here are some better pictures of the cube at the original size (16 x 16 x 16 in opengl world coords). I uploaded it to imgur here. Next I tried some debuging. No cube shows when I have the grid size as 1 x 1 x 1. When it is 2 x 2 x 2 I get a small triangle (pic here) and finally when I do 4 x 4 x 4 I get this load of weirdness. Obviously my logic has gone wrong but honestly I have no idea where. Any ideas would be amazing.
5. ## Marching Cubes "Fun"

Yeah, I'm pretty sure it's me making a silly mistake or a mistake in logic
6. ## Marching Cubes "Fun"

Here's the pastebin : here, and the pictures will go up later. I added it because I was having some issues I think with direction culling and it seemed to help. This was awhile ago so I can't quite remember what I was doing.
7. ## Marching Cubes "Fun"

Thanks for the advice, I'll get some better quality images tomorrow for you, unfortunately I had to take them under some time pressure but tomorrow I shouldn't have that issue. I'll take a look at the tutorial and thanks for the unit tests, again I'll look at them tomorrow.