Jump to content

How to edit Sacred 2 gr2 files?


Recommended Posts

> ".. should I make it on material editor or on the dds files.how?.."

I cannot guarantee this will work in Sacred 2,

but here's a description:

 

In Photoshop, you have as "Layers" toolbox (in the right lower corner of the standard Photoshop set-up).

In this "Layers" toolbox, you see three tabs: "Layers", "Channels", and "Paths".

 

Click the "Channels" tab.

Select the channel called "Alpha 1".

 

If there is no "Alpha 1", you can create one:

Right-click one of the other channels and select <Duplicate Channel>.

Type "Alpha 1" as the name for this new channel.

 

This is the transparency channel.

You want to clear everything in this channel to an all white color.

 

Go back to RGB channel (select the RGB channel), and using eg. the 'Polygon Lasso' tool, you select everything you want to be transparent.

 

Select the Alpha 1 channel.

Paint with a black color inside your selection to make the selected parts entirely transparent.

Use a grey color to have only partial transparency.

 

You can control the 'opaqueness' with the darkness of your grey color.

 

(I'm repeating this because in my thread layout, my answer appears as a sub to icemember's last post).

(Which wasn't necessary if setting this forum to 'Standard' layout - sorry for that).

Edited by Pesmontis
Link to comment
  • Replies 91
  • Created
  • Last Reply

Top Posters In This Topic

> "but I think it's displayed entirely transparent"

 

According to Granny Viewer original gr2's do not have texture info, only materials.

Textures are applied through surface.txt to corresponding materials. I believe transparensy is controlled by SURFACE_FLAG_TRANSPARENT.

Link to comment

We're not talking about how Ascaron created GR2 files,

we're talking about how to get any kind of GR2 file working / displayed in-game.

 

Sure I would like to find out whether it's possible to create GR2 files exactly similar,

but for now it's easier to use iandave's shortcut (for static objects only).

 

So if a GR2 does have a texture, and it doesn't crash the game, that's fine by me :-)

 

Still I think you might want to enable tangential and bi-normal info. with the vertices (this is in the 'Mesh' properties of the export window),

though I'm not sure about their visual influence.

Link to comment

I'm not near my primary PC now so I can't attach a screenshot.

 

an example is bloodryad warrior boots model from graphics05\models\npc\dryades\bloodryades\equip\

editing procedure:

converted to smd through grnreader98

imported into 3ds max 8 with Cannonfodder's Smd import plugin

mirrored root bone at z axis to receive proper mesh outlook

removed skin modifier

reapplied visible material with no texture map

reattached skin modifier with same bone sequence as in original gr2

exported to gr2 with granny 2.7.0.30 export plugin for 3ds max 8 preserving topology info

Link to comment

> ".. removed skin modifier.."

Well it looks like you shouldn't remove the Skin modifier, because the vertex weights are not always equal to ONE,

and some vertices have more than one bone assignment (more than one bone influencing that particular vertex).

 

BloodDryadBoots.original.skin.jpg

BloodDryad boots original skin.

 

I recommend to check the SMD in a text editor before deciding whether to remove the Skin modifier.

 

When using Cannonfodder's SMD import plugin you can use the little 'eyedropper' tool to pick-up the material from the mesh

( as described here ).

 

When exporting the boots model as GR2, I recommend using the following settings:

 

= uncheck the first three checkboxes with the 'Animations' settings;

 

= uncheck the first two checkboxes with the 'File' settings;

 

= uncheck the third checkbox with the 'Materials' settings ("Include art tool specific data");

 

= with the 'Meshes' settings, uncheck the first three checkboxes, and then double-click on 'Meshes':

 

- You wil see a list of meshes, including those representing bones (!).

- Now select ONLY your 'boots' model and re-enable the first three checkboxes;

- Tick the checkbox with the setting 'Truncate vertex indices to 16bit';

- Set the slider called 'Coords per vetex' to two (2). It's default is one (1);

- Tick the checkbox 'Include tangent vectors';

- Tick the checkbox 'Include binormal vectors';

- Tick the checkbox 'Include per-bone triangle arrays';

- Tick the checkbox 'Include topology information' (I think you are right about this one, although it exports more than required);

 

= uncheck the third checkbox ('Include art tool specific data') with the 'Models' settings;

 

= uncheck the fourth checkbox ('Move to Origin') with the 'Models' settings;

 

= uncheck the third checkbox ('Include art tool specific data') with the 'Textures' settings, OR uncheck the first three checkboxes if you don't want to include any texture;

 

Note that sofar things have worked out ONLY if you include a texture.

 

These are my recommendations for the moment.

They will probably change.

These recommendations ONLY hold for this specific type of object, and

they are ONLY meant to produce a GR2 file which looks similar to the original.

 

I have checked these steps in GrannyViewer, where I see an entirely black model if I don't export a texture.

I think this can't be correct, but I don't know what to do about it atm.

Edited by Pesmontis
Link to comment
I have checked these steps in GrannyViewer, where I see an entirely black model if I don't export a texture.

I think this can't be correct, but I don't know what to do about it atm.

 

Yes I got the same, except that my model is also entirely black in 3dsmax2008 directly after importing (I use the nice SMD Importer for Max9 I found out about here: http://april15th.wordpress.com/2008/05/24/...for-3ds-max-9/)

 

I think it might have something to do with the scene lighting or sth.

Link to comment

> "I have checked these steps in GrannyViewer, where I see an entirely black model if I don't export a texture."

 

Will try this variant tonight. Did you manage to get the processed gr2 ingame? Does the model look normal or deformed(shredded)?

Link to comment

> ".. Did you manage to get the processed gr2 ingame?.."

I guess I could try replacing the Dryad hero's default boots..

 

Nope, it crashes the game.

 

atm. I guess I better wait for your feedback..

Link to comment

When I convert the gr2 file to obj (evegr2toobj) and import it into max, I get a properly displayed item in grannyreader when I re-export it from max.

 

Ingame however it is still invisible, even if I include the bones from a smd import.

 

I think the renderer looks for the material name in the gr2 and selects the proper surface from surface.txt by it.

 

The brassknuckle-06 we have been testing contains brassknuckle-06_n as material. look at the entry in surface.txt:

 

newSurface = {
 name		 = "brassknuckle-06_n",
 texture0Name = "maps/weapons/misc/n_brassknuckle-06_d.tga",
 texture1Name = "maps/weapons/misc/n_brassknuckle-06_sg.tga",
 texture2Name = "maps/weapons/misc/n_brassknuckle-06_n.tga",
 flags		= SURFACE_FLAG_OPAQUE,
 shader	   = obj_d_s_b,
}
mgr.surfCreate(newSurface);

 

I tried of course to add this material name to my scenes, but it lead not to an appearance of the weapon ingame. Maybe you want to try. I might be doing something else wrong....

(Make sure you also get all other identifiers and names exactly like in the original. I dont know what else is used by the renderer.)

Link to comment

> "atm. I guess I better wait for your feedback.."

 

 

screen.jpg

 

Well, still somewhat messed up ( I will experiment with the skeleton) - but it worked. Those recommendations about coords per vertex and move to origin were of great help.

Edited by dimitrius154
Link to comment

> ".. Make sure you also get all other identifiers and names exactly like in the original.."

Because of iandave's results I'm thinking maybe we should do exactly the ooposite..

 

I do indeed think that we created GR2's with material names equal to the original,

but this didn't work, or maybe there's some invisible material / texture pointer inside the GR2.

 

I think a texture inside a GR2 may somehow override the game's default texture lookup process.

Maybe that process goes something like: ".. if unknown material / texture name, then look somewhere else.." (ie. inside the GR2).

 

Dimitrius, will you share your GR2 export settings with us ?

 

And can you tell us what you think is messed up with the model (apart from the blackness) ?

 

[Edit]

Some more results.

Since you guys are doing these bold tests, I thought: let's try an entire biped..

 

HE.test00.jpg

 

HE.test01.jpg

 

Right, I created a GR2 with textures included.

We're actually seeing the add-on meshes (including the head!), which are textured OK.

The base mesh is not + it is somehow deformed (there's all kinds of edges sticking out).

If we don't include the textures in the GR2, then the displayed object will be black (and deformed).

 

With this test, I created the hq and mq maps directories for the Highelve in the pak directory,

and I copied both the original DDS files there, as well as derived TGA files.

Obviously neither of these types is picked up, and the textures inside the GR2 are disregarded.

I have one prominent question, and that is: the textures with "_h" and "_sg", which shader would they actually apply to?

In this test I tried 'Glossiness' and 'Specular Level' respectively.

 

The deformation of the mesh.. maybe I'm ranting, but I'm starting to think that PhysX might have a hand in this.. ('cause evrything looks fine in GrannyViewer).

Edited by Pesmontis
Link to comment

> "Dimitrius, will you share your GR2 export settings with us ?"

 

Of course:

 

Animations:

no flags (obviously)

File:

Left checked flags alone ( won't affect anything)

Materials:

First two flags checked

Used 02 - Standart Material with no changes

Using material resulting from first gr2->smd conversion is not an option - it is considered to be a structure of two materials and is not recognized by the game after exporting back to gr2

Meshes:

just like suggested

"

- You wil see a list of meshes, including those representing bones (!).

- Now select ONLY your 'boots' model and re-enable the first three checkboxes;

- Tick the checkbox with the setting 'Truncate vertex indices to 16bit';

- Set the slider called 'Coords per vetex' to two (2). It's default is one (1);

- Tick the checkbox 'Include tangent vectors';

- Tick the checkbox 'Include binormal vectors';

- Tick the checkbox 'Include per-bone triangle arrays';

- Tick the checkbox 'Include topology information' (I think you are right about this one, although it exports more than required);

= uncheck the third checkbox ('Include art tool specific data') with the 'Models' settings;

 

"

Models:

Move To Origin flag unchecked.

Textures:

left all flags alone

 

> "And can you tell us what you think is messed up with the model (apart from the blackness) ?"

 

The image is too small to see it, perhaps, but the mesh is actually squizzed and shredded.

 

I just solved that problem:

screen2.jpg

 

Mirroring turned out to be unnecessary ( both Granny Viewer and the game display exported meshes correctly.) and secondary export to smd - a bad mistake ( the resulting model looks well in Viewer, but shredded in game).

 

However calf parts of the mesh ( NOT skeleton) will have to be rotated 180 deg in order to be displayed properly ingame ( not in 3ds max OR Granny Viewer)

:) Goodness, those coordinates matrix transforms by 3D engines really require some booze to understand.

Edited by dimitrius154
Link to comment

> ".. However calf parts of the mesh ( NOT skeleton) will have to be rotated 180 deg in order to be displayed properly ingame.."

I think I've seen this when testing brassknuckle06, I did something similar there.

 

I'll make sure that we will have this in grnreader98 tomorrow.

 

Two important questions:

- how exactly did you rotate the mesh 180 degrees ?

- how did you reapply the 'Skin' ?

 

> ".. coordinates matrix transforms by 3D engines.."

Being a rocket scientist helps ;-)

 

> ".. secondary export to smd is a mistake.."

OK, accepted.

The reason I use this (in general) is to 'bake' transformations into the mesh / skeleton combi.

 

[Edit]

Anyway, with my test of the highelve biped I've found another mistake:

Don't remove any bone from the skin, leave them all there (!).

 

To make sure, I even used the option "Preserve bones affecting no verts" in the 'Meshes' section of the export settings.

 

What I found is that the skeleton is imported OK into the game, because the animations run OK.

The first time I ran my test, I left out the weapon bones, which resulted in a weapon which was just 'dragged along'..

Edited by Pesmontis
Link to comment

> "- how exactly did you rotate the mesh 180 degrees ?"

 

By selecting Editable Mesh part of the model ( Element selection ) then rotating calf elements around Y axis.

 

> "- how did you reapply the 'Skin' ?"

 

Selecting Editable Mesh does not destroy the Skin modifier, thus no need to reapply it. Actually, as yesterday's testing has shown attempting to remove, then reapply it results in complete separation of mesh and skeleton parts in game.

Link to comment

>"So - just to make sure - we don't need mirroring ?"

No. And some mirroring variants can change ingame model positioning ( like make it display upside down ).

 

 

>"And it doesn't matter that the mesh is inside out when first importing the SMD ?"

 

Right. The mesh looks that way in 3ds Max only.

Link to comment

OK, so that is solved!

Thanks for your effort, you've done a great job :-)

I guess we're almost there..

 

One thing you might want to know about grnreader98 is that I applied a transform from right- to lefthanded coordinate systems,

which was the only way to match rotation values I saw in GrannyViewer.

 

About the textures, I think the "_n.dds" textures go into the bump channel, and the "_d.dds" textures into the diffuse channel,

but can you guess which mapping channels the "_h.dds" and "_sg.dds" go into?

(I think 'h' and 'sg' are actually german abbreviations).

 

[Edit

sg = specular glossiness (?)

Edited by Pesmontis
Link to comment
>"So - just to make sure - we don't need mirroring ?"

No. And some mirroring variants can change ingame model positioning ( like make it display upside down ).

 

 

>"And it doesn't matter that the mesh is inside out when first importing the SMD ?"

 

Right. The mesh looks that way in 3ds Max only.

 

Looks like I was wrong about imploded outlook - it appears that ingame textures are ( in proper combination by the way ) applied to the inner surface of the model because of it :bye:. Inner and outer element surfaces are therefore confused

Link to comment

Waaah :bye:

WONDERFUL !!

 

Wanna tell us how you did it?

 

This morning I started reading into the .shaders files, but that ain't necessary anymore :-)

(for a skin-type surface I found: ".. get normal vector from bumpmap texture..",

and : ".. get shadow term from shadow texture.." )

so I'm thinking "_h.dds" ~ shadow texture (?)

Link to comment

Material Property Should be like this:

screen4.jpg

 

Yes, the original material from gr2->smd export turned out to be the easiest way..

 

And then by selecting Editable Mesh by Edges, then mirroring against X axis we correct the inner/outer surface placement and get the proper ingame outlook.

 

submaterial names should correspond with surface names in surface.txt (obviously)

Link to comment

So in fact you only edited the names of the sub-materials?

(+ you kept the sub materials entirely standard )

(+ you did not set textures / texture names )

 

I've started adapting grnreader98.

The picture below shows the result of a direct import of an SMD produced with this new version of grnreader98.

grnreader98.Cookson.SMD.import.20100829.01.3DSmax2008.jpg

 

I've added vertex colors only to get a better visual in 3DSmax (the model is mostly black if not).

 

In grnreader98, I changed:

- vertex position rotation 180 degrees around the y-axis;

- changed V texture coordinate from "-V" to "1-V";

- no normal vector flipping (in the previous version the normal vector z-coordinate was multiplied by -1).

 

Is this the way it should be?

 

[Edit] You can download this new grnreader98 debug version

Edited by Pesmontis
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...
Please Sign In or Sign Up