How to mess with uv, Say, I want to repeat the UV’s 10 times of any particular object(say, box mesh). How do I do that?
I have a lighting material applied on that object. Do I have to do it on material level or object level?
Do you want to repeat a texture on your mesh?
Or you want to scale UV 10 times?
Yes.
Something like: Texture.setWrap(WrapMode.Repeat);
Or in the material editor… there is a checker “repeat”.
I tried on the material editor, and there was no wrapping.
I think the UV mapping on the model is inherently bad. Now, I want to fix it using code. Changing the UV coordinates, so the texturing looks a little better. Is it possible?
Material editor has only “repeat” checkbox. To scale UV you need something like:
Texture tex = assetManager.loadTexture( new TextureKey(“Models/guide.png”, false) );
tex.setWrap(Texture.WrapMode.Repeat);
((Geometry)((Node) spatial).getChild(0)).getMesh().scaleTextureCoordinates(new Vector2f(40,40));
mat.setTexture(“DiffuseMap”, tex);
The important bits being tex.setWrap and scaleTextureCoordinates – the 40,40 means tile the texture 40 times on both U and V.
Taken from: http://hub.jmonkeyengine.org/groups/general-2/forum/topic/repeat-textures-jmonkey-alpha-4/
Thank you! This is what I was looking for.
Is there any automatic uv unwrapping algorithm for uniform UV distribution inside of jME?
hmm, so messing with UV is not a good idea form inside of jME.
Not if you don’t have an idea how to do it no… Else whats the issue? You can edit it like any other mesh data.
JME assume that uv are properly set on the model you’re loading. So it’s up to your artist (or you) to make a proper uv layout
Basic primitives (cube, sphere, etc…) have basic uv layout.