Page 7 of 9

Re: New model utilities

Posted: Tue Dec 06, 2011 11:48 am
by Staer9
Ok, I'm converting the models for my shipset (using obj2dattex.py) and three of them (namely the cat_body, python_cc_body and python_cc_eng) are refusing to convert, giving me this error:

Code: Select all

converting...
['cat_body.obj']
cat_body.obj->cat_body.dat
going to open material library file: cat_body.mtl
Material default_cat3.png -> cat3.png
Traceback (most recent call last):
     File "C:\models\Obj2DatTex.py', line 137, in <module>
          textureName = tokens[1]
IndexError: list index out of range
whats going wrong and how can I fix it?

Re: New model utilities

Posted: Wed Dec 07, 2011 8:34 am
by MiMoriarty
Ok, I'm converting the models for my shipset (using obj2dattex.py) and three of them (namely the cat_body, python_cc_body and python_cc_eng) are refusing to convert, giving me this error:
Code:
converting...
['cat_body.obj']
cat_body.obj->cat_body.dat
going to open material library file: cat_body.mtl
Material default_cat3.png -> cat3.png
Traceback (most recent call last):
File "C:\models\Obj2DatTex.py', line 137, in <module>
textureName = tokens[1]
IndexError: list index out of range


whats going wrong and how can I fix it?
I'd the same mishappen yesterday. I went back to Blender, unpacked the png. Opened the proper png file again in UV View and repacked it. Then I overwrited the obj and mtl files 'et voilá' 8). It worked again.

Re: New model utilities

Posted: Wed Dec 07, 2011 9:15 am
by MiMoriarty
whats going wrong and how can I fix it?
I believe the problem it's, somehow, there're more than 1 image file packed into the mtl file.

Re: New model utilities

Posted: Wed Dec 07, 2011 11:11 am
by Staer9
MiMoriarty wrote:
I believe the problem it's, somehow, there're more than 1 image file packed into the mtl file.
Generally Blender doesn't have a problem with that, I've made models with more than 8 textures reffed to the image and they have still exported/converted fine. Upon closer examination these particular models also had specular maps set up in blender (so I could blender-render them to get a better veiw of what they look like) Upon removing that second map as you suggested it has all gone smoothly, Cheers!

Re: New model utilities

Posted: Wed Dec 07, 2011 11:54 am
by MiMoriarty
Generally Blender doesn't have a problem with that
The problem wasn't Blender. I believe it's the Obj2DatTex.py whose is not able to convert obj+mtl files with more than 1 texture file packed but i'm not really sure about that because i'm not programer. :oops:

Re: New model utilities

Posted: Fri Feb 17, 2012 11:18 pm
by Frame
MiMoriarty wrote:
Generally Blender doesn't have a problem with that
The problem wasn't Blender. I believe it's the Obj2DatTex.py whose is not able to convert obj+mtl files with more than 1 texture file packed but i'm not really sure about that because i'm not programer. :oops:
obj2datTex.py converts models with many textures just fine..

The error must lie somewhere else.

Re: New model utilities

Posted: Sat Apr 21, 2012 6:48 am
by mandoman
Does anyone know how to fix the model in Blender so that it snaps to a background grid, no matter which angle you choose? I can't seem to figure it out, but I somehow had my models so they would snap right to a grid behind, whether it was front, back, left, right, or up, down. As it is now, when I choose one of those viewpoints, there is no background grid, and the model doesn't even appear to be centered. Kind of confusing, and much harder to get models centered correctly. Any suggestions?

Re: New model utilities

Posted: Wed Jul 04, 2012 7:44 am
by Griff
I get some odd lighting issues ingame when i convert a model with the Obj2DatTexNorm.py script, i haven't quite worked out why it's happening, but it seems to be faces that point along a certain axis, the X axis i think, they switch instantly from being unlit to being fully lit without any in-between stages. Is this being caused by modelling crapness on my behalf, or something in the script that's getting the average normal wrong when it groups a few polygons together that face along the X axis (and possibly only X+ )?
I noticed it on a cargo pod model i was workng on, the 5 point polygon 'ends' had the problem whilst the cylinder sides were OK, i tried a few things such as putting a central vertex 'pole' in the end polygon and connecting it to the edges like this
Image
but it didn't help (plus i also made sure all points were aligned so that all the end polygons were 'flat')

Re: New model utilities

Posted: Wed Jul 04, 2012 10:05 am
by Staer9
I've never used obj2dattexnorm.py, so I can't help with that, but when I made a similar shaped cylindrical thing (that funky fuel station from a while back) it worked fine using just the obj2dattex.py, so try using that and see if the problems remain. (btw, this would also be caused if you made a high-poly model and baked the normals to the low poly one if the high-poly one had a flipped normal, however you have explaned how you make normal maps and it's not like this...)

Re: New model utilities

Posted: Wed Jul 04, 2012 10:36 am
by Griff
Yeah, it seems to work ok with obj2dattex.py but i'm not sure if that script supports setting hard/soft edges on the model prior to export- i'm using the smooth=true option in oolite and the hard edges are great for controling how the light moves across the ship

Re: New model utilities

Posted: Wed Jul 04, 2012 11:15 am
by Eric Walch
obj2DatTex.py will also convert the smoothing groups correctly.

Re: New model utilities

Posted: Fri Jul 13, 2012 8:20 pm
by JensAyton
Obj2DatTexNorm.py has been maintained™.
  • Fixed a nasty bug where trailing zeros in integers were removed.
  • When a face’s winding is changed (in any winding mode), the texture coordinates are no longer messed up.
  • Added new option to flip normals independently of winding mode.
  • Options are now set through a friendly command-line interface instead of by changing the script. There’s even a --help option. Welcome to the nineteen-seventies, gentlemen.
For example, to create an “inside-out” object to use as a dock, use:
./Obj2DatTexNorm.py --winding-mode 1 --flip-normals myDock.obj

Testing is very welcome, as are bug reports for files that don’t convert well with this version. For a failure report to be useful, it must include the OBJ file causing the problem, its associated MTL file, and preferably the original Wings/Blender/whatever file and textures.

Download: Edit: Python 2.7 is required.

Re: New model utilities

Posted: Mon Jul 16, 2012 6:51 pm
by Griff
Does this maintenance version of the script need a particular version of python? i've got version 2.6 installed on a windows 7 pro 64 bit PC and when i try and convert a model using

Code: Select all

Obj2DatTexNorm.py barellhardsoft.obj
i just get this error

Code: Select all

Traceback (most recent call last):
File "C:\Conv\Obj2DatTexNorm.py", line 20, in (module)
       import argparse
ImportError: No module named argparse
same thing happens if i try adding some of the new options
eg
Obj2DatTexNorm.py --winding-mode 1 --flip-normals barellhardsoft.obj


Edit: Works now - updated my version of python from 2.6 to 2.7.3 :D

Re: New model utilities

Posted: Mon Jul 16, 2012 7:22 pm
by Griff
I'm still seeing lighting issues on surfaces facing the X axis
here's a zip containing the model in .wings format with hard/soft edges marked and also the .obj format of the model exported from wings
and a test oxp containing the obj converted to .dat with Obj2DatTexNorm.py "The particular version described in this post" version from the post above. The test oxp has a script to spawn 10 barrels outside the station on launch, have a look at them spinning in space, the end caps switch instantly from dark to light
https://www.box.com/s/63feb7453a7ecb8676da

Re: New model utilities

Posted: Mon Jul 16, 2012 8:34 pm
by JensAyton
The normals in the converted model are correct, and the sudden switching goes away if I turn off shaders, so I’m going to dispute that this particular problem is my fault.

However, in verifying this i found a severe bug in winding mode 2 (the default) which is now fixed.

Download: Python 2.7 required.