This pic is not being applied to the model

I have the following code:
Spatial card = assetManager.loadModel("/Object/Card/card.blend");
card.setLocalTranslation(3f, -2f, 0.0f);

	Material card_mat = new Material(assetManager, "/Common/MatDefs/Misc/Unshaded.j3md");
	card_mat.setTexture("ColorMap", assetManager.loadTexture("/Icon/Monkey.png"));


But the pic is not being applied to the object which has a shape of card. It is just black.

Did you set a UV map for the texture in Blender?


What is that. How to set that?

You have to follow a blender tutorial ;).
For example :


@yang71 After going through the tutorial, it seemed to be that UV is for mapping 3D to 2D. But my model is already a plane for a card. What should be done in this case?

It’s also about mapping where in the texture each vertex on the model appears.

1 Like

Your card probably have many faces (triangles). Esp. if it has some thickness, and even more rounded angles.
You have to tell your shader how to draw you texture on any of these triangles. This is what the UV does.

But it is just simple plane.

Well, even a plane needs two triangles. And the system is built so that even a single triangle needs texture coordinates… That’s the way to go…

tsogtoo: Learning about UV Mapping seems to be your next quest. Its a bit like wrapping a christmas present … only in reverse funnily enough. Its a tool of the trade which must be learned if you want things textured.

Hey, I haven’t understood the answers properly. Let me explain what I exactly need.
I am designing a scene for a poker game that includes a table, chairs, cards, players and chips. I have designed the models for each one of them in blender, but haven’t applied textures or materials to the card model. The card model is simply a plane made into a rectangle. Now, when I try to apply a .png image to the card model in jMonkey using addTexture(), it does not show any texture.
What is required, and how is it done? Please explain a little in detail because I have not used blender or jMonkey too much before.

All we have said is still valid. Since the texture has not been applied in Blender, it has no texture coordinates (UV-map). Therefore it cannot be textured in JME.

To summarize, you have to :

  • open Blender
  • open your car model
  • unwrap your model
  • save your blend file

Then your card should appear textured.


Okay, I got it. Thank you.

Your card may be a 2d plane, but it’s still appearing in a 3d world. It needs uv mapping.

You’ve been given the answer 3 times now, try believing us and reading up on the subject.