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.
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…
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).
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.
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.
Just to get that clear (as I seemd to happen the same problem, I then just stopped from using lighting )
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?)