Maybe you are lighting the backfaces, i.e. the light source is below the ground? I've written a little test case. It shows how lighting affects your model for different light source positions. Maybe it helps:
import java.awt.Color;
import com.threed.jpct.Config;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.IRenderer;
import com.threed.jpct.Loader;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
import com.threed.jpct.util.Light;
public class HelloRoom {
private World world;
private FrameBuffer buffer;
private Object3D box;
private Object3D bulb;
private Light light;
public static void main(String[] args) throws Exception {
Config.glUseVBO = true;
new HelloRoom().loop();
}
public HelloRoom() throws Exception {
world = new World();
world.setAmbientLight(10, 10, 10);
light = new Light(world);
light.setPosition(new SimpleVector(0f, -50f, 0f));
light.setIntensity(255, 255, 255);
bulb=Primitives.getEllipsoid(2, 1);
world.addObject(bulb);
bulb.setAdditionalColor(Color.WHITE);
bulb.compile();
TextureManager.getInstance().addTexture("Material.jpg", new Texture("textures/stones.jpg"));
box = Object3D.mergeAll(Loader.load3DS("mesh/map.3ds", 0.05f));
box.rotateX((float) -Math.PI / 2f);
box.compile();
box.build();
world.addObject(box);
world.getCamera().setPosition(50, -50, -5);
world.getCamera().lookAt(box.getTransformedCenter());
}
private void loop() throws Exception {
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_GL_AA_2X);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
SimpleVector lPos = new SimpleVector(0, -50, 0);
float add = -0.25f;
while (!org.lwjgl.opengl.Display.isCloseRequested()) {
lPos.y += add;
light.setPosition(lPos);
bulb.clearTranslation();
bulb.translate(lPos);
box.rotateY(0.01f);
buffer.clear(java.awt.Color.BLUE);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
Thread.sleep(10);
if (add < 0) {
if (lPos.y <= -50f) {
add = 0.25f;
}
} else {
if (lPos.y >= 50f) {
add = -0.25f;
}
}
}
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.dispose();
System.exit(0);
}
}