Texture render problem/glitch/wrapmode

Hey I making a Block based world, but something wierd is happening with my textures



Every block is a squere mesh with texture coords 0,0-1,1



If I use Wrapmode default:

I get those wierd lines between blocks which is not nice (looked MC doesn’t have them)



http://gyazo.com/de1f0eccc6ea1e8d33c00b77429dad76



if I use wrapmode repeat:



http://gyazo.com/22e5be6a7b3b7dbdd42b5fdbcddfbba5



you instead see wierd repeatings of the texture (green in bottom and brown in top)



it is like even 1f isn’t 1f (know it isn’t because of computer limitations etc) but seems like this is wierd how others

can get it nice but not me, am I doing something wrong?



Best regards, a dev

http://hub.jmonkeyengine.org/groups/graphics/forum/topic/custom-texture-atlas-problem/

http://hub.jmonkeyengine.org/groups/graphics/forum/topic/custom-mesh-different-textures/



The solution seems to be to add a pixel/few pixels around the border of each part of the texture atlas

Wasn’t using a texture atlas before (I am now) and I can get rid of the second problem by making the texture like twice as big (border taking up 16px)±



but the first still appersn now, even when using repeat, is this normal? Can I get rid of it?



also can’t find anything about this, but last poster in the first link said:



"Do you use realtive or absolute positioniongin the shader? There are ways to use pixels instead of 0-1 "



are there any of those shaders out there?

By the way…box worlds aren’t made up from boxes…



Just making sure you know that :slight_smile:

@lanboost said:
Wasn't using a texture atlas before (I am now) and I can get rid of the second problem by making the texture like twice as big (border taking up 16px)+-

but the first still appersn now, even when using repeat, is this normal? Can I get rid of it?

also can't find anything about this, but last poster in the first link said:

"Do you use realtive or absolute positioniongin the shader? There are ways to use pixels instead of 0-1 "

are there any of those shaders out there?


You shouldn't really need borders that big.

I think the issue happens because there is no filtering between one edge and the other when the texture is "clamped" instead of repeating. If your border consists of the wrapped part of the texture (where you want wrapping... like the sides of the dirt+grass but no tthe top and bottom) then the artifact should go away.