Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

New model utilities

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Staer9
---- E L I T E ----
---- E L I T E ----
Posts: 570
Joined: Fri Feb 18, 2011 4:53 pm
Location: Hatfield, Hertfordshire (poor industrial)

Re: New model utilities

Post 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?
Image
User avatar
MiMoriarty
Competent
Competent
Posts: 39
Joined: Mon Nov 14, 2011 1:03 pm
Location: Madrid, España
Contact:

Re: New model utilities

Post 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.
There is an art, it says, or rather, a knack to flying. The knack lies in learning how to throw yourself at the ground and miss. … Clearly, it is this second part, the missing, which presents the difficulties.
Blog http://mimoriarty.wordpress.com/
User avatar
MiMoriarty
Competent
Competent
Posts: 39
Joined: Mon Nov 14, 2011 1:03 pm
Location: Madrid, España
Contact:

Re: New model utilities

Post 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.
There is an art, it says, or rather, a knack to flying. The knack lies in learning how to throw yourself at the ground and miss. … Clearly, it is this second part, the missing, which presents the difficulties.
Blog http://mimoriarty.wordpress.com/
User avatar
Staer9
---- E L I T E ----
---- E L I T E ----
Posts: 570
Joined: Fri Feb 18, 2011 4:53 pm
Location: Hatfield, Hertfordshire (poor industrial)

Re: New model utilities

Post 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!
Image
User avatar
MiMoriarty
Competent
Competent
Posts: 39
Joined: Mon Nov 14, 2011 1:03 pm
Location: Madrid, España
Contact:

Re: New model utilities

Post 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:
There is an art, it says, or rather, a knack to flying. The knack lies in learning how to throw yourself at the ground and miss. … Clearly, it is this second part, the missing, which presents the difficulties.
Blog http://mimoriarty.wordpress.com/
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: New model utilities

Post 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.
Bounty Scanner
Number 935
User avatar
mandoman
---- E L I T E ----
---- E L I T E ----
Posts: 1375
Joined: Thu Apr 28, 2011 3:17 pm

Re: New model utilities

Post 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?
Mandotech Industries Wiki Page.

http://wiki.alioth.net/index.php/User:Mandoman
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: New model utilities

Post 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')
User avatar
Staer9
---- E L I T E ----
---- E L I T E ----
Posts: 570
Joined: Fri Feb 18, 2011 4:53 pm
Location: Hatfield, Hertfordshire (poor industrial)

Re: New model utilities

Post 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...)
Image
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: New model utilities

Post 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
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: New model utilities

Post by Eric Walch »

obj2DatTex.py will also convert the smoothing groups correctly.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: New model utilities

Post 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.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: New model utilities

Post 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
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: New model utilities

Post 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
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: New model utilities

Post 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.
Post Reply