BigBob
March 6, 2014, 7:27am
1
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.
BigBob
March 6, 2014, 4:29pm
3
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]
pspeed
March 6, 2014, 6:19pm
4
@BigBob said:
But my car is still all wrong,
Wrong how? Can you show us?
BigBob
March 6, 2014, 10:39pm
5
Yes sir, Here is a screen shot for your viewing pleasure
haze
March 6, 2014, 11:16pm
6
@BigBob said:
Yes sir, Here is a screen shot for your viewing pleasure
Try to flip your texture in the material.
1 Like
BigBob
March 6, 2014, 11:59pm
7
This may be a stupid question but how exactly would I flip the texture in my material?
haze
March 7, 2014, 12:10am
8
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.
BigBob
March 7, 2014, 12:16am
9
Worked! Thanks
I had to set it to false.