A strange error / something with my blocky engine?

So, I found the Cubes framework by Destroyflyer. It seemed to suit my needs, but as I went into it, I realized that I wanted something slightly different. Also, I was interested in how blocky world cube things worked. So I dug in and built up my own version of the framework. It actually works fairly well - I removed the absolute need for textures, instead using vertex coloration and mesh transparency to make it work how I want. And it’s actually mostly spot on, except for a strange issue.

For some reason, the mesh being built (when placing / removing blocks) loses what I believe to be the “north” and “south” faces (Positive and negative Z respectively / switched if I forget how the scenegraph works). And the strange thing is that the code is mostly the same exact thing as the Cubes framework, which works just fine with all 6 faces of the blocks. Also strangely is that this phenomenon only seems to occur when I try to place a block alongside the north or south faces when they DO exist (which confuses me even more, as they exist sometimes, but not others???) It seems to be that, when the face is inside of two blocks, it renders. But it also removes faces from the voxel behind it???

To be more clear about what I’m talking about, here’s a youtube video:

I like to think I point out the problem rather well. Not sure though.

So, as I have been going through the entire system multiple times and found nothing, I’m turning to my fellow (probably more senior) monkey brethren. I invite you all to take a look at the project on my Github:


I believe the classes to be looked at in particular are MeshBuilder, MeshMerger, or TransparencyMerger. Maaaaaaaybe Chunk, though I’m doubtful. In fact, I don’t really understand the error, if it’s even an error and not silliness on my part.

If anyone could help me out on my voyage, feel free to do so! I’d greatly appreciate it. Also, if I need to include any more information besides the above, let me know - I’m not the greatest at wording my questions, I don’t think. Also, sorry if I wasn’t supposed to make this as a support topic.

I didn’t look at the code (kinda long to dive into an entire project) but it looks like the winding of the faces is wrong somehow and some faces are just backwards. You can try to turn off the face culling so each face font and back side will be rendered (material.getAdditionnalRenderState().setFaceCullMode(FaceCullMode.Off)).
If all faces are rendered with this, then it’s that the mesh builder builds some faces backward. It won’t fix your issue but it’ll help diagnose it.
Then you’ll have to dig into your mesh build class.

Actually… a section of the video shows the face being written to the wrong side of the cube (i.e. south instead of north or vice-versa. Either that, or you are keeping faces you don’t need. So I think you have the issue @nehon said + an indexing issue for certain faces.

Somewhere around 26 seconds show it.

Aha. It turns out, I forgot how the scenegraph DOES work (go figure) in that I forgot which Z was which. The builder was thinking that the correct face was the opposite direction.

But you guys did help clue me in quite a bit, so thank you!