Python model converters

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

Moderators: another_commander, winston

User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Python model converters

Post by gsagostinho »

Quick question concerning the Python model converters: I want to modify a .dat model which uses several textures, but I can't convert it into an .obj file while keeping the same textures applied to the model. Do I need to import it without any textures and then manually re-UV-map it?
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: Python model converters

Post by gsagostinho »

Or rephrasing it: what is the best workflow to alter someone else's .dat model using Wings3D, which may use more than one single texture?
User avatar
Stormrider
Deadly
Deadly
Posts: 239
Joined: Sat Jan 25, 2014 2:35 am
Location: At work

Re: Python model converters

Post by Stormrider »

The UV layout is preserved so you should be able to apply the same textures once you convert the model back to a .dat, but any modified faces of the model that don't match up with the original UV layout may not be textured properly.
I converted a model, loaded it into wings, made a modification, then exported it. I had to edit the .dat to get it to use the old texture, down near the bottom of the file I changed:

Code: Select all

NAMES 1
0
to the original texture:

Code: Select all

NAMES 1
witchfire-saloon-33.png
Defiantly got some distortion but I really enlarged a few surfaces next to the dock:
Image
Unless you are going to make any drastic changes to existing faces or add new ones it seems to work.
Image
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: Python model converters

Post by gsagostinho »

Hi Stormrider, thanks for the reply!
Stormrider wrote:
The UV layout is preserved so you should be able to apply the same textures once you convert the model back to a .dat, but any modified faces of the model that don't match up with the original UV layout may not be textured properly.
Yes, that is exactly my problem: unfortunately my case is complicated because I am adding new faces to the model, but also because this model uses more than one texture. I so much wished there was a trivial way of editing this, having to use these conversion tools and running into all these problems is so off putting for someone just starting out with 3D modelling :(
User avatar
cbr
---- E L I T E ----
---- E L I T E ----
Posts: 1385
Joined: Thu Aug 27, 2015 4:24 pm

Re: Python model converters

Post by cbr »

imagine a thin person -> mr bean

you are adding/inserting large protruding objects into mr bean, how does mr beans skin behave?

you are lucking if you can use the existing uv map ( with small changes ), i think you have to make a new uv map when making many big changes,
you can make the new additions into a new model itself, make a new uvmap/texture for the new model and 'add' as a subentity

think of it as skin, if you move your nosebone to your chin does the noseskin automatically move with it?

:)
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: Python model converters

Post by gsagostinho »

@cbr I understand that, but what I actually called frustrating is how cumbersome is the process of converting dat <-> obj and how those Python converters do not handle objects with more than one texture, not the fact that adding faces result require a new UV-map. The issue is that, if I understand correctly, there is a limitation with those Python conversion programs that make you have to either import dat models that use one single texture or import a dat model ignoring textures. And then there is the cumbersome workflow for editing an existing model: dat -> obj, import obj and save as wing, export it back as obj, convert back to dat, perhaps edit it manually as to add the textures back to the file. :cry:
User avatar
cbr
---- E L I T E ----
---- E L I T E ----
Posts: 1385
Joined: Thu Aug 27, 2015 4:24 pm

Re: Python model converters

Post by cbr »

Perhaps you could rephrase your frustations with the different tools into one simple question, somebody could know a solution, a tool or a script which could help you.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: Python model converters

Post by gsagostinho »

cbr wrote: Sun Jul 30, 2017 9:27 pm
Perhaps you could rephrase your frustations with the different tools into one simple question, somebody could know a solution, a tool or a script which could help you.
My apologies. My question is: what is a reasonable workflow to edit an DAT model using Wings3D when the DAT model in question uses more than one texture and therefore can only be converted into OBJ by ignoring all textures? Is there an easy way of doing that?
User avatar
Stormrider
Deadly
Deadly
Posts: 239
Joined: Sat Jan 25, 2014 2:35 am
Location: At work

Re: Python model converters

Post by Stormrider »

gsagostinho wrote:
Yes, that is exactly my problem: unfortunately my case is complicated because I am adding new faces to the model,
I think you will have to create a new UV map then. I am not sure if there is a way to add new faces to an existing UV layout in wings without creating a new UV map. If the new faces aren't on the UV map they won't get textured at all.
gsagostinho wrote:
obj and how those Python converters do not handle objects with more than one texture,
I believe this is more of a limitation of the OBJ file, I have read that they only support one material so the python converter will only apply that to the model in the conversion process.
gsagostinho wrote:
I understand that, but what I actually called frustrating is how cumbersome is the process of converting dat <-> obj and how those Python converters do not handle objects with more than one texture, not the fact that adding faces result require a new UV-map. The issue is that, if I understand correctly, there is a limitation with those Python conversion programs that make you have to either import dat models that use one single texture or import a dat model ignoring textures. And then there is the cumbersome workflow for editing an existing model: dat -> obj, import obj and save as wing, export it back as obj, convert back to dat, perhaps edit it manually as to add the textures back to the file.
Your frustration is understandable but its not really the converters, I have the same issues with OBJ files exported from one model utility and imported into another, eg makehuman ->blender (no conversion software involved).
Please don't give up, the texture packs you created look awesome.
Image
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: Python model converters

Post by Commander_X »

gsagostinho wrote: Sun Jul 30, 2017 9:35 pm
My apologies. My question is: what is a reasonable workflow to edit an DAT model using Wings3D when the DAT model in question uses more than one texture and therefore can only be converted into OBJ by ignoring all textures? Is there an easy way of doing that?
If you can point me to such a model you want to deal with, I can show you what Blender can do with the converted DAT file. I had some tweaks made on the python conversion scripts, and they might fit your needs.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: Python model converters

Post by gsagostinho »

@Stormrider Thanks for the answer and for the info, Stormrider, I really appreciate it. I will continue taking a look at this, let's see how it goes :)

@Commander_X Many, many thanks. Well, I am trying to increase the poly count of the asteroid part of the new Imperial Astrofactory. You can download the latest version using the in-game extension manager.
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: Python model converters

Post by Commander_X »

Well here are some quick results of how the station looks in Blender:
matcap
Image

textured
Image

I didn't put too much effort into materials for the textured version, I mainly split the UV from how Blender imports it.
Here is the version of the script I used for conversion. You'll definitely want to manually create the materials, and match the textures.
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: Python model converters

Post by Commander_X »

Ok, I looked back at the posts in this thread, and it seems that not the conversion was the culprit, but the modelling afterwards.

Unfortunately, the conversion back from the models in-game will result in triangulated meshes. That is a no-no for modelling/changing the model.
You will have to take your time and merge the triangles to quads following the layout of the UVs in order to be able to properly make changes to the model, otherwise you won't be able to reuse the original textures.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: Python model converters

Post by gsagostinho »

Unfortunately, the conversion back from the models in-game will result in triangulated meshes. That is a no-no for modelling/changing the model.
I do not understand what you mean, Commander_X. I am aware of what are triangle and quad meshes, but I don't understand what is a "no-no" regarding them. Wings3D can use either type of mesh, and I have successfully exported both types of mesh to Oolite. Could you explain this better to me?

Also, many many thanks for taking a look at this.
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: Python model converters

Post by Commander_X »

Here's a final quote from an answer to a similar question:
Quads at the assets creation level, and triangles at the engine level!
Post Reply