Hi!
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
See:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java#210
[java]
((DirectionalLight)light).setDirection(axes[2].negate());//-Z is the direction axis of area lamp in blender
[/java]
Trial and error has led me to believe that the snippet instead should be something closer to.
[java]
((DirectionalLight)light).setDirection(axes[1].negate());//-Y is the direction axis of lamps in blender
[/java]
This seems to produce correctly rotated lights on the latest ObjectHelper (r8951).
Same also applies to spotLights at.
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/blender/com/jme3/scene/plugins/blender/objects/ObjectHelper.java#217
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.
1)
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.
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/blender/com/jme3/scene/plugins/blender/lights/LightHelper.java#89
Which should in fact be.
[java]
float outerAngle = ((Number) structure.getFieldValue(“spotsize”)).floatValue()*FastMath.DEG_TO_RAD / 2;
[/java]
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.
Glad to help, keep up the awesome work!