diff --git a/jme3-core/src/main/java/com/jme3/light/AmbientLight.java b/jme3-core/src/main/java/com/jme3/light/AmbientLight.java index 8dd5f9266..58676851c 100644 --- a/jme3-core/src/main/java/com/jme3/light/AmbientLight.java +++ b/jme3-core/src/main/java/com/jme3/light/AmbientLight.java @@ -69,6 +69,8 @@ public class AmbientLight extends Light { @Override public void computeLastDistance(Spatial owner) { + // ambient lights must always be before directional lights. + lastDistance = -2; } @Override diff --git a/jme3-core/src/main/java/com/jme3/light/DirectionalLight.java b/jme3-core/src/main/java/com/jme3/light/DirectionalLight.java index 87fbf695a..b8e1a1979 100644 --- a/jme3-core/src/main/java/com/jme3/light/DirectionalLight.java +++ b/jme3-core/src/main/java/com/jme3/light/DirectionalLight.java @@ -80,7 +80,9 @@ public class DirectionalLight extends Light { @Override public void computeLastDistance(Spatial owner) { - lastDistance = 0; // directional lights are always closest to their owner + // directional lights are after ambient lights + // but before all other lights. + lastDistance = -1; } /**