diff --git a/jme3-core/src/main/java/com/jme3/material/Material.java b/jme3-core/src/main/java/com/jme3/material/Material.java index 520362f40..74fdbb006 100644 --- a/jme3-core/src/main/java/com/jme3/material/Material.java +++ b/jme3-core/src/main/java/com/jme3/material/Material.java @@ -935,9 +935,9 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { renderMeshFromGeometry(r, g); } - if (isFirstLight && lightList.size() > 0) { - // There are only ambient lights in the scene. Render - // a dummy "normal light" so we can see the ambient + if (isFirstLight) { + // Either there are no lights at all, or only ambient lights. + // Render a dummy "normal light" so we can see the ambient color. ambientColor.setValue(VarType.Vector4, getAmbientColor(lightList, false)); lightColor.setValue(VarType.Vector4, ColorRGBA.BlackNoAlpha); lightPos.setValue(VarType.Vector4, nullDirLight); @@ -1152,11 +1152,6 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { TechniqueDef techDef = technique.getDef(); - if (techDef.getLightMode() == LightMode.MultiPass - && lights.size() == 0) { - return; - } - if (rm.getForcedRenderState() != null) { r.applyRenderState(rm.getForcedRenderState()); } else { @@ -1191,10 +1186,16 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable { case SinglePass: int nbRenderedLights = 0; resetUniformsNotSetByCurrent(shader); - while (nbRenderedLights < lights.size()) { - nbRenderedLights = updateLightListUniforms(shader, geom, lights, rm.getSinglePassLightBatchSize(), rm, nbRenderedLights); + if (lights.size() == 0) { + nbRenderedLights = updateLightListUniforms(shader, geom, lights, rm.getSinglePassLightBatchSize(), rm, 0); r.setShader(shader); renderMeshFromGeometry(r, geom); + } else { + while (nbRenderedLights < lights.size()) { + nbRenderedLights = updateLightListUniforms(shader, geom, lights, rm.getSinglePassLightBatchSize(), rm, nbRenderedLights); + r.setShader(shader); + renderMeshFromGeometry(r, geom); + } } return; case FixedPipeline: