Texture distortion on triangle boundary

Hi all!



I have a bit odd problem. The case looks simple.



I’m creating a geometry with a box shape, and load a texture onto it. The texture is distorted at the boundaries of the two adjacent triangles that the box consist of.



I’ve created a striped texture to emphasize the problem:









Any help would be appreciated!



The code is the following:





this.geometry = new Geometry();

this.material = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

this.material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

this.material.setTexture(“ColorMap”, assetManager.loadTexture(“stripes.png”));

this.geometry.setQueueBucket(Bucket.Transparent);

this.geometry.setMaterial(material);

this.geometry.setMesh(new Box(new Vector3f(0, 0, 0), w, h, 0));

If the geometry has no uv coordinates, its textures are distorted.

@glaucomardano said:
If the geometry has no uv coordinates, its textures are distorted.


And how would i add these coords? Could you give me a link or something to start with? I'm new with JME and trying to follow the tutorials and did not find anything about this there.

Thank you!

The easier way to create uv texture coordinates for models is by using a modeling software (we recommend blender :)), but if you wanna do it yourself, you can do it programmatically. But keep in mind that it’s for advanced users. Read this. If you wanna do it programmatically, search for UV Mapping on the forum, if you wanna do it the easiest, faster and best way, then start learning blender www.blendercookie.com or learn other 3d modeling software you want.

His Box should already have texture coordinates. I don’t think that’s his problem.



I’m not sure what the problem is… but modeling software will not help in this case.



I’ve used textures boxes before without issue and I have a whole world made of my own quads and never see this texture distortion. What kind of graphics card do you have and are your drivers up to date?

Thanks for the replies!



I have an AMD Radeon 4850 gpu, and i use Windows 7 as OS. My graphic drivers are up to date and i use the beta version of jMonkeyEngine 3.

Hmmm. Now I can understand when you said : “The texture is distorted at the boundaries of the two adjacent triangles that the box consist of”. It’s really weird.

Just in case, can you post a whole test case? And maybe link to the stripes.png you are using in the test?



Maybe someone will see something we don’t.