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 09-30-11 10:32 PM

Quote:

Originally Posted by privateer (Post 1758270)
Here's the King George's AO texcoords extracted. (no granny2.dll was harmed during the extraction! :haha:).
http://i108.photobucket.com/albums/n.../KG_AO_UVs.jpg

ok I don't know much about AO maps but I'm learning. That image above looks more like a .dds file. Are you saying the second set of texture coordinates are in fact a Vector3 array? It appears that triangles are being defined in that picture.....or is that a 2D render of the verticies texture coordinates? :06:

skwasjer 10-01-11 03:28 AM

It's simply a render of the uv map for AO (vector2 array).

You have to define the right vertex structure. When more uv maps are defined on a model, a vertex structure has extra texcoords:

Vector3 Position;
Vector3 Normal;
Vector2 UV;
Vector2 UV_AO;

In shader code you decide when to use and what you do with it (and not in program code). In the same way you need to provide bi/tangent normals for bump mapping. And of course need to pass the appropriate textures to the shader pipeline. See my shader for an example...

Hint:
VS_OUTPUT RenderSceneVS( float4 vPos : POSITION,
float3 vNormal : NORMAL,
float2 vTex0 : TEXCOORD0,
float2 vTex1 : TEXCOORD1,
uniform bool bWireFrame )

skwasjer 10-01-11 03:42 AM

Quote:

Originally Posted by TheDarkWraith (Post 1758425)
If you bought the SH5 game you have a license to all the files contained in it. As long as I don't modify any dlls or exe there is no legal ground for anyone to stand on. Furthermore since the app asks you to point it to your granny2.dll file it is using your licensed copy of it.

So you're saying you could take any program it's core files, reverse engineer it or use libraries from it, but as long as you don't distribute those files (since the user has them already) you are in the clear... Trust me, that won't stand in court. Anywhere. Even I 'touched' illegal grounds by simply looking at SH4's .ACT files but at least I did not use any game libraries...

Now if RAD doesn't care, good for you and SH5, but that doesn't make it legal.

But anyways, this is an old discussion I don't care getting into...

Madox58 10-01-11 07:51 AM

Quote:

Originally Posted by TheDarkWraith (Post 1758455)
ok, I think I found something interesting in the King GeorgeV.gr2 file itself:

000176E0 01 01 01 01 01 01 01 01 00 00 00 00 50 6F 73 69 ............Posi
000176F0 74 69 6F 6E 00 00 00 00 4E 6F 72 6D 61 6C 00 00 tion....Normal..
00017700 54 61 6E 67 65 6E 74 00 42 69 6E 6F 72 6D 61 6C Tangent.Binormal
00017710 00 00 00 00 54 65 78 74 75 72 65 43 6F 6F 72 64 ....TextureCoord
00017720 69 6E 61 74 65 73 30 00 54 65 78 74 75 72 65 43 inates0.TextureC
00017730 6F 6F 72 64 69 6E 61 74 65 73 31 oordinates1

Basically it tells me the vertex layout:
Position
Normal
Tangent
Binormal
TextureCoordinates0
TextureCoordinates1

Most Models in SH5 use 64 bytes to define the data for one vertex.
MOST but not all!!
Look at the Large Costal Gun and you'll see a 76 byte data structure!!
It has DiffuseColor0 before the first set of Texcoords.
That throws 12 bytes in but I have no idea why that's there.
:hmmm:
Open that GR2 with your program and since your useing the granny2.dll I would expect it to render properly.

I had to add to my script to export the vertex data to account for this extra info.
Basiclly I just ignore it for now.

Also, if you open the gun with Goblin and click to view wireframe?
Only the base will show in wireframe mode.
The Barrel and Turret won't. So the DiffuseColor0 is doing something at least in Goblin.

Alex 10-01-11 10:32 AM

Let me tell you that I'm lost in admiration for the amount of knowledge that a select few have gathered in the shadows on some subjects related to this game.

:huh:

But let's get back on topic now. :|\\

skwasjer 10-01-11 11:10 AM

Quote:

Originally Posted by privateer (Post 1758660)
Most Models in SH5 use 64 bytes to define the data for one vertex.
MOST but not all!!
Look at the Large Costal Gun and you'll see a 76 byte data structure!!
It has DiffuseColor0 before the first set of Texcoords.
That throws 12 bytes in but I have no idea why that's there.
:hmmm:
Open that GR2 with your program and since your useing the granny2.dll I would expect it to render properly.

I had to add to my script to export the vertex data to account for this extra info.
Basiclly I just ignore it for now.

Also, if you open the gun with Goblin and click to view wireframe?
Only the base will show in wireframe mode.
The Barrel and Turret won't. So the DiffuseColor0 is doing something at least in Goblin.

It can indeed be simply for editting/viewing/debugging purposes. Remember that SH3/4 had many 'dev-leftovers' too in the game files. But it can also be a base color for lighting. I really have no idea why so I'm just throwing out ideas I know from memory/earlier experience. You might get a clue from the shader files. Just check all vertex shaders and their input structures and see if you can 'match' the input with the vertex data that you get from GR2. If it's somewhere in there you can deduce what it's for by interpreting the shader code. If it's nowhere to be found you can probably simply ditch it... It's how I learned that uv3/4 in DAT-files are obsolete data.

TheDarkWraith 10-01-11 12:23 PM

Quote:

Originally Posted by privateer (Post 1758660)
Most Models in SH5 use 64 bytes to define the data for one vertex.
MOST but not all!!
Look at the Large Costal Gun and you'll see a 76 byte data structure!!
It has DiffuseColor0 before the first set of Texcoords.
That throws 12 bytes in but I have no idea why that's there.
:hmmm:
Open that GR2 with your program and since your useing the granny2.dll I would expect it to render properly.

Yes it does because it only reads one texture coordinate. There is no granny vertex format defined that has this other channel:

http://www.subsim.com/radioroom/pict...pictureid=4959

If you use Microsoft's PE dumper and look at the exports you'll see all the granny vertex formats defined. They are kind of encrypted in their wording but you can make it out. i.e.: PNT332 would be position, normal, texture where position is 3 reals, normal is 3 reals, and texture is 2 reals.

Viewing this in wireframe is fine because I'm controlling the rendering and just setting the wireframe renderstate.

I've come to the conclusion that the game (and Goblin editor) doesn't really use the granny2.dll to 'read' the whole GR2 file. It only uses it to get information when it needs it. This would explain why it can access the other texture coordinates and other color information contained in the verticies.

Here are two vertex formats I know:
PWNT3432 - position (3 reals), Bone data (bone indicies - 4 ints, bone weights - 4 ints), normal (3 reals), texture coordinates (2 reals)
PWNGBT343332 - position (3 reals), Bone data (bone indicies - 4 ints, bone weights - 4 ints), normal (3 reals), tangent (3 reals), binormal (3 reals), texture coordinates (2 reals)

The Granny viewer is an excellent source of information. It tells you what the data type is for each value it reads right there on the screen!

skwasjer 10-01-11 01:49 PM

From Granny SDK feature page: http://www.radgametools.com/granny/sdk.html

- programmatically access all maps, including specular, diffuse, ambient, self-illumination, bump, displacement, refraction, reflection, and many others

Quote:

I've come to the conclusion that the game (and Goblin editor) doesn't really use the granny2.dll to 'read' the whole GR2 file. It only uses it to get information when it needs it. This would explain why it can access the other texture coordinates and other color information contained in the verticies.
Yes, a(ny) file never has to be completely loaded. The beauty of pointers. Files generally start with some sort of TOC header to aid in this.
No, in that the game will bypass the granny library to get other data from GR2. That would be utterly idiotic. The game has to get the data in some way at some point and it definately uses Granny for it.

Anvart 10-01-11 02:33 PM

Quote:

Originally Posted by privateer (Post 1758430)
...
And SH5 does not do the CRC check.
Had SH5 used the CRC check?
We'd be screwed big time!!
Unless you fell back to an older granny2.dll
:03:

... but no probs to calculate it... and you know it. :O:
******************************************
small intrigue:

http://img8.imageshack.us/img8/885/gr2crcsh5.jpg

Madox58 10-01-11 03:30 PM

Uh Oh!!!
:o

skwasjer 10-01-11 03:35 PM

In 3... 2... 1...

TheDarkWraith 10-01-11 04:38 PM

Looks like some people are having some wrong impressions here and we need to clear these up.

I do not imbed or include any version of any software with what I have created. It's a unique, one-off design from information I have gathered.

The app is useless unless the end-user points it to a granny2.dll. Thus I have no ties to any software but my own. Freedom of information baby, gotta love the USA's freedom of speech right.

Now I may abandon having the user point it to a granny2.dll once we completely map out the gr2 file structure. Like I said I know about 75% of the structure already, it's the remaining 25% that needs to be decoded. Work is already well underway on it from various sources. I do have to say the 010 Hex editor app is a priceless piece of software. It's structure editor is a god-send when mapping out a file.

Ok now back to business :D

Madox58 10-01-11 05:44 PM

I do agree that 010 is a fantastic Tool!
:rock:

Well worth the $49.95 spent.
I now run the 3.2.2 version.
I consider it 'THE' Editor if you mean business!
:03:

TheDarkWraith 10-01-11 07:02 PM

Quote:

Originally Posted by privateer (Post 1759011)
I do agree that 010 is a fantastic Tool!
:rock:

Well worth the $49.95 spent.
I now run the 3.2.2 version.
I consider it 'THE' Editor if you mean business!
:03:

Cost me $150 :o Money well spent though!

I've got another major update coming to the template file. Almost have the whole material section mapped out completely - extended data and all :D

that last update I sent I found a hack that works temporarily until the data can be defined more correctly

Madox58 10-01-11 07:08 PM

Anvart has broken the CRC issue by the way.
:rock:

$150?
Commercial is $129.95 and the Upgrade/Maintenance is $39.95 for commercial.
How did you get a $150.00 figure?


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

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.