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)

gap 03-02-14 12:23 PM

Quote:

Originally Posted by gap (Post 2180180)
I could clone the current AO meshes, and UV map them again for diffuse channel usage. Their UV map is much simpler, and re-arranging it wouldn't take too long. :know:

What do you think, it can work? :hmm2:

Quote:

Originally Posted by TheDarkWraith (Post 2180205)
Try it and see.

What you are striving for is the non-AO and the AO .obj files to be identical in regards to vertices defined (v), normals defined (vn), and face definitions defined (f) - except the UVs for the face definitions in the AO .obj file will be different.

When the app maps AO to non-AO the only thing it's 'bringing over' are the UVs defined in the AO .obj file. Thus it's critical the above matches between the two files.

It worked!
This is a GR2 Editor render of the bunker model, with diffuse and self illumination textures correctly mapped on it :yeah:

http://i519.photobucket.com/albums/u...o/bunker-1.jpg

The dark shadow on the bottom left corner is from the rocks in front of the bunker, not yet imported ;).
I have met two new problems though:

1 - When I check the 'render bounding box' and 'render bounding sphere' checkboxes in the mesh tab, neither of them is rendered for the newly imported mesh (they do for stock meshes still in place though). What are these sphere/boxes meant for, and why is my mesh missing them? I didn't receive any error message during the import process, and the generated file is not reported as "possibly corript" :hmmm:

2 - This is possibly related to the file I am currently working on (pantelleria.GR2): when I try importing a new mesh into 'Object1057' (the mesh with nine subsets), the import process is aborted, and I get instead the following message:

"Exception while deleting Primary Topology Group. The error is: Index beyond matrix limits."

followed by:

"Unable to delete subset 1"

I can delete the named subset, along with the other unnecessary subsets, and at this point GR2 Editor lets me to import new meshes, but when I try to save the file broken chains are reported.

TheDarkWraith 03-02-14 02:29 PM

Quote:

Originally Posted by gap (Post 2180656)
I have met two new problems though:

1 - When I check the 'render bounding box' and 'render bounding sphere' checkboxes in the mesh tab, neither of them is rendered for the newly imported mesh (they do for stock meshes still in place though). What are these sphere/boxes meant for, and why is my mesh missing them? I didn't receive any error message during the import process, and the generated file is not reported as "possibly corript" :hmmm:

2 - This is possibly related to the file I am currently working on (pantelleria.GR2): when I try importing a new mesh into 'Object1057' (the mesh with nine subsets), the import process is aborted, and I get instead the following message:

"Exception while deleting Primary Topology Group. The error is: Index beyond matrix limits."

followed by:

"Unable to delete subset 1"

I can delete the named subset, along with the other unnecessary subsets, and at this point GR2 Editor lets me to import new meshes, but when I try to save the file broken chains are reported.

Any exception shown is very bad. Give me a link to the files you were using and the one you were trying to import into. Also give me a step by step procedure of what you did so I can imitate the exception in the Debugger to see why the exception was being thrown.

gap 03-02-14 04:02 PM

Quote:

Originally Posted by TheDarkWraith (Post 2180730)
Give me a link to the files you were using...

obj meshes + textures:
https://www.mediafire.com/?w32i1anvm02eyw8

WIP GR2 file + dds textures:
https://www.mediafire.com/?2bnvu6y3i4iuzch

Quote:

Originally Posted by TheDarkWraith (Post 2180730)
...and the one you were trying to import into.

stock GR2 file:
data\Terrain\Locations\CustomAreas\pantelleria\pan telleria.GR2

Quote:

Originally Posted by TheDarkWraith (Post 2180730)
Also give me a step by step procedure of what you did so I can imitate the exception in the Debugger to see why the exception was being thrown.

Missing bounding boxes\spheres:
I don't really know when the problem started. I have imported two meshes so far (turret and radio), and both apparently miss their bounding geometries. Import options (loose import): everything checked but material properties (for both files) and AO coordinates (for radio mesh).

Subset deletion exception:
see my first post for details. Any omitted detail not relevant. Tried importing various obj files with different import options, and I even tried importing in a fresh file, but the oucome was always as per my previous report. :yep:


On an unrelated note, I had another of my ideas on an feature that would ease our work on GR2 files:

-select a bone/mesh/material
-right click on it
-select 'copy ExtendedData'
-select a second bone/mesh/material (in the same file or in another file)
-right click
-select 'paste ExtendedData'

possible? :hmm2:

gap 03-02-14 06:10 PM

@ TdW Re. GR2 Exception

I forgot to mention that the GR2 file that I am currently working on, is reported as having 'fillers' in section 0. I wonder if that is relevant to the problem I am experiencing :hmmm:


@ tonschk

sorry for the late reply mate

Quote:

Originally Posted by tonschk (Post 2180519)
may be a way to sort out this awfully :wah: different shadowing behaviour is to tweak and change "ALL" the model's links to either the main bone or to the child bone, in this case (I guess) I need to change the links of the UZO binoculars to the main bone like they are already now for the UZO pedestal

That is not going to work (never seen a bone with two meshes linked to it). An hypothetical workaround (if GR2 Editor opened UBoot_Sensors.GR2) could have been combining pedestal and binoculars mehes into one mesh, and replacing the pedestal mesh linked to the main bone with the new pedestal + binoculars combined mesh. At this point, the VisibleUnderWater controllers linked to binoculars' bone would have no effect though.

Quote:

Originally Posted by tonschk (Post 2180519)
Can you tell me please how you know that "the pedestal is linked on the model's main bone, and the binoculars are linked to a child bone of the main bone"?

That is easy: open UBoot_Sensors.GR2 in Goblin Editor, and look for the UZO model in GDS Scene Tree (bones are sorted hierarchically there). Select a bone, and the mesh linked to it will be highlighted in green in Goblin's viewport. If nothing gets highlighted, the bone you have selected has no meshes linked to it :up:

tonschk 03-02-14 06:53 PM

Amazing:woot:, I am digesting word by word your answer, I need to start to use the Globin Editor, thank you a lot :salute:

gap 03-02-14 07:13 PM

Quote:

Originally Posted by tonschk (Post 2180840)
Amazing:woot:, I am digesting word by word your answer, I need to start to use the Globin Editor, thank you a lot :salute:

Goblin Editor is only useful for editing controllers, and for previewing how GR2 objects will look in game (more or less). If you want to go deep into GR2 editing, you have no other option but learnig TDW's application :up:

TheDarkWraith 03-02-14 10:26 PM

Quote:

Originally Posted by gap (Post 2180824)
@ TdW Re. GR2 Exception

I forgot to mention that the GR2 file that I am currently working on, is reported as having 'fillers' in section 0. I wonder if that is relevant to the problem I am experiencing :hmmm:

Nope, those are required due to the type of file (Special GR2 - pointers come before data) and the section's alignment value

I fixed the import problem. Wow, it was messy but it's all sorted now.
The only problem I have left to fix is if you go ahead and delete the material bindings not needed anymore after the import it corrupts the file. If you don't delete them everything is fine. I'll look into it tomorrow :up:

As far as your bounding boxes and spheres remember that the bone that the mesh is tied to determines their 3D position in the world.

TheDarkWraith 03-02-14 10:40 PM

Quote:

Originally Posted by gap (Post 2180770)
On an unrelated note, I had another of my ideas on an feature that would ease our work on GR2 files:

-select a bone/mesh/material
-right click on it
-select 'copy ExtendedData'
-select a second bone/mesh/material (in the same file or in another file)
-right click
-select 'paste ExtendedData'

possible? :hmm2:

Wish it was that easy! The problem is the ExtendedData is different depending on how the bone/mesh/material is used/defined :dead: This is the major obstacle currently as to creating new GR2 files from scratch and for adding new meshes. I don't understand what determines which ExtendedData type is used for what and when.

Take a look in Granny Viewer and you'll see ExtendedData is different for all the same items of a category (mesh, material, bone, etc.)

Madox58 03-02-14 11:20 PM

Still not Universal import for obj files.

tonschk 03-03-14 04:20 AM

Thank you for the info :yeah:, the dynamic shadows (and self shadowing) of the SH3 flags were very immersive showing nice "waving goodbye" shadows moving synchronised/simultaneously with the flags. SH5 shadows have a number of problems, for the moment I will try to sort out the UZO (binocular/pedestal) problem

Quote:
Originally Posted by tonschk http://www.subsim.com/radioroom/smartdark/viewpost.gif
...I will try to open the flags GR2 files to enable the flags dynamic shadows and self shadowing, thank you for your help



Quote:

Originally Posted by gap (Post 2180075)
Unfortunately you can't: the flag models used in SH5 are dat objects, and they are known for casting no shadows in game (this is one of the limitations of imported dat ships).

Unless someone finds a way to tweak the game shaders so that dat objects can cast/receive shadows, or deciphers GR2 animations enabling us to create GR2 flags, ship flags will never have shadows :-?



http://i58.tinypic.com/25g3w4n.jpg

tonschk 03-03-14 07:50 AM

Do you think there must be a reason why the SH5 developers split the UZO in two meshes (pedestal/binoculars) each linked to a different bone ?


Quote:
Originally Posted by tonschk http://www.subsim.com/radioroom/smartdark/viewpost.gif
may be a way to sort out this awfully :wah: different shadowing behaviour is to tweak and change "ALL" the model's links to either the main bone or to the child bone, in this case (I guess) I need to change the links of the UZO binoculars to the main bone like they are already now for the UZO pedestal

Quote:

Originally Posted by gap (Post 2180824)
That is not going to work (never seen a bone with two meshes linked to it). An hypothetical workaround (if GR2 Editor opened UBoot_Sensors.GR2) could have been combining pedestal and binoculars mehes into one mesh, and replacing the pedestal mesh linked to the main bone with the new pedestal + binoculars combined mesh. At this point, the VisibleUnderWater controllers linked to binoculars' bone would have no effect thoug


gap 03-03-14 08:45 AM

Quote:

Originally Posted by tonschk (Post 2181011)
Do you think there must be a reason why the SH5 developers split the UZO in two meshes (pedestal/binoculars) each linked to a different bone ?

Yes, the binoculars bone got at least a VisibleAboveWater controller: when the u-boat submerges, binoculars disappear whereas the pedestal model keeps in its place. :yep:

gap 03-03-14 10:00 AM

Quote:

Originally Posted by TheDarkWraith (Post 2180899)
Nope, those are required due to the type of file (Special GR2 - pointers come before data) and the section's alignment value

I fixed the import problem. Wow, it was messy but it's all sorted now.
The only problem I have left to fix is if you go ahead and delete the material bindings not needed anymore after the import it corrupts the file. If you don't delete them everything is fine. I'll look into it tomorrow :up:

:yeah:

Since you are at it, can you tell me what is wrong with the "billboard" meshes linked below? (for use as simple shrub models)

http://www.mediafire.com/download/hs..._obj_files.rar

The first of them was created by me from scratch, and the second one is exported from one of the vegetation.GR2 files in the terrain folder, with little custmizatons by me. I can import the two of them into vegetation.GR2 with no problems, but when I do a loose inport of them in the GR2 file I am currently working on (pantelleria.GR2, 'far' mesh), I get the following message on saving:

Quote:

********* There are broken chains in Section 1! File is more than likely corrupt. Unable to save *********
The same happens with other files/meshes. Import options seem not relevant either (even the mere importing of vertex data is enough to break chains), but I have noticed something else: if I combine one of the billboard meshes with other meshes, and then import them all as a single mesh (you can do the same with the other model parts I sent you yesterday), broken chains are no longer reported, and I can save the file normally. Is it possible that the number of vertices/edges/faces is relevant in this case? :hmmm:

I have another question: I find the "view vertex declaration" function very useful, but is there a way to remove some of those declarations from a mesh, if not needed? Though not used, Normal, Tangent, Binormal, Diffuse, and Self-Illuminations UV coordinate declarations are always there (provided that the original mesh had them), no matter if I choose not to import them from obj file and not to use existing vertex data instead. I hope I made myself clear :)

Quote:

Originally Posted by TheDarkWraith (Post 2180899)
As far as your bounding boxes and spheres remember that the bone that the mesh is tied to determines their 3D position in the world.

Have you seen my GR2 file? I have set the flags all of its mesh-linked bones to 0 (no position data, no rotation data). Shouldn't that involve that bounding boxes/spheres are centered on the geometrical center of each mesh?

Quote:

Originally Posted by TheDarkWraith (Post 2180905)
Wish it was that easy! The problem is the ExtendedData is different depending on how the bone/mesh/material is used/defined :dead: This is the major obstacle currently as to creating new GR2 files from scratch and for adding new meshes. I don't understand what determines which ExtendedData type is used for what and when.

Take a look in Granny Viewer and you'll see ExtendedData is different for all the same items of a category (mesh, material, bone, etc.)

Yep, I had noticed that :doh:

Quote:

Originally Posted by privateer (Post 2180912)
Still not Universal import for obj files.

Not yet, but TDW has greatly improved the tool during the last few weeks. You should try it again :up:

ReallyDedPoet 03-03-14 10:10 AM

Excellent work continues to be done here :yep:

Looking forward to getting back to SH5 when I
upgrade my computer.

TheDarkWraith 03-03-14 11:11 AM

Quote:

Originally Posted by gap (Post 2181060)
The same happens with other files/meshes. Import options seem not relevant either (even the mere importing of vertex data is enough to break chains), but I have noticed something else: if I combine one of the billboard meshes with other meshes, and then import them all as a single mesh (you can do the same with the other model parts I sent you yesterday), broken chains are no longer reported, and I can save the file normally. Is it possible that the number of vertices/edges/faces is relevant in this case? :hmmm:

I have another question: I find the "view vertex declaration" function very useful, but is there a way to remove some of those declarations from a mesh, if not needed? Though not used, Normal, Tangent, Binormal, Diffuse, and Self-Illuminations UV coordinate declarations are always there (provided that the original mesh had them), no matter if I choose not to import them from obj file and not to use existing vertex data instead. I hope I made myself clear :)

Have you seen my GR2 file? I have set the flags all of its mesh-linked bones to 0 (no position data, no rotation data). Shouldn't that involve that bounding boxes/spheres are centered on the geometrical center of each mesh?

The problem with broken chains when importing a mesh with different number of subsets and/or vertices and/or indices is fixed in upcoming version.

Being able to remove items from the vertex declaration isn't finished yet. I've been working on this for some time.

Even though you set all the flags of all it's bones to 0 you're forgetting one important one: the model! It has influence on everything :) You need to adjust the model's position as it has some HUGE offsets for X and Z. With these HUGE offsets all bones are offset by this same amount.

I got all the problems fixed that your bunker exposed. I rendered everything just to ensure the app did everything it was supposed to do on import. I had to manually adjust the bone to the correct position:
http://www.subsim.com/radioroom/pict...pictureid=7377


All times are GMT -5. The time now is 12:21 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.