|
Post by gbordelon on Oct 15, 2019 22:03:07 GMT
I'm struggling to figure out how to use texture coordinates provided in a model I found online (when the OBJ file has 'vt ' lines). I've implemented MTL parsing for materials including color maps and bump maps, and I've implemented barycentric coordinates for uv mapping a texture to a triangle. I know I need to do additional work when a triangle has texture coords provided by the OBJ file, I just don't know what that work is... Can anyone point me in the right direction? Edit: This is helpful for conceptualizing texture coordinates: stackoverflow.com/questions/5532595/how-do-opengl-texture-coordinates-work/5532670#5532670
|
|
|
Post by gbordelon on Oct 16, 2019 3:42:49 GMT
|
|
|
Post by gbordelon on Oct 16, 2019 8:04:57 GMT
|
|
|
Post by mrwetsnow on Nov 11, 2019 19:52:42 GMT
I just implemented this, but my textures show up inside out (exported from Blender 2.8). I've checked and the normals are facing the correct direction (just using a simple cube). Did you by any chance run into this?
|
|
|
Post by gbordelon on Nov 18, 2019 21:57:05 GMT
I just implemented this, but my textures show up inside out (exported from Blender 2.8). I've checked and the normals are facing the correct direction (just using a simple cube). Did you by any chance run into this? I don't think so but I'm not sure what you mean. Textures show up like a mirror reflection? When UV mapping you need to "reverse" the V value by subtracting it from 1.0 otherwise your textures will appear upside-down. That's probably not what you mean though... Edit: I think I know what you mean by inside-out. A triangle has two faces so perhaps your pattern uv_map function for triangles is simply using the wrong face. Try swapping which values you use for u,v,w when using the OBJ file's texture coords.
|
|
|
Post by mrwetsnow on Nov 19, 2019 1:20:48 GMT
Sorry, I failed to update this. I don't remember anymore what exactly it was, but it was just a matter of changing the sign on one of the variables during import.
|
|