title: libgdx translucent 3D object with visible back faces
body: <p>I try render translucent 3D cube with hole in libgdx? For render back face I set cull face to none and depth test to false.</p>
  
  <pre><code>public void init() {
      batch = new ModelBatch();
  
      environment = new Environment();
      environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
      environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -0.2f, -0.8f, -1f));
  
      modelInstance = new ModelInstance(assets.get("cube.g3dj", Model.class));
  
      Material material = modelInstance.getMaterial("Main");
      material.clear();
      material.set(ColorAttribute.createDiffuse(new Color(0x0075f4ff)));
      material.set(new BlendingAttribute(0.6f));
      material.set(IntAttribute.createCullFace(GL20.GL_NONE));
      material.set(new DepthTestAttribute(false));
  }
  
  public void render(float delta) {
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
  
      batch.begin(camera);
      batch.render(modelInstance, environment);
      batch.end();
  }
  </code></pre>
  
  <p>cube.g3dj:</p>
  
  <pre><code>{
      "version": [  0,   1], 
      "id": "", 
      "meshes": [
          {
              "attributes": ["POSITION", "NORMAL"], 
              "vertices": [
                  -1.000000, -1.000000,  1.000000, -1.000000,  0.000000,  0.000000, 
                  -1.000000,  1.000000,  1.000000, -1.000000,  0.000000,  0.000000, 
                  -1.000000,  1.000000, -1.000000, -1.000000,  0.000000,  0.000000, 
                  -1.000000, -1.000000, -1.000000, -1.000000,  0.000000,  0.000000, 
                   1.000000,  1.000000,  1.000000,  0.000000, -0.000000,  1.000000, 
                  -1.000000,  1.000000,  1.000000,  0.000000, -0.000000,  1.000000, 
                   1.000000, -1.000000,  1.000000,  0.000000, -0.000000,  1.000000, 
                  -1.000000, -1.000000,  1.000000,  0.000000, -0.000000,  1.000000, 
                   1.000000, -1.000000, -1.000000,  1.000000, -0.000000,  0.000000, 
                   1.000000,  1.000000,  1.000000,  1.000000, -0.000000,  0.000000, 
                   1.000000, -1.000000,  1.000000,  1.000000, -0.000000,  0.000000, 
                   1.000000,  1.000000, -1.000000,  1.000000, -0.000000,  0.000000, 
                  -1.000000, -1.000000, -1.000000,  0.000000,  0.000000, -1.000000, 
                   1.000000,  1.000000, -1.000000,  0.000000,  0.000000, -1.000000, 
                   1.000000, -1.000000, -1.000000,  0.000000,  0.000000, -1.000000, 
                  -1.000000,  1.000000, -1.000000,  0.000000,  0.000000, -1.000000, 
                   1.000000, -1.000000, -1.000000,  0.000000, -1.000000, -0.000000, 
                  -0.500000, -1.000000, -0.500000,  0.000000, -1.000000, -0.000000, 
                  -1.000000, -1.000000, -1.000000,  0.000000, -1.000000, -0.000000, 
                   0.500000, -1.000000, -0.500000,  0.000000, -1.000000, -0.000000, 
                  -1.000000,  1.000000, -1.000000, -0.000000,  1.000000,  0.000000, 
                  -0.500000,  1.000000,  0.500000, -0.000000,  1.000000,  0.000000, 
                  -0.500000,  1.000000, -0.500000, -0.000000,  1.000000,  0.000000, 
                  -1.000000,  1.000000,  1.000000, -0.000000,  1.000000,  0.000000, 
                  -1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000, 
                   1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000, 
                  -0.500000,  1.000000,  0.500000,  0.000000,  1.000000,  0.000000, 
                   0.500000,  1.000000,  0.500000,  0.000000,  1.000000,  0.000000, 
                   1.000000,  1.000000,  1.000000,  0.000000,  1.000000,  0.000000, 
                   1.000000,  1.000000, -1.000000,  0.000000,  1.000000,  0.000000, 
                   0.500000,  1.000000,  0.500000,  0.000000,  1.000000,  0.000000, 
                   0.500000,  1.000000, -0.500000,  0.000000,  1.000000,  0.000000, 
                  -1.000000,  1.000000, -1.000000,  0.000000,  1.000000, -0.000000, 
                   0.500000,  1.000000, -0.500000,  0.000000,  1.000000, -0.000000, 
                   1.000000,  1.000000, -1.000000,  0.000000,  1.000000, -0.000000, 
                  -0.500000,  1.000000, -0.500000,  0.000000,  1.000000, -0.000000, 
                  -1.000000, -1.000000,  1.000000, -0.000000, -1.000000,  0.000000, 
                  -0.500000, -1.000000, -0.500000, -0.000000, -1.000000,  0.000000, 
                  -0.500000, -1.000000,  0.500000, -0.000000, -1.000000,  0.000000, 
                  -1.000000, -1.000000, -1.000000, -0.000000, -1.000000,  0.000000, 
                   1.000000, -1.000000,  1.000000,  0.000000, -1.000000, -0.000000, 
                  -1.000000, -1.000000,  1.000000,  0.000000, -1.000000, -0.000000, 
                   0.500000, -1.000000,  0.500000,  0.000000, -1.000000, -0.000000, 
                  -0.500000, -1.000000,  0.500000,  0.000000, -1.000000, -0.000000, 
                   1.000000, -1.000000,  1.000000,  0.000000, -1.000000,  0.000000, 
                   0.500000, -1.000000, -0.500000,  0.000000, -1.000000,  0.000000, 
                   1.000000, -1.000000, -1.000000,  0.000000, -1.000000,  0.000000, 
                   0.500000, -1.000000,  0.500000,  0.000000, -1.000000,  0.000000, 
                  -0.500000, -1.000000,  0.500000,  1.000000,  0.000000,  0.000000, 
                  -0.500000,  1.000000, -0.500000,  1.000000,  0.000000,  0.000000, 
                  -0.500000,  1.000000,  0.500000,  1.000000,  0.000000,  0.000000, 
                  -0.500000, -1.000000, -0.500000,  1.000000,  0.000000,  0.000000, 
                   0.500000, -1.000000,  0.500000, -1.000000,  0.000000,  0.000000, 
                   0.500000,  1.000000,  0.500000, -1.000000,  0.000000,  0.000000, 
                   0.500000,  1.000000, -0.500000, -1.000000,  0.000000,  0.000000, 
                   0.500000, -1.000000, -0.500000, -1.000000,  0.000000,  0.000000, 
                  -0.500000, -1.000000,  0.500000,  0.000000,  0.000000, -1.000000, 
                   0.500000,  1.000000,  0.500000,  0.000000,  0.000000, -1.000000, 
                   0.500000, -1.000000,  0.500000,  0.000000,  0.000000, -1.000000, 
                  -0.500000,  1.000000,  0.500000,  0.000000,  0.000000, -1.000000, 
                  -0.500000,  1.000000, -0.500000,  0.000000,  0.000000,  1.000000, 
                  -0.500000, -1.000000, -0.500000,  0.000000,  0.000000,  1.000000, 
                   0.500000,  1.000000, -0.500000,  0.000000,  0.000000,  1.000000, 
                   0.500000, -1.000000, -0.500000,  0.000000,  0.000000,  1.000000
              ], 
              "parts": [
                  {
                      "id": "Cube_part1", 
                      "type": "TRIANGLES", 
                      "indices": [
                            0,   1,   2,   0,   2,   3,   4,   5,   6,   5,   7,   6, 
                            8,   9,  10,   9,   8,  11,  12,  13,  14,  13,  12,  15, 
                           16,  17,  18,  17,  16,  19,  20,  21,  22,  21,  20,  23, 
                           24,  25,  26,  26,  25,  27,  28,  29,  30,  30,  29,  31, 
                           32,  33,  34,  33,  32,  35,  36,  37,  38,  37,  36,  39, 
                           40,  41,  42,  42,  41,  43,  44,  45,  46,  45,  44,  47, 
                           48,  49,  50,  49,  48,  51,  52,  53,  54,  52,  54,  55, 
                           56,  57,  58,  57,  56,  59,  60,  61,  62,  62,  61,  63
                      ]
                  }
              ]
          }
      ], 
      "materials": [
          {
              "id": "Main", 
              "ambient": [ 0.000000,  0.000000,  0.000000], 
              "diffuse": [ 0.422876,  0.619359,  0.800000], 
              "emissive": [ 0.422876,  0.619359,  0.800000], 
              "opacity":  0.614078, 
              "specular": [ 1.000000,  1.000000,  1.000000], 
              "shininess":  9.607843
          }
      ], 
      "nodes": [
          {
              "id": "Cube", 
              "rotation": [-0.707107,  0.000000,  0.000000,  0.707107], 
              "scale": [ 0.500000,  0.500000,  0.500000], 
              "parts": [
                  {
                      "meshpartid": "Cube_part1", 
                      "materialid": "Main"
                  }
              ]
          }
      ], 
      "animations": []
  }
  </code></pre>
  
  <p>But I have two problem:</p>
  
  <ol>
  <li>Only two faces of the hole are displayed instead of four.</li>
  <li>Different displaying of the cube when rotating.</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/M7Q9E.png" rel="nofollow noreferrer">The cube image rotated by 0, 90, 180 and 270 degrees</a></p>