BlenderLoader Light direction is wrong


I’m currently relying heavily on composing my scene directly in blender, and just the .blend using the jme3 BlenderLoader. I’ve noticed that light directions are not correctly loaded.

This is my observation from looking at com.jme3.scene.plugins.blender.objects.ObjectHelper



((DirectionalLight)light).setDirection(axes[2].negate());//-Z is the direction axis of area lamp in blender


Trial and error has led me to believe that the snippet instead should be something closer to.


((DirectionalLight)light).setDirection(axes[1].negate());//-Y is the direction axis of lamps in blender


This seems to produce correctly rotated lights on the latest ObjectHelper (r8951).

Same also applies to spotLights at.

Sorry for flood posting, I don’t appear to be able to edit my posts.

Allright, two more issues with SpotLight loading.

Looking at com.jme3.scene.plugins.blender.lights.LightHelper.


Blender defines the angle of the spotlight beam in degrees, meaning 180 degrees would be a beam shooting out 90 degrees on the spotlight direction axis.

JME3 outerAngle/innerAngle is from the spotlight direction axis and is currently mapped directly from blender, see.

Which should in fact be.


float outerAngle = ((Number) structure.getFieldValue(“spotsize”)).floatValue()*FastMath.DEG_TO_RAD / 2;



The range is by default defined as inverse square. And JME3 apparently only uses linear falloff with distance / range. So either no other falloff but linear should be loaded with an exception / warning in any other case, or JME3 should support more types of falloffs :).

This is not a biggie since blender can be configured to render with linear falloff aswell, and therefore give an accurate scene representation.

@Kaelthas: ?

Thanks @udoprog for pointing this out.

The fixes are already in svn :slight_smile:

1 Like

Glad to help, keep up the awesome work!