title: Libgdx 3D - Point Light shows black box & rect (PointLight not working)
body: <p>I am creating a 3d scene currently a box and rect, and trying to enable lighting.</p>
  
  <blockquote>
    <p>When i create a PointLight and add it to Environment everything turns to  black color?</p>
  </blockquote>
  
  <p>all i want to do is create a 3d scene and enable point light, like a sun or rays coming from a point and shading the objects.</p>
  
  <p>Code:</p>
  
  <pre><code>environment = new Environment();
  environment.add(new PointLight().set(1f, 1f, 1f, 0, 0, 20f, 100f));
  
  modelBatch=new ModelBatch();
  </code></pre>
  
  <p>..</p>
  
  <pre><code>square=new ModelBuilder().createBox(300,300,300,new Material(ColorAttribute.createDiffuse(Color.GREEN)),
                  VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
  squareinst=new ModelInstance(square);
  squareinst.transform.setTranslation(-500,0,0);
  </code></pre>
  
  <p>--</p>
  
  <pre><code>sprites.get(0).setRotationY(sprites.get(0).getRotationY() + 1f);
  sprites.get(1).setRotationY(sprites.get(1).getRotationY() - 1f);
  squareinst.transform.rotate(1,0,0,1);
  
  modelBatch.begin(camera);
  for(Sprite3D sp:sprites)// has 3d rect models
       sp.draw(modelBatch,environment);
  modelBatch.render(squareinst,environment);
  modelBatch.end();
  </code></pre>
  
  <p>PointLight turning everything black
  <a href="https://i.stack.imgur.com/ntQeb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ntQeb.png" alt="enter image description here"></a></p>
  
  <p>Without using environment or lights
  <a href="https://i.stack.imgur.com/yxH16.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yxH16.png" alt="enter image description here"></a></p>
  
  <p>as per my investigation, here if pointlight is not working then everything should be black as currently, because the environment needs light, it works fine with Directional light (only the backface of rect is black even after rotations, i don't know why)</p>
  
  <p>libgdx version 1.6.1 - android studio
  i checked it on both android device and desktop</p>
  
  <p>please i really need to get this PointLight working, i don't know if it will take a custom shader, if so please guide me to some links because i am not experienced in shaders. I also read about PointLight not working on some device or not working in opengl 2.0 enabled, but i am not sure.</p>
  
  <p>I tried a lot of thing and values. I know about Ambient Light but that has no use to my case. Directional light also has limited usage (can be used as a fallback if this doesn't work).</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>Its working now, check the answer below:</p>
  
  <ul>
  <li>if you are using big camera size or big model size, please try adding more zeros to the pointlight intensity until the light is visible.
  <a href="https://i.stack.imgur.com/kX5tQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kX5tQ.png" alt="enter image description here"></a></li>
  </ul>