OpenGL 3: multiple UVs for a single vertex?

Started by Andrew_3ds, December 18, 2014, 04:59:04

Previous topic - Next topic

Andrew_3ds

When loading an model to my game, some vertices have 2 UV coordinates from seams. The result of it trying to handle it looks glitchy, and I was wondering if it is possible to fix this problem, it looks just fine in blender. Around the limbs the texture is smeared.


Zeroni

We would need to see your model loader's implementation in order to help you correct this. I had a similar issue to this when I started OpenGL, my problem was that I was using GL_TRIANGLE_STRIPS rather than GL_TRIANGLES for my draw mode. I doubt that is the problem here, but anything is worth a shot (In my opinion).
- Zeroni

quew8

(Taking a few guesses about texture sheets and model loading so I might be a little wrong) There are two options. One exactly what @Zeroni said. If you are drawing the libs and the body at the same time with a triangle strip (or loop) then OpenGL is going to interpolate between the two at the joins. If you draw the two separately, then you will have a nice clean cut between the two (might even be too clean).

Option two is to change the texture so that the limb and body textures are actually next to one another making it more of a skin than a texture sheet. This is quite tricky though and generally involves nasty stretching of the texture in the image file and for any complex model I would leave it up to a proper artist. Not saying that you can't, but I leave it to artists.

Andrew_3ds

I checked my code, and I'm definitely calling GL_TRIANGLES. I know that the problem is the 2 UV coords on one vertex because when I used 'edge split' (I use blender) on the legs, it fixed the problem, but this is hard to do with pre-mapped models because I have to find every seam and fix it.