SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   [WIP] PIFT (https://www.subsim.com/radioroom/showthread.php?t=200794)

Madox58 12-03-13 05:59 PM

Well since I lost all the original code somehow? I've started over.
That's not all bad as I have figured out a few more things that I had overlooked before.

The most recent issue is with some obj files gap is working with.
The textures are getting destroyed so We started takeing a good hard look at the problem.

I'm convinced at this time that it's the way his tex co-ords and faces are being written to file. It confuses TDW's program and some information is being lost on import. I did 2 seperate work arounds to get an import that was good and I'm going to explain the best (IMO) of the 2.

There are limitations that we will need to work with by hand editing a few files for now. Those will be corrected once I get some more codeing done on the Sorter. It's good enuff to do what is needed for now but not finished yet.
It only sorts things into place where TDW's program expects to find them. A good example of this is to do an export from Meshlab and try to import that.

gap has a copy of the Sorter and I'm sure he is just waiting to get started.
:D

First a few things about Meshlab.
It does not like tga or dds files so have your textures also saved as jpg images. We also need to change the mtl file as it hates those also.
Here's an edited version that will work.


newmtl Balloon
Ka 0.200000 0.200000 0.200000
Kd 1.000000 1.000000 1.000000
Ks 1.000000 1.000000 1.000000
Tr 0.000000
illum 2
Ns 0.000000
map_Kd Barrage_Balloon.jpg

newmtl Rope
Ka 0.200000 0.200000 0.200000
Kd 0.850980 0.850980 0.850980
Ks 1.000000 1.000000 1.000000
Tr 0.000000
illum 2
Ns 0.000000
map_Kd Barrage_Balloon.jpg

Don't worry that it's different as we only use it for Meshlab so we get proper 'colors' when we export.

Future updates to the Sorter will pre-adjust any mtl files, send the info to Meshlab, grap and then sort the exported file.
You'll have no need to do all the editing we're doing now.

gap 12-03-13 06:35 PM

Quote:

Originally Posted by privateer (Post 2147711)
gap has a copy of the Sorter and I'm sure he is just waiting to get started.
:D

Sure, you can bet on it :03:

Quote:

Originally Posted by privateer (Post 2147711)
First a few things about Meshlab.

Do we need it for giving the sorted obj files the last touch-ups before importing them in GR2 editor?

Quote:

Originally Posted by privateer (Post 2147711)
It does not like tga or dds files so have your textures also saved as jpg images. We also need to change the mtl file as it hates those also.
Here's an edited version that will work.


newmtl Balloon
Ka 0.200000 0.200000 0.200000
Kd 1.000000 1.000000 1.000000
Ks 1.000000 1.000000 1.000000
Tr 0.000000
illum 2
Ns 0.000000
map_Kd Barrage_Balloon.jpg

newmtl Rope
Ka 0.200000 0.200000 0.200000
Kd 0.850980 0.850980 0.850980
Ks 1.000000 1.000000 1.000000
Tr 0.000000
illum 2
Ns 0.000000
map_Kd Barrage_Balloon.jpg

Don't worry that it's different as we only use it for Meshlab so we get proper 'colors' when we export.

Just for reference, I am posting here the content of the original mtl file:

Code:

newmtl Balloon
Ns 100.0
d 1.0
illum 2
Kd 1.0 1.0 1.0
Ka 0.6803199999999999 0.6803199999999999 0.6803199999999999
Ks 1.0 1.0 1.0
Ke 0.001 0.001 0.001
map_Kd Barrage_Balloon.tga

newmtl Rope
Ns 100.0
d 1.0
illum 2
Kd 0.85348 0.85348 0.85348
Ka 0.3673 0.3673 0.3673
Ks 0.001 0.001 0.001
Ke 0.0 0.0 0.0
map_Kd Barrage_Balloon.tga

newmtl default
Ns 100.0
d 1.0
illum 2
Kd 0.8333333333333334 0.7428571428571428 0.6444444444444445
Ka 0.8333333333333334 0.7428571428571428 0.6444444444444445
Ks 1.0 1.0 1.0
Ke 0.0 0.0 0.0


Targor Avelany 12-03-13 06:48 PM

what is the logic behind calculations for edited mtls? or does the Sorter does it atm?

Madox58 12-03-13 06:52 PM

Good point on showing the original mtl information.
Meshlab just will not read it and we need to import your file with textures to Meshlab BEFORE you use the Sorter as it is now.
You should see this..........
http://i108.photobucket.com/albums/n...034d09962a.jpg

Madox58 12-03-13 06:53 PM

Quote:

Originally Posted by Targor Avelany (Post 2147731)
what is the logic behind calculations for edited mtls? or does the Sorter does it atm?

Meshlab does not like the format.
Just like the GR2 importer/Exporter does not like some formats.
Limitations of the programs. We work around them for now.
:)

Targor Avelany 12-03-13 06:58 PM

Quote:

Originally Posted by privateer (Post 2147733)
Meshlab does not like the format.
Just like the GR2 importer/Exporter does not like some formats.
Limitations of the programs. We work around them for now.
:)

sorry, privateer, I guess I still have problems expressing my thought sometimes :)
What I meant was not the reason of why we doing it, but how :)

Madox58 12-03-13 06:59 PM

Do one filter on this mesh!!
Select filters, go down to texture, select Perwedge to pervertex UV.
http://i108.photobucket.com/albums/n...-Balloon-2.jpg

Madox58 12-03-13 07:04 PM

Quote:

Originally Posted by Targor Avelany (Post 2147734)
sorry, privateer, I guess I still have problems expressing my thought sometimes :)
What I meant was not the reason of why we doing it, but how :)

Ah, Yes Mate.
:)

Just copy paste what I posted to a new file safe from original files and rename it.
Create a new txt file, paste the info and save. Rename to 'whatever.mtl' and use it for Meshlab.
So if your original mtl file is Balloon.mtl? Name this one the same.
Then you only need to rename the textures in it to fit your textures.
Sorter will do all that later on.

gap 12-03-13 07:12 PM

Quote:

Originally Posted by privateer (Post 2147737)
Ah, Yes Mate.
:)

Just copy paste what I posted to a new file safe from original files and rename it.
Create a new txt file, paste the info and save. Rename to 'whatever.mtl' and use it for Meshlab.
So if your original mtl file is Balloon.mtl? Name this one the same.

I also guess that we should have as many newmtl statements as the different materials used on our models :hmm2:

@ Targor:

if you want to understand what each row is meant for, you might be interested in the following link:

http://paulbourke.net/dataformats/mtl/

the same for obj file format:

http://paulbourke.net/dataformats/obj/ :up:

Madox58 12-03-13 07:14 PM

Once you 'filter' do a 'save as' and select wavefront obj.
Your export options need to look like this.
Notice 'color' selected for face?
:D
http://i108.photobucket.com/albums/n...-Balloon-3.jpg

gap 12-03-13 07:20 PM

Quote:

Originally Posted by privateer (Post 2147736)
Do one filter on this mesh!!
Select filters, go down to texture, select Perwedge to pervertex UV.

Quote:

Originally Posted by privateer (Post 2147740)
Once you 'filter' do a 'save as' and select wavefront obj.
Your export options need to look like this.
Notice 'color' selected for face?
:D

Is that all we need to do in meshlab before using your sorter? :sunny:

I need to make some cleaning on my HD: I only have 54.4 GB of free space, and meshlab require 54.3 :doh:

Madox58 12-03-13 07:20 PM

Quote:

Originally Posted by gap (Post 2147739)
I also guess that we should have as many newmtl statements as the different materials used on our models :hmm2:

Right.
It's a limitation of Meshlab we're just working around for now.
One thing nice about Meshlab? It can be command line called.
So I can program to change the mtl, send all the files to Meshlab, have it do it's thing and export, then do the sort with you doing nothing aside from clicking cancel when the window pops back up.
:haha:

Madox58 12-03-13 07:25 PM

Quote:

Originally Posted by gap (Post 2147745)
Is that all we need to do in meshlab before using your sorter?

That's all. The only function we need is that filter.
At one time I was working on the source for Meshlab to have it export proper objs but you would not believe the hoops you need to jump through to get all the needed libraries to build!
:o
Then to use just some source the licenses became more then I was willing to mess with. Easier to write my own sorter.
:88)

gap 12-03-13 07:38 PM

Quote:

Originally Posted by privateer (Post 2147748)
That's all. The only function we need is that filter.
At one time I was working on the source for Meshlab to have it export proper objs but you would not believe the hoops you need to jump through to get all the needed libraries to build!
:o
Then to use just some source the licenses became more then I was willing to mess with. Easier to write my own sorter.
:88)

Okay, tomorrow I will free up some space on my hard drive (I guess I have too many SH files in my downloads folder), and I will make sure to follow your instructions step by step.

At this stage I just have a few questions:

- are we allowed to set more than one material per object? As I have told you before, after processing the balloon model with your sorter (without the meshlab part), Wings only saw one material used for the whole model, rather than the expected two materials. Did it happen because I had skipped the meshlab pre-processing, it is just Wings3d which can't read the sorted file properly, or what else?

- have you looked into smoothing groups already? GR2 editor can't process Wings3d-generated obj files containing smoothing groups but, as I have learned today from targor, it has not problems with smoothing groups exported in 3ds max.

- should we restore the original mtl file, after exporting from meshlab?

Madox58 12-03-13 07:46 PM

Open the obj you exported with Notepad or whatever you use to edit text files.
You'll see this structure.

vn 5.528841 -0.572654 0.029990
vt 0.701080 0.382580
v 5.194420 2.167730 -33.668861

TDW's program will puke that up on you faster then I can type!
:haha:
That's OK, We can work around it till he adjusts for that.
As I've said before. Once he adjusts his program? Mine should be depricated and no longer needed.
:up:

This is the point where we use the sorter as it is now.
It reads the file and writes a new file sorted into the order TDW expects.
It adds -sorted to the file name and is saved in the same folder as the original file for now.


All times are GMT -5. The time now is 03:13 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.