0
$\begingroup$

When exporting a mesh I've created in Blender, the (.obj) file does not contain the uv coordinates I have created in Blender. I made sure Blender recognizes my custom uv map along with the texture but when I load it into my OpenGL program the coordinates do not match the texture. In fact it looks like the coordinates try mapping to the default uv map the mesh provides.

All other data points of the obj are correct (ie. the positions and normals), just not the uv coords.

Update: I've tried using a full obj loader to eliminate the problem and I've reduced my conversion to 1-1 with the obj index (ie. no mesh optimizations). No luck.

Example rendered mesh in OpenGL OpenGL View Blender view Blender View

$\endgroup$
5
  • 1
    $\begingroup$ Do you have more than one UVMap on the mesh? $\endgroup$
    – Denis
    Commented May 30, 2017 at 20:20
  • $\begingroup$ @Denis I don't believe so. Order of events: New project, delete cube, add torus, Create seams, unwrap, export uv tex, create material and texture, open to blender uv tex, set mapping to UV, export obj. $\endgroup$ Commented May 30, 2017 at 20:24
  • 1
    $\begingroup$ Not sure if performance or optimization is your concern at the moment, but that looks like a highly inefficient use of texture area, lots of unused UV space, unnecessarily distorted unwrap, and wasted texture estate in repeating patterns. Anyway, black areas look like out-of-bounds UV coordinates, as if beyond 0-1 UV space, and your OpenGL preview is not tiling the texture $\endgroup$ Commented May 30, 2017 at 23:22
  • $\begingroup$ @DuarteFarrajotaRamos (I've tried other meshes with smart uv unwrap, not luck). The obj file does not contain coords outside 0-1 nor does my program.Elaborate on the tilting part. $\endgroup$ Commented May 31, 2017 at 4:10
  • $\begingroup$ @DuarteFarrajotaRamos Nevermind found the problem $\endgroup$ Commented May 31, 2017 at 4:20

1 Answer 1

1
$\begingroup$

Found the issue sigh. OpenGL reads the uv coord (t) backwards. Blender exported the obj correctly I just forgot about upside-down textures in OpenGL.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .