Jump to content

[DOC]IV model formats - .wft, .wdr, .wdd


Recommended Posts

Released Exporters and Tools:

Experimental Zmodeler 2 .wft filter from Oleg

 

 

Old info from here down

 

Based on models uploaded in this topic and discussion from the last post there...

 

 

Ask GooD-NTS or Alexander Blade... I am only a person who is looking for progress, compare information from differen forums and post it here))

 

You want to keep everything in a secret like other information about GTAIV formats? Please, not...

 

Model format is hacking by CrashBandicoot and listener (I just only translated their speech to english)

 

CrashBandicoot:

 

Model file has symmetrical structure, and what he needed.

Here's what new research showed.

Usually, the files coords 3D data points are written in succession on 12 bytes. 1 point = 12 bytes (float x, float y, float z). Considering model with the bat (file rpg.wdr.rsc) proved that point is 36 bytes. The first 12 - are coordinates x, y, z. The next 12 bytes this point on the circle around bits (that is, is the "garbage" around bits). But next 12 bytes - is not clear at all that: The first 4 bytes - not the number (not exactly float), second and third quite similar to the number of type float.

 

1 point is this:

offset | description

-----------------

0 float coord_X

4 float coord_Y

8 float coord_Z

12 float unk_X

16 float unk_Y

20 float unk_Z

24 unk2

28 float unk3_1

32 float unk3_2

 

unk2 - the number does not seem to be some flags. For example, what it can be value: 9B 9B 9B FF, B3 B3 B3 FF, 96 96 96 FF, 9C 9C 9C FF, 93 93 93 FF, B5 B5 B5 FF, 94 94 94 FF, etc.

 

At the expense of unk3_1 and unk_3_2 - float values from 0 to 1. Perhaps texture coordinates.

 

 

listener:

 

In bat file, at 0x1000 begins GPU-segment. All that it is to be standart D3D structures.

 

Lhen it is possible to saw vertex and index array. (Fields filled 0xCD - not-inicialised data). Total size of the buffer index produced 480 triangles.

 

i'll re-iterate a bit. All my discussion is based on w_bat_wdr.rsc

 

rsc_info.txt

HeaderLength, offset into file where raw vertex data begins.

DataLength, total amount of data to read in, including any padding (0xCD) and face indices.

 

The vertex structure should be as follows:

0 float position x

4 float position y

8 float position z

12 float normal x

16 float normal y

20 float normal z

24 dword color (RGBA)

28 float texcoord u

32 float texcoord v

 

size of 1 vertex = 36 bytes

size of vertex array = 0x1ef0

0x1ef0 / 36 = 220 verts (vertex count isn't listed in file anywhere? i can't find it..)

 

dword unknown

dword unknown

dword unknown (material indices?)

padding (0xCDCDCDCD)

offset 0x3000, face indices?

face index array is 0x5A0 bytes long (also 16-bit face indices, see Directx dox)

padding until 0x3FFF

eof

 

Notes on vertex structures: Earlier in the file, 0xBC0 for the bat, there a list of shaders that will be used for the materials on the geometry. The vertices should have the data that the shaders expect, and different shaders will expect different data. Peds have boneweights, and some geometry has tangents, or multiple uv coordinates. Be sure to sure to cross check the shaders listed in the model, with common\shaders\db, and the vertex declarations in common\shaders\dcl.

 

Edit: The *.dcl files have been changed with R* patches (1.0.2.0 for sure, 1.0.1.0 is untested) and no longer contain full vertex declarations mad.gif

Anyone using that data needs to grab the files from a 1.0.0.0 install.

Edited by DexX
Link to comment
https://gtaforums.com/topic/382615-dociv-model-formats-wft-wdr-wdd/
Share on other sites

Whoot! Really Fast! Nice one DexX! smile.gif

 

Here my results...

user posted image user posted image user posted image

...the AK seems to have two parts. (maybe?!)

 

I'm not really good in file description, so I just upload the test-max-scripts...

http://rapidshare.com/files/172480557/IV_M...t_Test.rar.html

...really raw(noobish) and "static", 'cause I also couldn't found any vertex-count or something like that.

 

But what I can say is that the shooting-weapons (AK&RPG) have some more floats(?).

0 float position x

4 float position y

8 float position z

12 float normal x

16 float normal y

20 float normal z

24 dword color (RGBA)

28 float texcoord u

32 float texcoord v

36 unkFloat?

40 unkFloat?

44 unkFloat?

48 unkFloat?

 

That's it...for now.

 

Greetz!

 

//Edit-->

user posted image

Normals, VertexColors & UV-Mapping...

Edited by oCain

 

36 unkFloat?

40 unkFloat?

44 unkFloat?

48 unkFloat?

Tangents, used for setting up the normal map correctly in the shader (since R* almost certainly used tangent-space normal maps).

36 tangent x

40 tangent y

44 tangent z

48 tangent w

 

 

...the AK seems to have two parts. (maybe?!)

There's vertex data @ 0x2000, and 0x22000 (with corresponding face data @ 0x2e4400). So yea, 2 sets of geometry data.

 

Edit, aha, there's another piece at 0x21D70 - this has the default vertex structure i listed in my first post - no tangents.

 

 

Normals, VertexColors & UV-Mapping...

You beat me to it, bastard tounge.gif

 

The geometry structure seems to be basically this:

initial vertex data/geometry offset

--begin of vertex data (based on vertex declaration)

--read until 0xCDCDCDCD

--begin face index for these verts

--read until 0xCDCDCDCD

-next set of vertex data, loop

repeat until EOF

 

Other notes:

There are *.sps files mentioned in the section before the geometry data is stored. The sps files seem to contain references to which shader will be used. For example gta_alpha.sps, references gta_default, and there is no gta_alpha shader. There are 131 .sps files, and only 90 shaders.

Edited by DexX

Weapons use two different models because when the player reloads, the magazine's pulled off and replaced by one on the player's person... like the rocket launcher, only you're replacing more than one ammo at a time tounge.gif

The rocket's still in another model file, just like before, and just like that, the other weapons have adopted this sort-of system of having a sub-model, the minigun in SA had two model parts, for example... and now the AK has another model for it's clip... simple.

ah yes, i forgot to look at the pic's, i thought he meant the model file he was looking at had 2 parts blush.gif

 

Edit: max scripts re-uploaded due to RS hit a 10 DL limit confused.gif

 

http://www.savefile.com/files/1926534

Edited by Gforce

Here's a little template I wrote for 010 Editor (its a hex editor) that parsed out most of the outer non-model data from the decompressed xbox360 xdr model files. Non-model data meaning things like... headers, # of geometry parts, vertex count, indice count, etc. I think the only sections I hadn't written structures for was the ones linking the shaders. The windows wdr might be a little different... but this might help in either case:

 

http://aru.nd4spdworld.com/pic/iv-xdru.bt

 

Some really good work here though! Keep it up.

Nice Pictures! (Progress wink.gif)

 

I've just found a tiny thing...

 

offset: 96 [0x60] = Object Count

(Weapons only...maybe other objects too?!)

 

--

 

user posted image

...nothing special, but you can see the different parts of the AK.

 

Keep at up!

 

//Edit-->

 

You beat me to it, bastard  tounge2.gif

HeHe...Sorry Dude, but there was nothing on TV. wink.gif

 

//Edit²-->

VertexBlockOffsetTheory:

 

If we could read the whole Header(+Texture/ShaderInfo Stuff)and got the the size.

Then the vertexBlock starts at the next PowerOfTwo value.

Let's say the Header++ beats the 2048, so the VertexBlock starts at 4096 and if it beats the 4096,

the VertexBlock starts at 8192.

 

strange Idea + poor english = bad mixture...I know. blush.gif

Edited by oCain

Sorry for the following OT, but my content is realy important for us.

 

Hey oCain,

I'm writing this as my personal last request to you. Please read what I have to say and think about it. I'll write this text to make some things absolutly clear and to show that we, the members of the GTA United modification, want you back. You are a very talented GTA modder and you were it back months ago aswell. Over a half year ago you simply disaapeard one day, from the one day to the next. Let me define something clean. If some of us said some inappropriate thing or in any way bad thing to you: we doesn't meant it that way. We talked to each other, if someone knows why you simply disaapered; but nobody noticed something. If it should be like this way, we want to apologize us. Like I wrote earlier on YouTube, if the reason should be personal things/school/other thing we would really understand that, if someone doesn't want to do anything more with GTA, we respect that. The only thing we really would like to see is, if you could at least tell us, what you're gonna do. I personally thought back then that you are a cool and talented guy, really, but seeing now as you ignored us for months and appeard now again with that real bomb you showed in this thread is a bit sad for us. In the name of AMD, Aschratt, myself and all others, I can only hope that you tell us what you're reasons were & are! We do not know that we have done something wrong, if we have done it. We still want you back oCain, please keep that in mind.

 

Greetz,

CD

Dageron, do you guys extract the models differently? The sample files you uploaded have the extra text files, that contain the offset/size data. REspawn just released his img extractor, and the models (.wft) files are slightly different - larger.

Fixed in REspawns last update.

i've been looking into the *.sps files in common\shaders\db, and there seems to be an attribute that many of them share;

 

__rage_drawbucket {int 1}

 

The 'int' value can be 1-5, or in some cases, 29 or 30. I gave it limited testing in "gta_vehicle_vehglass.sps", trying it at 1, 3, and 5 (what seemed to be the most popular uses, based on my research).

 

at 1: http://img101.imageshack.us/my.php?image=drawbucket1rm4.jpg

Alpha is normal.

 

at 3: http://img211.imageshack.us/my.php?image=drawbucket3dr7.jpg

Alpha is opaque.

 

at 5: http://img126.imageshack.us/my.php?image=drawbucket5oy0.jpg

Alpha is gone.

 

29 was seen in gta_vehicle_nosplash.sps

30 was seen in gta_vehicle_nowater.sps

 

For some of the other sps files, there are other attributes that can be edited. For example:

 

SpecularColor {float 0.150000}Specular {float 180}

 

...from "gta_vehicle_vehglass.sps", controls the spec amount for the glass materials. Although the parameters here seem to be matched with variables in the shader file (in this case, gta_vehicle_vehglass.fxc), it seems only certain vars can be changed with this method.

 

Dec 18

Not related to the above stuff - The models are in more than one format;

.wft

.wdr

.wdd

 

Component peds use both .wdd and wft model types. Regarding peds the .wdd files seem to contain the texture and material lists, object names, and other data. The wft file seems to have bone and matrix info. Both contain mesh data, although the mesh data from the wft files is extremely small in many cases, compared to the mesh data from the wdd file, which appears to be the bulk of the model.

 

Vehicles only seem to use wft files, so the above does not apply to them (vehicle wft files have all the necessary info). Weapons (mainly .wdr) and ped props (mainly .wdd) have no wft's. wdr and wdd formats seem to be very similar.

 

A cursory examination of the Map imgs, reveals that they use primarily wdr files, with a few wdd files here and there. Very few wft files, probably those are animated, or otherwise special map objects.

Edited by DexX

Pinned to feed my ego. Hot damn. Actually, if anyone ever wants to see new car and ped models ingame, this stuff needs to be cracked. Having it fall behind the other topics won't help a bit.

 

Oh yea, been documenting the system data (*.sys, if using SparkIV / Resoursaur).

It's slightly out of date (thank you aru), but it's a start:

www.3dhole.com/iv/system_notes.txt

DexX, I thinking, your approach is... ineffective. RSC is not a sequence of chunks, like a RenderWare stream, but dumped out block of memory.

So, if we will read RSC contents and relocate all pointers, we got nice linked object structure.

 

My info on wdr, wdd and and wtd structures: http://public.sannybuilder.com/GTA4/rsc_en.txt

 

DexX, I thinking, your approach is... ineffective. RSC is not a sequence of chunks, like a RenderWare stream, but dumped out block of memory.

So, if we will read RSC contents and relocate all pointers, we got nice linked object structure.

 

My info on wdr, wdd and and wtd structures: http://public.sannybuilder.com/GTA4/rsc_en.txt

Updated a bit:

 

struct rage::grmGeometry : public rage::datBase {  // size = 0x4C 	DWORD	_f4;  // +4 	DWORD  	_f8; 	rage::grcVertexBufferD3D * m_vertexBuffers[4];  // +0xC 	rage::grcIndexBufferD3D  * m_indexBuffers[4];  // +0x1C 	DWORD  	m_dwIndexCount; 	DWORD  	m_dwFaceCount; 	WORD  	m_wVertexCount; 	WORD  	m_wIndicesPerFace; 	void *  _f38;    	WORD  	m_wVertexStride;   // Essentially size of each vertex 	WORD  	_f3E; 	DWORD  	_f40; 	void *	_f44; 	DWORD  	_f48;};

 

 

New struct (I suck at this, so excuse the mistakes tounge.gif)....

 

 

struct rage::grmShaderGroup : public rage::datBase { // size = ??  DWORD _f4;  CPtrCollection<SomeShaderStruct> m_shaders;  DWORD _f10[12];   // Type might be wrong (might not even be an array).. needs checking  CSimpleCollection<DWORD> m_unknown1;  CSimpleCollection<DWORD> m_unknown2;};

 

 

SomeShaderStruct has ptrs to shader name and sps file name.

 

 

@listener... does the game use all 4 of those defined Vertex/Index buffers? Or just the first one?

Edited by aru

WDR Viewer+3ds max import plugin by CrashBandicoot (gtamaps.net&OpenIV team)

 

DOWNLOAD

 

1) Extract models from IMG in *.wdr format.

2) If you need textures, extract them in JPEG format.

3) Open WDR in programm.

4) Export model file.

5) Open it with importer in 3ds max.

smile.gif

Edited by mr.Dageron
@listener... does the game use all 4 of those defined Vertex/Index buffers? Or just the first one?

thanks, aru

 

game code initializes all 4 buffers, but create vertex declaration only for the first vertex buffer.

I shall make resource scanner, for finding some unusual data (volume/cube textures, geometries with more than one vertex/index buffer, etc.)

 

File updated (more info on grmShaderGroup)

WDR Viewer+3ds max import plugin by CrashBandicoot (gtamaps.net&OpenIV team)

 

DOWNLOAD

 

1) Extract models from IMG in *.wdr format.

2) If you need textures, extract them in JPEG format.

3) Open WDR in programm.

4) Export model file.

5) Open it with importer in 3ds max.

smile.gif

Awesome, but how do I get the textures to show up correctly in 3dmax?

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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.