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 01-23-14, 08:08 AM   #1
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post

Granny is a little inefficient (if you want to call it this) in the way it treats vertices. If you export any mesh from any of the SH5 GR2s you'll notice that it has a LOT of vertices defined. Why you may ask? Every vertice in Granny has it's own texture coordinate and might also have a normal defined. If a vertice has the same position data but different texture data then Granny needs another vertice for it.

Your barrage balloon has been optimized in it's vertices. By optimized I mean if two vertices were found to have the same positional data then the 'duplicate' was discarded. This is not good for Granny!

I had the importer track all the indices defined and if a duplicate indice was found then it checked to see if the texture coordinates were different for the two. What I found was what I thought: the indices are defining two vertices (it's actually the same index in the vertices) that have the same positional data but different texture data. My importer is then overwriting the vertices existing texture data (which was previously defined) with new texture data. This makes it appear that texture data is all hosed up.

How to fix? What I have to do is when a duplicate vertice is found (face definition defines a vertex index that has already been used) I have to clone it.
It makes perfect sense, but why 3ds max exports of the same ballon model, whose vertices are also optimized, are imported correctly by GR2 Editor?

Please have a look to the obj files below (kindly provided by Targor Avelany) to know what I mean:

https://www.mediafire.com/?2l6uew8aqxebk2y
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 01-23-14, 08:38 AM   #2
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by gap View Post
It makes perfect sense, but why 3ds max exports of the same ballon model, whose vertices are also optimized, are imported correctly by GR2 Editor?

Please have a look to the obj files below (kindly provided by Targor Avelany) to know what I mean:

https://www.mediafire.com/?2l6uew8aqxebk2y
Look at the OBJ files produced by 3DS Max and compare them to the ones made by Wings 3D. It's really easy to spot why the 3DS Max ones work correctly. Here is an excerpt from the 3DS Max one:

g balloon_Balloon
usemtl _balloon_MkVII_4Balloon
s 1
f 1/1/1 2/2/2 3/3/3
f 1/1/1 4/4/4 5/5/5
f 3/3/3 6/6/6 7/7/7
f 3/3/3 4/4/4 1/1/1
f 3/3/3 8/8/8 4/4/4
f 3/3/3 9/9/9 8/8/8
f 7/7/7 6/6/6 10/10/10
f 7/7/7 9/9/9 3/3/3
f 10/10/10 9/9/9 7/7/7
f 10/10/10 11/11/11 9/9/9
f 5/5/5 2/2/2 1/1/1
f 5/5/5 12/12/12 2/2/2

Look how everything is a 1:1 ratio (vertices are not optimized). This one is ready for import into a GR2 file. Check the Wings3D one and you'll see that there is no 1:1 ratio (it's very evident). It's not Granny friendly. Do you see what I'm talking about?

Last edited by TheDarkWraith; 01-23-14 at 09:03 AM.
TheDarkWraith is offline   Reply With Quote
Old 01-23-14, 09:05 AM   #3
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
Look at the OBJ files produced by 3DS Max and compare them to the ones made by Wings 3D. It's really easy to spot why the 3DS Max ones work correctly. Here is an excerpt from the 3DS Max one:

g balloon_Balloon
usemtl _balloon_MkVII_4Balloon
s 1
f 1/1/1 2/2/2 3/3/3
f 1/1/1 4/4/4 5/5/5
f 3/3/3 6/6/6 7/7/7
f 3/3/3 4/4/4 1/1/1
f 3/3/3 8/8/8 4/4/4
f 3/3/3 9/9/9 8/8/8
f 7/7/7 6/6/6 10/10/10
f 7/7/7 9/9/9 3/3/3
f 10/10/10 9/9/9 7/7/7
f 10/10/10 11/11/11 9/9/9
f 5/5/5 2/2/2 1/1/1
f 5/5/5 12/12/12 2/2/2

Look how everything is a 1:1 ratio (vertices are not optimized). Check the Wings3D one and you'll see that there is no 1:1 ratio (it's very evident).
Yep, but when I open the 3ds Max obj file in Wings3d, the duplicated vertices are apparently not there. Moreover, if I re-export those meshes, their UV map is broken again by GR2 Editor.

Maybe Max uses a special format for those vertices which is recognized by Wings, and redundant vertices (for Wings) are merged automatically on importing them?

The same does not apply to S3d/GR2 Editor obj exports. When inported in Wings3d, I can clearly see that meshes have been cut along the perimeter of their UV zones.
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 01-23-14, 09:12 AM   #4
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by gap View Post
Yep, but when I open the 3ds Max obj file in Wings3d, the duplicated vertices are apparently not there. Moreover, if I re-export those meshes, their UV map is broken again by GR2 Editor.

Maybe Max uses a special format for those vertices which is recognized by Wings, and redundant vertices (for Wings) are merged automatically on importing them?
Just looking over the OBJ exports from Wings3D shows that it's doing some kind of optimization on your model. It clearly is removing duplicate vertices either by welding them together or just completely throwing them out.

I don't think 3DS Max is using any kind of special format. It just has no problem with duplicate vertices. It's very Granny friendly

I've used Wings3D in the past and had no problems with importing the OBJ files from it so there is something 'different' with your model. Once I get back home today I'll code in the cloning of duplicate vertice indexes found in the importer and I can almost guarantee it will fix the problem with your model.
TheDarkWraith is offline   Reply With Quote
Old 01-23-14, 09:25 AM   #5
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
Just looking over the OBJ exports from Wings3D shows that it's doing some kind of optimization on your model. It clearly is removing duplicate vertices either by welding them together or just completely throwing them out.

I don't think 3DS Max is using any kind of special format. It just has no problem with duplicate vertices. It's very Granny friendly
I think I know what is happening: Wings3d welds automatically redundant vertices within the same geometry (as it is the case of the Max-exported balloon). On the contrary, it keeps coinciding vertices, if they are located in different geometries combined together (as for S3d/GR2E obj files).
If you are familiar with Wings you know what I mean

Quote:
Originally Posted by TheDarkWraith View Post
I've used Wings3D in the past and had no problems with importing the OBJ files from it so there is something 'different' with your model.
As far as I can see it all depends on the complexity of the UV mapping. If you set few UV zones, or if the texture one is using is relatively uniform, you won't ever spot the mistakes, if any.

Quote:
Originally Posted by TheDarkWraith View Post
Once I get back home today I'll code in the cloning of duplicate vertice indexes found in the importer and I can almost guarantee it will fix the problem with your model.
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 01-23-14, 04:34 PM   #6
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by gap View Post
I think I know what is happening: Wings3d welds automatically redundant vertices within the same geometry (as it is the case of the Max-exported balloon). On the contrary, it keeps coinciding vertices, if they are located in different geometries combined together (as for S3d/GR2E obj files).
If you are familiar with Wings you know what I mean



As far as I can see it all depends on the complexity of the UV mapping. If you set few UV zones, or if the texture one is using is relatively uniform, you won't ever spot the mistakes, if any.
Like I said earlier, if I clone vertices that are duplicated in the OBJ file the results speak for themselves:


This was your Wings3D OBJ barrage balloon imported into Iceberg01
TheDarkWraith is offline   Reply With Quote
Old 01-23-14, 05:10 PM   #7
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

v1.1.403.1 released. See post #1

This version enhances the loose importer. If an OBJ file has indices that define a vertex more than once then for every indice for that vertex after the first the importer will clone that vertex thus keeping a 1:1 ratio (Granny friendly).

The strict importer will NOT do this. After all it's a strict import and the vertices defined in the OBJ file must equal the number of vertices defined in the mesh.
TheDarkWraith is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 04:42 PM.


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