Model doesn't render properly

I have created a rifle model for my FPS game, and I can successfully import it into jMP, but when I see it in-game, it is unshaded. I have applied a lit material, and there is a light in the scene. I also have a PSSM shadow renderer running. The wierd thing is, it renders properly when I look at certain angles. Each run the angles are different and seemingly random. Here’s the code for the model and the light:



Model:

[java] public void weaponFPS() {

weapon = assetManager.loadModel(“Models/spec_rifle.obj”);

weapon.setMaterial(assetManager.loadMaterial(“Materials/gun.j3m”));

weapon.setLocalScale(1/8f);

weapon.setLocalRotation(YAW180);

weapon.setShadowMode(ShadowMode.CastAndReceive);

rootNode.attachChild(weapon);

}[/java]



Light:

[java] private void setUpLight() {

AmbientLight al = new AmbientLight();

al.setColor(ColorRGBA.White.mult(1.3f));

rootNode.addLight(al);



DirectionalLight dl = new DirectionalLight();

dl.setColor(ColorRGBA.White);

dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal());

rootNode.addLight(dl);

}[/java]



Have I done anything wrong?

Check with the model at full scale. I’ve had a model that, when scaled, would only show as dark. This might be the problem. Or not. Worth a shot though.

Thanks, but it still seemed off. It helped a little, in that the shadows cast and received on the weapon looked better. But it still seems as if I’m running it as unshaded. I’ll try just adding a box to the scene and using the same material to see if it’s the material or the model.



EDIT: Got the same problem, but this time it was more obvious what it really was. It renders fine at first, but when i get to a certain angle, the specular shine bumps WAY up and the box turns solid white until i move away. I disabled Shininess and it went totally different. The box renders fine from most angles, but from some angles becomes unshaded. The weapon model is completely black-- it doesn’t matter what angle I look at it from. So maybe it’s the model AND the material…

That’s now beyond what I can help with concerning models. Hopefully someone else more knowledgeable than me (shouldn’t be too hard) will come take a look.