[fixed] OBJ loader texcoord bug

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
giliamdecarpentier
Posts: 1
Joined: Fri Dec 12, 2008 4:29 pm

[fixed] OBJ loader texcoord bug

Post by giliamdecarpentier »

The texture v-coordinates in the OBJ mesh loader are negated (i.e. v = -v) in COBJMeshFileLoader.cpp:585 (version 1.4.2), causing typical v coordinates to lie outside the 0-1 range. Consequently, non-wrapping texturing modes will cause unexpected results/problems when used on OBJ meshes. This can also be problem for complex uv-manipulating shaders. Please note that this implementation differs from, for example, C3DSMeshFileLoader.cpp:987, which flips (i.e. v = 1-v) the v component.

A simple fix, then, would be to change COBJMeshFileLoader.cpp:585 from:
vec.Y=-core::fast_atof(wordBuffer); // change handedness
to:
vec.Y=1-core::fast_atof(wordBuffer); // change handedness



Giliam
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Wow, one of the last minute bug fixes for 1.5. Should make it into the release :)
Note that I changed the method name as well, as this inversion is only possible for texcoords, not for usual 2d vectors...
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Welcome to the community! Can I get you a beer? 3DModellerGuy, get this man a beer.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply