(Image Heavy) Extract Unreal vertex meshes the hard way

Get some cool tips about how to tweak your UT graphic, gameplay, and much more!
Post Reply
AlCapowned
Experienced
Posts: 130
Joined: Mon May 16, 2011 2:45 am
Personal rank: Layman

(Image Heavy) Extract Unreal vertex meshes the hard way

Post by AlCapowned »

Download link: http://www.mediafire.com/?w1o4iho1siaosp5

File exporters like UEViewer don't work with some versions of Unreal and UT, including the betas and tech demos, which is why it might be useful to know how to extract vertex meshes through hex editing. The only tools needed are a hex editor and a calculator that supports hexadecimal. Something like UnrealFX or UnrealNST will let you know if your extracted mesh will work in-game, but they aren't necessary. I'll try to keep this as non-technical as possible.

I use FlexHEX in this tutorial, but almost any free hex editor will do the job. First, open an Unreal archive; I decided to open Unreal.ucx from the '97 tech demo. This archive has the import sequences for all of its meshes, so try to find those first.
Image

This is the import sequence for the BigMan. Skip it and any code that comes after, and you'll eventually find the mesh. What gives the location of the mesh away is a pattern of ANSI characters that are surrounded by blank ANSI text (there will be hex data there, but it doesn't appear in ANSI). Once you find that, look upward until you find a set of eight FFs, since this shows where the mesh data begins. There will be a set of hex values that increment by 1, followed by three 00s (ie. E5 00 00 00 E6 00 00 00). Follow those values until they stop incrementing. The value that follows will by the number of vertices the mesh has; in this case, the BigMan has E9 vertices, which is 233 in decimal. After the number of vertices comes the number of animation frames. Keep in mind that Unreal archives are in Little Endian format, so instead of the BigMan having 9B 01 (39,681) frames, it has 01 9B (411) frames. Save both of these values (and their locations) somewhere, you'll need them later. See http://en.wikipedia.org/wiki/Endianness for more information on little endian.
Image

Follow the pattern downward until you find another set of eight FFs. The value after that pattern is the number of polygons in the mesh. In this case, the model has 454 polygons. The should be another set of eight FFs. Look for 01 01 00 00; the animation data begins after this.

Image

Now that we know where the data is located, it's time to make the data (_d.3d) and aniv (_a.3d) files that can be imported into Unreal. I like to start with the model, so go back to the location in the file that has the number of animation frames. You should see two FFs; you'll need to copy everything after the next 46 bytes until you reach the end of the model data.

Make a new file and insert 50 bytes (all 0). Paste what you copied earlier, and then go to the very beginning of the file and enter the number of polygons and vertices. The result should be like this:

Image

Save the file and give it a name that ends with _d.3d.

Go back to the archive and select and copy all of the animation data.

Image


Make a new file and enter the number of frames that you found earlier. Using the calculator, multiply the number of vertices (in hexadecimal) by four. Put that value in little endian right after the number of animation frames. The BigMan has E9 vertices, which is A4 03 in little endian (03 A4 in big endian) when multiplied by four. Paste the animation data. The result should look like this:

Image

Save the file with the same name as the data file, but make it end in _a.3d instead of _d.3d.

UnrealFX shows that the animations play without any problems...
Image

...and so does the Unreal Editor!

Image

That's all there is to extracting vertex meshes. I haven't tried this with anything aside from the tech demo, beta, and unpatched Unreal, but it should (generally) work for other versions and UT.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: (Image Heavy) Extract Unreal vertex meshes the hard way

Post by JackGriffin »

Images! This is a great tut but it needs the pics.
So long, and thanks for all the fish
AlCapowned
Experienced
Posts: 130
Joined: Mon May 16, 2011 2:45 am
Personal rank: Layman

Re: (Image Heavy) Extract Unreal vertex meshes the hard way

Post by AlCapowned »

I can see them. Are they not appearing for you? They are pretty big, so they might be taking a while to load.
User avatar
Creavion
Godlike
Posts: 4497
Joined: Sun Feb 17, 2008 7:23 pm
Personal rank: About to be non-act.
Location: Germany, Lower Saxony

Re: (Image Heavy) Extract Unreal vertex meshes the hard way

Post by Creavion »

I can see the images as well, otherwise the forum supports up to five attachments (each up to 2 MB).
Rather tricky, I wonder how people figure out stuff like this. Kudos to you! I am glad the forum still has some users with brain left. Yes, I payed you a compliment, without any irony. :tongue:
About to be non-active
My very last UT map project: CTF-FacePalm (tropical CTF-Face remake)
Why do I leave? click here
What I want to do next: Joining an UDK team (uncertain however) and improve 3D modelling and texture editing skills
Thanks to those who visibly supported me until/at the end!
My reactivated account on indiedb.com.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: (Image Heavy) Extract Unreal vertex meshes the hard way

Post by Feralidragon »

Creavion wrote:Rather tricky, I wonder how people figure out stuff like this.
Unreal package binary documentation + _d.3d+_a.3d format documentation + minimal knowledge on how stuff works at binary level + some reverse engineering for the undocumented bits
???
PROFIT!

I made a php script myself that literally dissects an entire .u (or any .umx, .unr, etc, they're all the same) file to get dependencies, and can be extended to get more info or even extract stuff like this (but not limited to).
It takes some work to understand how the stuff is organized in the package, but once you do, stuff like this is "easy" to do (as long as you perfectly understand what you're looking at in the hex editor).

Still, hats off to this brilliant tutorial :tu:
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: (Image Heavy) Extract Unreal vertex meshes the hard way

Post by JackGriffin »

Sorry Al, it was indeed Adblocker Plus FireFox extension that was blocking your pics. I turned it off for this page and bam there they are. Sorry about that!
So long, and thanks for all the fish
AlCapowned
Experienced
Posts: 130
Joined: Mon May 16, 2011 2:45 am
Personal rank: Layman

Re: (Image Heavy) Extract Unreal vertex meshes the hard way

Post by AlCapowned »

No problem, that happens to me too. :tongue:
Post Reply