Proper UV Texture on Unshaded Material

Hi there,

I’m currently trying to make a mobile application and I’m trying to use only unshaded materials. I am using the jme ferrari model, but am at a

loss on how to make the UV map appear correctly on the car when using it as a texture for an unshaded material.

(Or whether or not it’s possible)

Here is the method in question.

Thanks for Reading!

[java] public void makeNewPlayer(){
Player player = new Player();
player.model = new Node();
player.isDead = false;
player.score = 0;
Node ninja = (Node) assetManager.loadModel(“Models/Ferrari/Car.scene”);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
TextureKey key = new TextureKey(“Models/Ferrari/Car.jpg”);
key.setGenerateMips(true);
Texture tex = assetManager.loadTexture(key);
tex.setWrap(Texture.WrapMode.MirroredRepeat);
mat.setTexture(“ColorMap”, tex);
ninja.setMaterial(mat);
ninja.setLocalScale(.5f);
player.model.attachChild(ninja);
currentPlayer = player;
rootNode.attachChild(player.model);
player.model.setLocalTranslation(0, -.5f, 0);
}[/java]

tex.setWrap(Texture.WrapMode.MirroredRepeat);

are you sure that this is in fact the correct wrap mode for that model?
Cause else than that uvs in unshaded should work exactly the same as in lighting,as only the lighting model is the differene between those two materials.

I removed the offending line and no difference. I believe I added that line with the intention of seeing if it would make a difference.

But my car is still all wrong,

Here is the current method

[java] public void makeNewPlayer(){
Player player = new Player();
player.model = new Node();
player.isDead = false;
player.score = 0;
Node ninja = (Node) assetManager.loadModel(“Models/Ferrari/Car.scene”);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
TextureKey key = new TextureKey(“Models/Ferrari/Car.jpg”);
Texture tex = assetManager.loadTexture(key);
mat.setTexture(“ColorMap”, tex);
ninja.setMaterial(mat);
ninja.setLocalScale(.5f);
player.model.attachChild(ninja);
currentPlayer = player;
rootNode.attachChild(player.model);
player.model.setLocalTranslation(0, -.5f, 0);
}[/java]

@BigBob said: But my car is still all wrong,

Wrong how? Can you show us?

Yes sir, Here is a screen shot for your viewing pleasure

@BigBob said: Yes sir, Here is a screen shot for your viewing pleasure

Try to flip your texture in the material.

1 Like

This may be a stupid question but how exactly would I flip the texture in my material?

Hum, if you use the j3m editor you have a checkBox when you set the texture, and if you do it by code, you have a constructor (texture or texture key…don’t remember) that take 2 parameters…the second is a boolean which means the texture will be flipped or not.

Worked! Thanks

I had to set it to false.