Cutom mesh and texture coord

Hello guys, I was wondering what does the VertexBuffer.Type.TexCoord meant,
is it the actual position of the vertex on the texture (like UV maps)? or the stretching of the texture on the mesh?

I don’t get it :confused:

in the tutorial it is said that the texCoord are percentages, not real texture cordinates?

what if I Know exactly where to map the triangle on the texture, is it possible to define the real position of the triangle on the texture??
:

his syntax means, when you apply a texture to this mesh, the texture will fill the quad from corner to corner at 100% percent size. Especially when you stitch together a larger mesh, you use this to tell the renderer whether, and how exactly, you want to cover the whole mesh. E.g. if you use .5f or 2f as texture coordinates instead of 1f, textures will be stretched or shrunk accordingly.

The tutorials often expect that you are familiar with basic 3D graphics terminology.

Texture coordinates represent source independent coordinates into the texture. 0,0 is at one corner and 1,1 is conceptually at the other… regardless of the size of the source image. If you want a specific “pixel” then divide by image size. But be aware the filtering will make pixels inexact anyway.

1 Like
@pspeed said: The tutorials often expect that you are familiar with basic 3D graphics terminology.

Texture coordinates represent source independent coordinates into the texture. 0,0 is at one corner and 1,1 is conceptually at the other… regardless of the size of the source image. If you want a specific “pixel” then divide by image size. But be aware the filtering will make pixels inexact anyway.

that’s what I was afraid of, is there a way to correctly define the texture coordinates?

I am defining an atlas with lots of “terrain” textures, and when I insert a group of vertexes into the mesh, I know exactly where their texture is in the atlas.

how can I handle this?

@navycougar said: that's what I was afraid of, is there a way to correctly define the texture coordinates?

I am defining an atlas with lots of “terrain” textures, and when I insert a group of vertexes into the mesh, I know exactly where their texture is in the atlas.

how can I handle this?

“If you want a specific “pixel” then divide by image size.” In other words, x = 16 / 128f will get you the 16th pixel in an image 128 pixels wide. Sort of. Actually, it’s important to remember that 1.0 and 0.0 are kind of the same thing in texture space. Conceptually, they are the “edge”.

If you want to avoid bleeding then be careful. There are techniques to avoid it and this has been rehashed a few times. There is even already an atlasing capability built into JME. http://hub.jmonkeyengine.org/javadoc/jme3tools/optimize/TextureAtlas.html I think it opts to put space between the textures to avoid one bleeding into the other due to filtering.

1 Like
@pspeed said: "If you want a specific “pixel” then divide by image size." In other words, x = 16 / 128f will get you the 16th pixel in an image 128 pixels wide. Sort of. Actually, it's important to remember that 1.0 and 0.0 are kind of the same thing in texture space. Conceptually, they are the "edge".

If you want to avoid bleeding then be careful. There are techniques to avoid it and this has been rehashed a few times. There is even already an atlasing capability built into JME. http://hub.jmonkeyengine.org/javadoc/jme3tools/optimize/TextureAtlas.html I think it opts to put space between the textures to avoid one bleeding into the other due to filtering.

lol I was actually thinking about doing that, expanding the small textures so i don’t get the bleeding.
also, and what is the difference between UV maps and texCoords? beause what im’ doing right now kind of reminds me of UV mapping except that i am doing it dynamicdally…

thx again for your help!

It’s the same thing, I guess. u,v are one way of specifying texture coordinates by convention. s,t is another.

1 Like

thanks!