Using lights from Blender in a scene for JME


I’m fairly new to JME and I was wondering if I was able to setup all of the lights for the scene in Blender then import it into JME (Not using the JMonkeyPlatform) and have the lights from blender show up in the scene. If I can do such thing how would I do it?

My first attempt was to just try importing the .blend native but I couldnt get that to work. I’m assuming that you have to use .obj for models/scenes.

Thanks in advanced!

Afaik the .blend loader is actually the only way to import lights from blender. I don’t think the other pipelines supports it.
However not all lights from blender can be imported, I think Sun will map to a point light, spot light to spot light…I think the hemi light is skipped…

Do you have some error?

I didnt get any error, the model was just overwhelming bright and when you attach a texture to it in blender and import it in JME its dark as can be.

Also how do you do the blender loader? It seems that the updating of the site made it very hard to find the documentation of the BlenderLoader.

Lights are attached to a node and they only enlight children node of this node.
So if you load the scene, attach it to root, and then attach your model to root. Then it won’t receive light from scene.
Often I post-load the scene, and attach its light to root.

To use the blender loader at runtime (bad practice) you should include the jme-plugins as dependency (iirc).

PS: I’m working on an other pipeline jme-blender (mainly to import my scene) take a look at [devlog] jme3 as blender renderer - #10 by nehon . And ask me if you want to give it a try.

I’ll give it a try and possibly take a look at the me-blender.


Hey @FallenYouth

can you post me the link to your model here ?
I will take a look at it.
But as @nehon mentioned it - not all ligth types are supported by jme so they might not be properly loaded.
Point Light and Spot Light are supported. As well as Area which is being imported as DirectionalLight in JME.
Also AmbientLight is supported, but this one is set in enviroment section in blender.

Sun and Hemi are not supported and thus not imported at all.
But maybe I could change it and import them as different type of light.

1 Like

Here is the model, I hope google drive will suffice.

The model is just a test scene to see if the lights were working.
Now when loading a scene you would use the .blend file directly to get the lights right?

Oh I thought the Sun was imported.
IMO you should import the sun as a point light with a very wide radius.
Also Import the Hemi light as a directional light.

I have downloaded your model and it worked for me. Maybe try changing the colors of the lights so that they are different one from another and you will be able to see the results.
If it doesn’t work - tell me and I will search further for the problem.

I have added support for Sun and Hemi lights as you suggested.

1 Like

Pretty cool, thanks :wink:

Just to get that clear (as I seemd to happen the same problem, I then just stopped from using lighting :stuck_out_tongue: )
If I add lights to the rootNode, I’d expect it to light each children (which infact is each other node attached to the rootNode?)

Or do you mean that the light only affects nodes under the level of the light? Like:
rootNode → attachChild(LightLayer); attachChild(sceneNode); and then sceneNode.attachChild(all the models);

(Easy version: If you attach the light to the rootNode, it should enlight everything as everything is a child of the rootNode?)

that’s how it works

A light lights the subgraph of the node it’s attached to

1 Like