[LibGDX] Trouble understanding some issues with lighting my 3D scene

I’m having some trouble understanding some various issues when working with 3D. I’m using LibGDX, but I’m not sure if my problems / knowledge gaps are more general to OpenGL or the way LibGDX does things.

Image of the scene: http://i.imgur.com/RHi8CyB.png

Legend:
(1) DirectionalLight

new DirectionalLight().set(0.8f, 0.8f, 0.8f, 2, 1, 2);

(2) PointLight

new PointLight().set(Color.RED, 1f, 0.5f, 1f, 5f);

(3) Cube’s generated inside LibGDX


 ModelBuilder modelBuilder = new ModelBuilder();
Model model = modelBuilder.createBox(1f, 1f, 1f, 
    new Material(ColorAttribute.createDiffuse(Color.GREEN)),
    Usage.Position | Usage.Normal);
ModelInstance inst = new ModelInstance(model);

(4) Default cube exported from Blender


assets = new AssetManager();
assets.load("cube.g3db", Model.class);
Model model2 = assets.get("cube.g3db", Model.class);
ModelInstance inst = new ModelInstance(model2);

All these instances are added to an Array and then rendered with as below. Instances are positioned in various places to create the layout shown. The environment contains the 2 lights, as well as some ambient lighting.


Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
modelBatch.begin(camera);
modelBatch.render(instances, environment);
modelBatch.end();

Given this, I have a few questions. Even just some pointers about the correct terminology to be reading up on would be great.

a. Why do the imported cubes (4) receive the light from the PointLight(2) but the generated cubes (3) do not? Do I need to adjust the materials that are applied for this to work?

b. Why does the left most cube (4) receive the light from the PointLight(2) when the green cubes (3) are positioned in such a way that it should prevent the light from reaching it? The light passes through the cubes somehow. I don’t want to yet make the cubes cast shadows or anything like that, just block lights with the models. Or is this all the same subject of shadow mapping?

Thanks for the help, and apologies if this should have gone in the OpenGL forum.

I’m not that familiar with LibGDX, so these answers may be off base, but maybe they’ll at least give you some ideas.

Regarding the first issue, it looks like the material for the generated cubes is pure green and the point light is pure red, so it may be that the interaction between the two is producing no result (conceptually, the green material would reflect only green light - pure red light would be absorbed). To test this theory, you could try making the generated cubes white instead.

For the second issue, I’d be surprised if LibGDX handled occlusion by default. I could be wrong about that, but my guess is you’ll have to implement that yourself in one way or another (or at least make use of LibGDX features that you’re not using yet).

That said, I imagine someone who’s more familiar with LibGDX will be able to provide more specific answers.