I’ve recently lost my code to my old game, so I’m starting a new 3D game. I wanted to make a voxel game, and I was wondering if this is feasible with LibGDX and its 3D API. My main question is whether the modelbuilder is fast enough to create all the cubes I’ll need, and how it actually works exactly. What type of OpenGL rendering metro does it use? VBOs?
Thanks!
Another voxel engine? ;D
Anyways, source is here, don’t think you should have too much trouble understanding it because you know lwjgl (if I remember correctly).
Yeah, making a voxel game was always my goal, and now I’m almost there
So that was pretty easy to read, wasnt that complex. However, I read somewhere that the ModelBatcher actually doesn’t batch its rendering calls, it just sorts calls out and binds shaders, so its actually slow to use. Is this true? And can I also modify the individual vertices on a box? Because I’ll need to do all sorts of culling.
Just posting back to resolve my question; LibGDX’s 3D API seems very slow, I created 16x16x16 boxes from the ModelBuilder class, and my FPS dropped to less than 60 whereas with my crappy, thrown together voxel “engine” built on LWJGL can handle 4x that many cubes before dropping to even 60 FPS. Makes me wonder how exactly the models are rendered!
You should probably look here if you plan to make a Voxel engine with LibGDX’s 3D API:
ModelBatch won’t actually interleave your thousands of cube vertices into the same draw call, it is more focused on sorting geometry based on their materials (like in a typical scene graph).
But in a voxel game, you don’t just interleave cubes into a single VBO and expect awesome performance. Instead, you should focus on frustum culling, backface culling, and culling faces that are against each other (since they won’t be visible anyways). Apply some fog to reduce the viewing distance. In the end, you should be left with far fewer faces, which can then be pushed to the GPU for rendering.
Oh, I wasn’t really planning on using LibGDX for anything 3D, honestly. I had heard it doesn’t interleave geometry, so already that was a huge minus for myself, personally. I’d rather write my own engine and learn how it all works, then use a high level library that I’ll never really learn from. I’m still in the learning phase, you see!
Actually, while I have you here, I’ve heard that combining mesh faces together can be beneficial for voxels, but it also is very slow. I’m thinking it would be very slow for anything but a solid chunk of cubes, but what do I know? Is it a good thing to do or should I should not worry about it?
Nobody interleaves geometry for you neither LWJGL nor JME, but ModelBuilder and Mesh can help you do that. See the source davedes posted on how it’s done with the new 3D API… For what it’s worth, when used with knowledge, it easily beats JME especially on mobile. Doesn’t have a scene graph API though, but that’s useless for voxels anyways.