Creating a textured mesh that receives light

I do not see how I can programmatically create a mesh and apply a bitmap texture and have the mesh receive light.

My meshes loaded by loadModel() are under the same Node as the Ambient and DirectionalLights are on, and they do receive the light I want the Mesh to receive.

My code-created Mesh has its material set as Material(getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”);, as I do not see how I apply a Bitmap texture to a “Common/MatDefs/Light/Lighting.j3md” material, whereas the former permits setTexture(“ColorMap”, scene.getSeaTexture());

Should I be using Lighting.j3md? If so, how do I apply a bitmap texture to that material?

edit: I see that using Lighting.j3md sort of works if I use setTexture(“DiffuseMap”), though it seems to take up very little light. I will tweak from here.


DiffuseMap is indeed what you need, this is all covered in the materials tutorial.

Also note that your mesh will need normals.