First of all I want to say some words about myself and why I’m here. I’m working for some years with java and would say I’m an experienced Java programmer by now, sure there is always room for improvement just recently I started to look into 3d programming with a small hobby project,.The goal is to create a world editor for a Voxel game called blockscape which is written in C and has an open file format.
I started to write direct openGL code with lwjgl and learned alot about the openGL basics and maths some nice results for the basics like viewing one chunk (32x32x32) or to view a worldmap of all chunks.
As I started to scale up the hassle with alot of of common issues began with alot of common things and because I don’t want to program an engine from scrath I looked around and I found jMonkey
So I quickly migrated to jMmonkey and must say I love it.
Ok enough talk back to the topic about voxels
I will try to show my approach (however I am still at an early stage):
I am using a a tree Structure with 27 Nodes resembling the 3D space of the Cube only the bottom level has the actual chunks in it which I loaded from the game file.
This way my structure is able to scale into infinity if I unload branches into a DB or on disk cause the node can easily be identified.
Here a a shot of some rendered chunks, you can see the boarders of each chunk with the green lines
And this is an earlier version with a bigger scale of the Tree structure and a Level Of Detail that renders a chunk as Block if it has content
As you can see I’m currently have trouble with the textures
Which leads to the next Level of detail, rendering the actual blocks.
At the moment I create 8 Vertices for each block without any texture coordinates and write them directly into a custom Mesh.
In the process of writing the vertices to the mesh my custom Mesh checks if the vertex already exists if so it shifts the indices and skips the vertex.
This way I currently get 1 Mesh for each Chunk. Which also could be adjusted according to a LOD system like hollow solid blocks and stuff like that, I could also compress the mesh more if I delete the “vertices in the middle”.
Now the Problem of course is that the whole Mesh only has 1 material and I even can’t work with the texture atlas which I did in my old program.
Also I currently don’t see a solution of how I can achieve correct texture Coords on the mesh (thats why the textures all are so bugy)
If I use 24 vertices per Voxel I get correct texCoords, but this also means I have a 3 times bigger buffer + the size of tex Coords which I want to omit.
Thats why I currently try to texture the world using noise funclions inside the fragment shader… which is realy difficult.
Another approach could be that I create a seperate “Texture Coord Mesh” or use some kind of 3dTextureMap.
Not sure if anyone has done sth like this before but well I like to experiment
So what is your opinion should I stick to my plan ? does it sound reasonable ? or do you see some fatal errors ?
I even saw some posts about Voxel engine Libraries like SimpleBloxelWorld and BlockZ would you recommend them for my use case ?
I am a little afraid that they don’t scale that well (Blockscape uses a pretty high Block resolution) and I could not change stuff on the “engine”