Thanks for the in-depth explanation. I think I might understand what the problem is. Because of the objects not aligning correctly with each other the vertex normals cause the light to look strange.
After testing your code and understanding the problem I tweaked my code a little bit.
The dimensions I defined for a dungeon block were, width = 1.5 and height = 1. Changed them to w = 6 and h = 4.
I noticed that you translate your primitive to the desired location whereas I create the sides of the cube at the desired position. Does this make a difference?
Changing these values didn't solve the problem.
This is my code for creating my cubes. So as you can see I already used single panes.
private Object3D createWalkableTile(int x, int y) {
SimpleVector upperLeftFront = new SimpleVector(x * TILE_WIDTH, 0, -y * TILE_WIDTH);
SimpleVector upperRightFront = new SimpleVector((x * TILE_WIDTH) + TILE_WIDTH, 0, -y * TILE_WIDTH);
SimpleVector lowerLeftFront = new SimpleVector(x * TILE_WIDTH, TILE_HEIGHT, -y * TILE_WIDTH);
SimpleVector lowerRightFront = new SimpleVector((x * TILE_WIDTH) + TILE_WIDTH, TILE_HEIGHT, -y * TILE_WIDTH);
SimpleVector upperLeftBack = new SimpleVector(x * TILE_WIDTH, 0, -(y * TILE_WIDTH) + TILE_WIDTH);
SimpleVector upperRightBack = new SimpleVector((x * TILE_WIDTH) + TILE_WIDTH, 0, -(y * TILE_WIDTH) + TILE_WIDTH);
SimpleVector lowerLeftBack = new SimpleVector(x * TILE_WIDTH, TILE_HEIGHT, -(y * TILE_WIDTH) + TILE_WIDTH);
SimpleVector lowerRightBack = new SimpleVector((x * TILE_WIDTH) + TILE_WIDTH, TILE_HEIGHT, -(y * TILE_WIDTH) + TILE_WIDTH);
Object3D tile = new Object3D(4);
tile.addTriangle(lowerLeftBack, 0, 0, lowerRightBack, 1, 0, lowerLeftFront, 0, 1, textureManager.getTextureID(DUNGEON_FLOOR));
tile.addTriangle(lowerRightBack, 1, 0, lowerRightFront, 1, 1, lowerLeftFront, 0, 1, textureManager.getTextureID(DUNGEON_FLOOR));
tile.addTriangle(upperLeftBack, 1, 0, upperLeftFront, 1, 1, upperRightBack, 0, 0, textureManager.getTextureID(DUNGEON_CEILING));
tile.addTriangle(upperRightBack, 0, 0, upperLeftFront, 1, 1, upperRightFront, 0, 1, textureManager.getTextureID(DUNGEON_CEILING));
tile.invert();
// tile.compile();
// tile.strip();
tile.build();
return tile;
}
private Object3D createWall(int x, int y) {
SimpleVector upperLeftFront = new SimpleVector(x * TILE_WIDTH, 0, -y * TILE_WIDTH);
SimpleVector upperRightFront = new SimpleVector((x * TILE_WIDTH) + TILE_WIDTH, 0, -y * TILE_WIDTH);
SimpleVector lowerLeftFront = new SimpleVector(x * TILE_WIDTH, TILE_HEIGHT, -y * TILE_WIDTH);
SimpleVector lowerRightFront = new SimpleVector((x * TILE_WIDTH) + TILE_WIDTH, TILE_HEIGHT, -y * TILE_WIDTH);
SimpleVector upperLeftBack = new SimpleVector(x * TILE_WIDTH, 0, -(y * TILE_WIDTH) + TILE_WIDTH);
SimpleVector upperRightBack = new SimpleVector((x * TILE_WIDTH) + TILE_WIDTH, 0, -(y * TILE_WIDTH) + TILE_WIDTH);
SimpleVector lowerLeftBack = new SimpleVector(x * TILE_WIDTH, TILE_HEIGHT, -(y * TILE_WIDTH) + TILE_WIDTH);
SimpleVector lowerRightBack = new SimpleVector((x * TILE_WIDTH) + TILE_WIDTH, TILE_HEIGHT, -(y * TILE_WIDTH) + TILE_WIDTH);
Object3D tile = new Object3D(8);
// Left
tile.addTriangle(upperLeftFront, 0, 0, upperLeftBack, TILE_WIDTH, 0, lowerLeftFront, 0, TILE_HEIGHT, textureManager.getTextureID(DUNGEON_WALL_1));
tile.addTriangle(upperLeftBack, TILE_WIDTH, 0, lowerLeftBack, TILE_WIDTH, TILE_HEIGHT, lowerLeftFront, 0, TILE_HEIGHT, textureManager.getTextureID(DUNGEON_WALL_1));
// Right
tile.addTriangle(upperRightFront, TILE_WIDTH, 0, lowerRightFront, TILE_WIDTH, TILE_HEIGHT, upperRightBack, 0, 0, textureManager.getTextureID(DUNGEON_WALL_1));
tile.addTriangle(upperRightBack, 0, 0, lowerRightFront, TILE_WIDTH, TILE_HEIGHT, lowerRightBack, 0, TILE_HEIGHT, textureManager.getTextureID(DUNGEON_WALL_1));
// Front
tile.addTriangle(upperLeftFront, TILE_WIDTH, 0, lowerLeftFront, TILE_WIDTH, TILE_HEIGHT, upperRightFront, 0, 0, textureManager.getTextureID(DUNGEON_WALL_1));
tile.addTriangle(upperRightFront, 0, 0, lowerLeftFront, TILE_WIDTH, TILE_HEIGHT, lowerRightFront, 0, TILE_HEIGHT, textureManager.getTextureID(DUNGEON_WALL_1));
// Back
tile.addTriangle(upperLeftBack, 0, 0, upperRightBack, TILE_WIDTH, 0, lowerLeftBack, 0, TILE_HEIGHT, textureManager.getTextureID(DUNGEON_WALL_1));
tile.addTriangle(upperRightBack, TILE_WIDTH, 0, lowerRightBack, TILE_WIDTH, TILE_HEIGHT, lowerLeftBack, 0, TILE_HEIGHT, textureManager.getTextureID(DUNGEON_WALL_1));
// tile.compile();
// tile.strip();
tile.build();
return tile;
}
I debugged the code for the generation and I didn't noticed any slight offset in the vectors during generation, I only saw whole numbers.
So I would say the edges of the cube match exactly.
As I'm blindly generating cube aside cube do the overlapping sides may cause problems? I suppose then I'll have to rethink the whole wall generation process of the dungeon...