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)
-   -   GR2 Editor/Viewer/Extractor/Importer (https://www.subsim.com/radioroom/showthread.php?t=188290)

TheDarkWraith 02-02-14 11:38 AM

Quote:

Originally Posted by gap (Post 2170618)
Have you looked into why, once imported with your application, the baloon gets so many 'redundand' vertices? Looking in its UV map, I have spotted a few unwelded vertices which can be optimized before importing, but they evidently can't be the one reason for the many tangents/binormals displayed by your application for each vertex.

P.S: what is the exact meaning of the 'calculate' button in the meshes tab? IIRC, it says something about normals, but clicking on it does nothing apparently...

I explained the redundant vertices many posts ago. The Granny way needs a vertex for every set of unique uvs. That's not necessarily a Granny thing either as DirectX needs the same.

OBJ files are 'compressed' by listing all of the common vertices in the v section, the common normals in the vn section, and the common uvs in the vt section. The faces (f) section then links all of these together to create vertices. There is hardly ever a 1:1 ratio between all of these (3DS Max can export to a 1:1 ratio).

In your 3D modeling program you have a geometry visible on the screen. Each vertice that you see on the screen may actually be multiple vertices. Why multiple vertices? Might have 2 or more textures at that same point (thus needing 2+ unique sets of uvs). When you export this geometry that's visible the app will see that their are vertices that have the same positional data but different uv data. The app will export just one vertice (v) but 2 uvs (vt). If the normals are different between those vertices then it will export 2 normals (vn). Here is why I said OBJ files are 'compressed' earlier.

My app is now smart enough when reading in OBJ files to see that their are 2+ uvs (vt) referencing the same vertice (v) and thus will create clone(s) of the vertice (v) to properly render the geometry.

Clicking the Calculate button will have the app recompute the binormals and tangents of the currently selected mesh (if it has either/both). It appears to do nothing but it does do something :up:

gap 02-02-14 12:19 PM

Quote:

Originally Posted by TheDarkWraith (Post 2170762)
In your 3D modeling program you have a geometry visible on the screen. Each vertice that you see on the screen may actually be multiple vertices. Why multiple vertices? Might have 2 or more textures at that same point (thus needing 2+ unique sets of uvs). When you export this geometry that's visible the app will see that their are vertices that have the same positional data but different uv data. The app will export just one vertice (v) but 2 uvs (vt). If the normals are different between those vertices then it will export 2 normals (vn). Here is why I said OBJ files are 'compressed' earlier.

That is clear. What I don't get, is why one vertex at the center of a 'continuous' UV region (as I undesrtand it, that shoul be equal to 'same UV data'), is split in two or more vertices. Currently, it looks like -after porting from obj to granny format- every vertex is repeated as many times as the number of polygons sharing it. In other words, every polygon is handled as a distinct geometry, no matter if it got the same UV data as adjacet polygons or not. :hmm2:

Quote:

Originally Posted by TheDarkWraith (Post 2170762)
Clicking the Calculate button will have the app recompute the binormals and tangents of the currently selected mesh (if it has either/both). It appears to do nothing but it does do something :up:

Aren't tangents and binormals calculated automatically each time a new mesh is imported? What is the use of caalculating them again? :88)

TheDarkWraith 02-02-14 02:17 PM

Quote:

Originally Posted by gap (Post 2170775)
That is clear. What I don't get, is why one vertex at the center of a 'continuous' UV region (as I undesrtand it, that shoul be equal to 'same UV data'), is split in two or more vertices. Currently, it looks like -after porting from obj to granny format- every vertex is repeated as many times as the number of polygons sharing it. In other words, every polygon is handled as a distinct geometry, no matter if it got the same UV data as adjacet polygons or not. :hmm2:



Aren't tangents and binormals calculated automatically each time a new mesh is imported? What is the use of caalculating them again? :88)

Couldn't tell you why the 3D app you used had multiple vertices with different UV data. I just read the OBJ file and react accordingly. It's something with the way the object was exported with the 3D modeling app and/or how it's UV mapping was done.

Yes tangents and binormals are calculated automatically each time a new mesh is imported (if they are in the vertex declaration). That button is there to force the calculation (such as on SH5's GR2s).

I haven't finished this feature yet but I'm coding in the ability to modify a vertex's normal with the app (using the mouse). You select the vertex and turn on display normals. Then if you grab the end of the normal you can move it with the mouse. This will allow fine tuning of the normals :up: Then after you modify the normal the app will have to calculate the new binormal and tangent since they are based on the normal.

gap 02-02-14 03:30 PM

Quote:

Originally Posted by TheDarkWraith (Post 2170824)
Couldn't tell you why the 3D app you used had multiple vertices with different UV data. I just read the OBJ file and react accordingly. It's something with the way the object was exported with the 3D modeling app and/or how it's UV mapping was done.

Okay, I will mess with different applications and inform you in case I find anything interesting about UV coordinates.

Quote:

Originally Posted by TheDarkWraith (Post 2170824)
Yes tangents and binormals are calculated automatically each time a new mesh is imported (if they are in the vertex declaration). That button is there to force the calculation (such as on SH5's GR2s).

I haven't finished this feature yet but I'm coding in the ability to modify a vertex's normal with the app (using the mouse). You select the vertex and turn on display normals. Then if you grab the end of the normal you can move it with the mouse. This will allow fine tuning of the normals :up: Then after you modify the normal the app will have to calculate the new binormal and tangent since they are based on the normal.

:up:

TheDarkWraith 02-02-14 08:05 PM

v1.1.434.1 released. See post #1

- Fixed memory leaks found
- More optimizations done to decrease loading/save time
- everything else mentioned in the previous posts since last version was released

gap 02-03-14 04:15 AM

Quote:

Originally Posted by TheDarkWraith (Post 2170919)
v1.1.434.1 released. See post #1

- Fixed memory leaks found
- More optimizations done to decrease loading/save time
- everything else mentioned in the previous posts since last version was released

Thank you TDW :)

tonschk 02-03-14 04:29 AM

Amazing :sunny: Thank you

Quote:

Originally Posted by TheDarkWraith (Post 2170919)
v1.1.434.1 released. See post #1

- Fixed memory leaks found
- More optimizations done to decrease loading/save time
- everything else mentioned in the previous posts since last version was released


TheDarkWraith 02-03-14 09:59 PM

Quote:

Originally Posted by tonschk (Post 2171008)
Amazing :sunny: Thank you

Long time ago I tried to make the app multi-threaded but had many problems with it. I finally figured out my multi-threading issues :rock:

Before I would read everything sequentially and in sequential order. For instance: read all Textures and read each texture of those Textures one at a time. When done reading Textures then read all Materials reading each one at a time. That worked ok but loading times were really lousy.

Now I still read everything sequentially (Textures then Materials then ...) but in each section (Textures, Materials, etc.) I spawn off additional threads equal to the number of items in the section thus achieving a parallel read of all the items of the section.

I did this for the PrimaryVertexData and the Meshes so far and the results are excellent :D Loading the Bunker.GR2 on my home system takes ~11.3 seconds using the old method. Using the multi-threaded method reduced the loading time to ~8.0 seconds. That's a 30% reduction in loading time :yeah: I have an 8 core AMD processor so the total number of concurrent threads (that's ALL threads currently defined in the OS) that can be running at any time is 8 (even though 40 threads are spawned when the PrimaryVertexData is read in a max of 8 will be 'running' at any time.) . The more CPUs and the more cores each CPU has then the lower the loading time will be. Intel processors will have a much faster loading time due to their hyper-threading (they can run more than 1 thread per core on each processor and they have a higher IPC than AMD).

Now I haven't even done any optimizations on the multi-threading yet (like having the PrimaryVertexData spawn additional threads for the vertices). This was just a trial run to see if I finally fixed the multi-threaded problem I was having a long time ago.

tonschk 02-04-14 05:15 AM

increasing the performance of the GR2 Editor :sunny::yeah: Very good

Quote:

Originally Posted by TheDarkWraith (Post 2171338)
Loading the Bunker.GR2 on my home system takes ~11.3 seconds using the old method. Using the multi-threaded method reduced the loading time to ~8.0 seconds. That's a 30% reduction in loading time :yeah:


tonschk 02-06-14 12:43 AM

Hi there, please can you tell me how to zoom this mesh/texture view of the tower ?, thank you :up:

http://i194.photobucket.com/albums/z...ps1b20f5b9.png

TheDarkWraith 02-06-14 08:09 AM

Quote:

Originally Posted by tonschk (Post 2172000)
Hi there, please can you tell me how to zoom this mesh/texture view of the tower ?, thank you :up:

press H to bring up the help menu. Then press M to view the mouse commands.

You'll see that if you right click and hold and move the mouse forward/backward you can zoom.

You can also use the arrows on the numpad to 'walk' fwd/bckwd/left/right.

gap 02-16-14 11:23 AM

Hi TDW,

how hard would be the (temporary) merging of two GR2 files in your application? I make myself clear: one of the major differences among SHIII-IV sea units and SH5 ones, is that most general effects are linked to the bones of a second GR2 file (*_FX.GR2) which gets "overlayed" in game to the main GR2 file. By looking into several *_FX.GR2 files, I have noticed that their bones follow roughly the profile of the model they apply to. Should we create a new GR2 ship, we would be forced to move her FX nodes blindly though. The task would be much easier if we could preview the 3d model (of the main GR2 file) over the nodes (of her FX GR2). :hmmm:

TheDarkWraith 02-16-14 11:28 AM

Quote:

Originally Posted by gap (Post 2175370)
Hi TDW,

how hard would be the (temporary) merging of two GR2 files in your application? I make myself clear: one of the major differences among SHIII-IV sea units and SH5 ones, is that most general effects are linked to the bones of a second GR2 file (*_FX.GR2) which gets "overlayed" in game to the main GR2 file. By looking into several *_FX.GR2 files, I have noticed that their bones follow roughly the profile of the model they apply to. Should we create a new GR2 ship, we would be forced to move her FX nodes blindly though. The task would be much easier if we could preview the 3d model (of the main GR2 file) over the nodes (of her FX GR2). :hmmm:

The app supports LNK entries and prt files. If the app needs to load additional files in it will as long as the options are set to do this.

You can see this effect when loading any player's sub (if the options are set to do it) :up:

gap 02-16-14 11:47 AM

Quote:

Originally Posted by TheDarkWraith (Post 2175375)
The app supports LNK entries and prt files. If the app needs to load additional files in it will as long as the options are set to do this.

You can see this effect when loading any player's sub (if the options are set to do it) :up:

Yep, I know it, but how can I preview a ship model while I am editing its FX.GR2 file? :doh:

TheDarkWraith 02-16-14 11:50 AM

Quote:

Originally Posted by gap (Post 2175382)
Yep, I know it, but how can I preview a ship model while I am editing its FX.GR2 file? :doh:

Open both of them up with the app at the same time. The app does allow you to open multiple GR2 files at once.


All times are GMT -5. The time now is 12:09 AM.

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