Issue 214: Texture in obj files are not working
Status:  Done
Owner:
Closed:  Mar 2010
Reported by lovan...@hotmail.fr, Feb 16, 2010
in 3Dviewer, i remplace the .obj and .mtl by my project. I re-name it on
"monkey.obj & monkey.mtl"

Nothing more. I launch 3dviewer.py and i don't see my texture.


I run with PyMT 0.4 on Windows 7 32bits 


Please provide any additional information below.

monkey.rar
42.9 KB   Download
Mar 30, 2010
Project Member #1 txprog
See http://github.com/tito/pymt/commit/da892789eb74d33bc982f6f7181933ba918a715b

Fixed support of Texture in material : 
* space in filename
* texture load
* texture coordinates converted to valid tex_coord from texture

Can't test with monkey, the material used is not attached in the rar.

But i've been able to load & use :
* http://www.tox3d.com/Files/CoffeeTable1.zip
* http://www.tox3d.com/Products/3d-Models/Furnishings/TableWare/SoupBowl/SoupBowll1.zip


Status: Done
Owner: txprog
Labels: Milestone-0.4.1 OpSys-All Component-Core
Mar 30, 2010
#2 lovan...@hotmail.fr
how thanks!
I'll try tomorow! you has use blender for make this? i can see a new file: .pz3 and
.daz, it's importante file? how did u has creat that file? thanks in advance !
Mar 30, 2010
Project Member #3 txprog
I didn't add anything, this .pz3 and .daz are comming with the zip file.
It's another user that give me a link to tox3D. (only obj/mtl file are used)
Mar 30, 2010
#4 lovan...@hotmail.fr
so thanks! Maybe it's better to use a .fbx ? it's better of .obj (more complete file)
You didn't think same? 
Mar 30, 2010
#5 lovan...@hotmail.fr
hi, i've try with a new version, but no work with me. Sorry, no texture always..
I've add a new .mtl, .obj and texture .jpg, change a name of obj in 3Dviewer.py and
run. But its the same
Mar 30, 2010
#6 awa...@gmail.com
yep, same for me.
A
[WARNING] [Image   ] Unable to load image <plywoodclean.jpg>
/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/obj.py:153:
UserWarning: Could not load texture plywoodclean.jpg
  warnings.warn('Could not load texture %s' % values[1])
/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/obj.py:156:
UserWarning: Parse error in plywoodclean.jpg.
  warnings.warn('Parse error in %s.' % filename)
Traceback (most recent call last):
  File "3Dviewer.py", line 185, in <module>
    pymt_plugin_activate(w, ctx)
  File "3Dviewer.py", line 176, in pymt_plugin_activate
    ctx.mv = ModelViewer(size=(root.width,root.height))
  File "3Dviewer.py", line 73, in __init__
    self.model = bunny = OBJ(os.path.join(current_dir, 'coffeetable/CoffeeTable1.obj'))
  File "/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/obj.py", line
63, in __init__
    self.load_material_library(values[1])
  File "/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/obj.py", line
150, in load_material_library
    material.texture = pymt.Image(filename).texture
  File
"/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/core/image/__init__.py",
line 152, in __init__
    self.filename   = arg
  File
"/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/core/image/__init__.py",
line 209, in _set_filename
    self._filename, keep_data=self._keep_data)
  File
"/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/core/image/__init__.py",
line 96, in load
    im = loader(filename, **kwargs)
  File
"/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/core/image/__init__.py",
line 43, in __init__
    self._data      = self.load(filename)
  File
"/usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg/pymt/core/image/img_pygame.py",
line 34, in load
    im = pygame.image.load(filename)
pygame.error: Couldn't open plywoodclean.jpg
Mar 31, 2010
Project Member #7 txprog
You're still using the pymt version of EGG, (with easy_install).
You need to run on the latest git version !

=> /usr/local/lib/python2.6/dist-packages/PyMT-0.4-py2.6.egg
Remove this directory to ensure not running on packaged one.
Apr 1, 2010
#8 lovan...@hotmail.fr
i'will try with linux OS. With windows 32 bits, no error, working but, without
texture. And i don't find PyMT-0.4-py2.6.egg ... If you know more... Thanks in advence 
Jul 2, 2010
Project Member #9 txprog
(No comment was entered for this change.)
Labels: Milestone-0.5