SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 12-03-13, 05:59 PM   #31
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

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.


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.

Last edited by Madox58; 12-03-13 at 06:31 PM.
  Reply With Quote
Old 12-03-13, 06:35 PM   #32
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,215
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by privateer View Post
gap has a copy of the Sorter and I'm sure he is just waiting to get started.
Sure, you can bet on it

Quote:
Originally Posted by privateer View Post
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 View Post
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
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 12-03-13, 06:48 PM   #33
Targor Avelany
Ace of the Deep
 
Join Date: Jan 2010
Location: Vancouver, BC, Canada
Posts: 1,183
Downloads: 225
Uploads: 0


Default

what is the logic behind calculations for edited mtls? or does the Sorter does it atm?
Targor Avelany is offline   Reply With Quote
Old 12-03-13, 06:52 PM   #34
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

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..........
  Reply With Quote
Old 12-03-13, 06:53 PM   #35
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Quote:
Originally Posted by Targor Avelany View Post
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.
  Reply With Quote
Old 12-03-13, 06:58 PM   #36
Targor Avelany
Ace of the Deep
 
Join Date: Jan 2010
Location: Vancouver, BC, Canada
Posts: 1,183
Downloads: 225
Uploads: 0


Default

Quote:
Originally Posted by privateer View Post
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
Targor Avelany is offline   Reply With Quote
Old 12-03-13, 06:59 PM   #37
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Do one filter on this mesh!!
Select filters, go down to texture, select Perwedge to pervertex UV.
  Reply With Quote
Old 12-03-13, 07:04 PM   #38
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Quote:
Originally Posted by Targor Avelany View Post
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.
  Reply With Quote
Old 12-03-13, 07:12 PM   #39
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,215
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by privateer View Post
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

@ 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/
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 12-03-13, 07:14 PM   #40
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Once you 'filter' do a 'save as' and select wavefront obj.
Your export options need to look like this.
Notice 'color' selected for face?

  Reply With Quote
Old 12-03-13, 07:20 PM   #41
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,215
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by privateer View Post
Do one filter on this mesh!!
Select filters, go down to texture, select Perwedge to pervertex UV.
Quote:
Originally Posted by privateer View Post
Once you 'filter' do a 'save as' and select wavefront obj.
Your export options need to look like this.
Notice 'color' selected for face?
Is that all we need to do in meshlab before using your sorter?

I need to make some cleaning on my HD: I only have 54.4 GB of free space, and meshlab require 54.3
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 12-03-13, 07:20 PM   #42
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Quote:
Originally Posted by gap View Post
I also guess that we should have as many newmtl statements as the different materials used on our models
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.
  Reply With Quote
Old 12-03-13, 07:25 PM   #43
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Quote:
Originally Posted by gap View Post
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!

Then to use just some source the licenses became more then I was willing to mess with. Easier to write my own sorter.
  Reply With Quote
Old 12-03-13, 07:38 PM   #44
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,215
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by privateer View Post
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!

Then to use just some source the licenses became more then I was willing to mess with. Easier to write my own sorter.
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?
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 12-03-13, 07:46 PM   #45
Madox58
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

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!

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.


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.
  Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:15 PM.


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.