I was playing around with some isometric ideas, I want to create fairly large maps with a couple of Z levels, much like the older X-com games. I figured I am probably way better off to draw the quads however I need and just rotate the camera. So I started experimenting with this. I am currently creating a "chunk" like below and render it with a ModelBatch.

private Model floorChunk(int width, int height) {
        textureAttribute = new TextureAttribute(TextureAttribute.Diffuse, texture);
        Material mat = new Material(textureAttribute);

        ModelBuilder builder = new ModelBuilder();
        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                builder.part("floor[" + x + "|" + y + "]",
                        VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates,
                        .rect(0 + x, 0, 0 + y, 0 + x, 0, 1 + y, 1 + x, 0 ,1 + y, 1 + x,0 ,0 + y,0, 1, 0);

        return builder.end();

I tried running it with 200 by 200 but thats running at around 20FPS. Now I don't need to zoom that far out but about 50 tiles across the screen is the bare minimum and need to take into account additional chunks. Then adding walls, objects, NPC and multiple layers this way will probably not work. I have not much experience with 3D rendering in LibGDX and neither with Open GL but I am open to suggestions, especially suggestions that show how to bind a specific texture to a specific mesh part.

  • \$\begingroup\$ For starter you can try implementing frustum culling. That should give you some FPS boost. Then pack bunch of quad vertices in one vbo and make draw call. Basuc idea is to reduce number of draw call as its riuns trip from cpu to gpu. I have some suggestions for texture. \$\endgroup\$ – Paritosh Kulkarni Sep 14 '18 at 2:05
  • \$\begingroup\$ Start by defining material class and your mesh class will point to material it has. For example you can look at asset import libraries source examples. \$\endgroup\$ – Paritosh Kulkarni Sep 14 '18 at 2:05
  • \$\begingroup\$ Another way to improve is use of instancing if you know positions of your quads send model view matrices foe them packed in vbo and geometry info of only one quad. \$\endgroup\$ – Paritosh Kulkarni Sep 14 '18 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.