Hi all,
In my game, I created a blender model with materials that specified the colors of the objects contained in the model. When I imported it into jMonkeyEngine with a gray AmbientLight and a DirectionalLight, I found that the sides that were being hit by the DirectionalLight were colored whereas the sides that were only being lit by the AmbientLight were all and only gray even though all sides were the same color. Is this normal behavior? If so, how can I make the ambient light illuminate based on the material color?
Any help is much appreciated!
Screenshots:
https://drive.google.com/drive/folders/1eV4OX2LYDCbxNKS7Rlc8kBlunniqYRco?usp=sharing
Debug: Viewing the part of the model lit by the ambient light only
Debug2: The actual blender file
Debug3: Viewing the model from the side lit by the directional (sun) light
Code:
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Spatial;
import com.jme3.scene.plugins.blender.BlenderModelLoader;
public class AmbientTest extends SimpleApplication {
public static void main(String[] args) {
AmbientTest app = new AmbientTest();
app.start();
}
public Spatial test;
@Override
public void simpleInitApp() {
assetManager.registerLoader(BlenderModelLoader.class, "blend");
test = assetManager.loadModel("Models/Materials.blend");
rootNode.attachChild(test);
/** A white ambient light source. */
AmbientLight ambient = new AmbientLight();
ambient.setColor(ColorRGBA.Gray);
rootNode.addLight(ambient);
/** A white, directional light source */
DirectionalLight sun = new DirectionalLight();
sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);
}
@Override
public void simpleUpdate(float tpf) {
}
@Override
public void simpleRender(RenderManager rm) {
}
}