diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java index 1910ca197..add3e2147 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java @@ -86,13 +86,12 @@ public class LightHelper extends AbstractBlenderHelper { //range ((SpotLight)result).setSpotRange(((Number) structure.getFieldValue("dist")).floatValue()); //outer angle - float outerAngle = ((Number) structure.getFieldValue("spotsize")).floatValue()*FastMath.DEG_TO_RAD; + float outerAngle = ((Number) structure.getFieldValue("spotsize")).floatValue()*FastMath.DEG_TO_RAD * 0.5f; ((SpotLight)result).setSpotOuterAngle(outerAngle); //inner angle float spotblend = ((Number) structure.getFieldValue("spotblend")).floatValue(); spotblend = FastMath.clamp(spotblend, 0, 1); - //float innerAngle = 2.0f * (float)Math.atan((1.0f-spotblend)*Math.tan(spotblend/2.0f)); float innerAngle = outerAngle * (1 - spotblend); ((SpotLight)result).setSpotInnerAngle(innerAngle); break; diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java b/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java index 172ac9742..ed14a11af 100644 --- a/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java +++ b/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java @@ -207,14 +207,22 @@ public class ObjectHelper extends AbstractBlenderHelper { Quaternion quaternion = t.getRotation(); Vector3f[] axes = new Vector3f[3]; quaternion.toAxes(axes); - ((DirectionalLight)light).setDirection(axes[2].negate());//-Z is the direction axis of area lamp in blender + if(fixUpAxis) { + ((DirectionalLight)light).setDirection(axes[1].negate());//-Z is the direction axis of area lamp in blender + } else { + ((DirectionalLight)light).setDirection(axes[2].negate()); + } } else if(light instanceof SpotLight) { ((SpotLight)light).setPosition(t.getTranslation()); Quaternion quaternion = t.getRotation(); Vector3f[] axes = new Vector3f[3]; quaternion.toAxes(axes); - ((SpotLight)light).setDirection(axes[2].negate());//-Z is the direction axis of area lamp in blender + if(fixUpAxis) { + ((SpotLight)light).setDirection(axes[1].negate());//-Z is the direction axis of area lamp in blender + } else { + ((SpotLight)light).setDirection(axes[2].negate()); + } } else { LOGGER.log(Level.WARNING, "Unknown type of light: {0}", light); }