Meshes think there is no lightstate?

The problem is that imported meshes do not realise there is a lightstate.



> All meshes are connected to the rootNode.

> A lightstate is created, with directional light (blue diffuse) attached and the state is then attached to the rootNode.

> All the meshes are loaded / created in a single code block with updateRenderState() called on the rootNode, with the renderState stack propagated.



How is it some of the meshes are being rendered with the setup light state and some using the default ‘no light’ state?



The models are imported from Blender3D via hottbj, so something is happening somewhere that isn’t quite right. Not knowing about the underlying implementation details, I’m having problems figuring out the cause, which is leaving me rather stumped at the moment.



I’m sure this may be a one of those problems whose solution is ‘easy’ when you know it, but then - aren’t they all.



Thanks in advance!





The ground and Box have the lightstate applied - programatically created in JME

The target and model have the ‘no light’ state and were imported

They might have material settings that give the bright appearance, giving the impression that something is awry. If I remember correctly, I used to always have to remove or change the default materials on objects that I imported from Blender.



You can use Scene Monitor on your root node to figure out what is causing that, and tweak it to find your ideal settings.

@nymon thanks for the suggestion; trying the Scene Monitor (useful tool btw) just showed no that material states were attached.



Though your suggestion did lead me to think of comparing every field in the Texture from the imported model and one loaded by the TextureManager - leading me to the solution!



Solution: setApply( ApplyMode.Modulate )



The value was being loaded as ApplyMode.Decal, which produced the problem described above.

Good news! That must have been an interesting one to figure out.