Tomb Raider Forums  

Go Back   Tomb Raider Forums > Tomb Raider Level Editor and Modding > Tomb Raider Modding > XNALara

Reply
 
Thread Tools
Old 03-06-10, 19:09   #1
Dusan
XNALara Creator
 
Joined: Sep 2008
Posts: 1,347
Default Import TRL levels into XNALara

Here I will provide a brief tutorial how to extract levels from TR Legend and import them into XNALara.
I hope people will find this useful and will feel encouraged to extract levels from TRL and share them with others in XNALara .


You'll need the following tools:

TRLTool by Dark Fader
GraveRobber by Turfster
TRLMeshConv and obviously XNALara, both by me



1) First, install trltool. Unzip the trltool archive somewhere on your harddisk and run the file trltool.exe. When you first run the program, you'll need to choose the option Tomb Raider: Legend from the drop-down box at the bottom left-hand corner of the application window. Next, you'll be asked to tell the program where to find your TR Legend root folder (and in it all the bigfiles). You'll need to do this just once.

Once you've installed trltool, you are ready to use it. You should now see a list of all data files stored in the TRL bigfiles. You'll be only interested in DRM files. You can use the filter on the right to display only DRModel files and no others.
You can also sort the file list by file names, file sizes etc. This is very useful.

Try to extract file pc-w`flashback1.drm. You do this by dragging-and-dropping the file from the file list outside the trltool application window - on the desktop (not much recommended), or into a different folder somewhere on your harddisk etc. It's generally a good idea to extract the file to a new folder that you've created for that purpose.

The file will be extracted as BFAD383E#pc-w`flashback1.drm. I highly recommend to rename the file to something shorter, such as flashback1.drm.



2) Now that you have extracted the DRM file, you need the other tool, GraveRobber. So first unrar the program and then run the file GraveRobber.exe.

Open the file flashback1.drm in GraveRobber. Either click the Open button on the right or drag-and-drop the DRM file onto the application window.

You should now see a list of different data files stored inside the DRM file displayed in the list in the right part of the application window.

The following section may seem tricky at first but it's quite easy.

Click on the file list on the right so that it gets focus. (This is important, otherwise the following shortcuts aren't going to work.)

Press Ctrl+S to multi-select files in the list. A dialog window will pop up. Into the textbox type trltex. All *.trltex data files (i.e. textures) in the list will be selected. Then press F4 to extract the textures as TGA files.

Now, click on the file list again for focus and press Ctrl+U to clear the selection and then press Ctrl+S again to define a different selection. This time type trlmesh into the textbox that has popped up. All mesh files will be selected. Then press Ctrl+E to extract those files as they are (no conversion).

You can close GraveRobber now, we will not need it any longer. If everything worked correctly, you should now see new TGA and TRLMESH files that have been extracted into the same directory where you placed the DRM file in the previous step.



3) Now to convert all those files into data formats that XNALara will understand. Copy the program TRLMeshConv.exe into the directory where all your TGA and TRLMESH files are, and from the command line run it like this:

Code:
TRLMeshConv model.obj 2.5
The first parameter specifies the name of the output OBJ file (model.obj) and the second parameter specifies a value by which all vertex colors (lights vs. shadows) will be multiplied during the conversion. The default value 1.0 would typically leave the level too dark. On the other hand, if you set the value too high, all vertex colors will be "over-exposed" and you'll miss shadows altogether. The particular value seems to be different for each level so you'll need to experiment a bit here.
For flashback1.drm, a good value seems to be something like 2.5.

The conversion process will start. All TGA textures will be converted to PNG images, and all TRLMESH files will be merged into a single OBJ file - plus a corresponding MTL file with material definitions.



4) Copy or move the OBJ+MTL files and also all PNG textures into a new directory inside XNALara/data, and try to open the model in XNALara .

You'll notice that there is a relatively small, fixed skybox (actually a hemi-sphere) in this particular level.

You may want to move and resize it, or even to remove it altogether in Blender.



5) Optional step: in order to import the level into Blender, to do some editing, and then to export it again (and load it into XNALara), use the following Blender scripts:

ImportObjX.py
ExportObjX.py

(Note that the standard OBJ importer/exporter won't do here because I extended the OBJ format to include vertex colors which aren't supported by the standard OBJ file format).

Last edited by Dusan; 04-06-10 at 05:29.
Dusan is offline   Reply With Quote
Old 03-06-10, 19:42   #2
tombraidergale
Member
 
tombraidergale's Avatar
 
Joined: Feb 2008
Posts: 1,470
Default

Thanks for the tutorial, it works great... I exported the main area of Ghana, it works great in XNA, now I'm waiting for Blender to load the model, it's slow, I think it's my PC

EDIT: it's been loading for 10 minutes now, I think Blender crashed

Last edited by tombraidergale; 03-06-10 at 19:48.
tombraidergale is offline   Reply With Quote
Old 03-06-10, 21:34   #3
H4RR7H
Member
 
H4RR7H's Avatar
 
Joined: Jun 2007
Posts: 4,997
Default

Extremely useful - thanks a lot Dusan

Also, feel like writing a synonymous tutorial for TRU via your lovely UnpackTRU?
H4RR7H is offline   Reply With Quote
Old 03-06-10, 22:45   #4
Love2Raid
Member
 
Love2Raid's Avatar
 
Joined: Nov 2008
Posts: 20,726
Default

Really awesome!!

Maybe people who are trying this should post in this thread which levels or level areas they are working on, to avoid that multiple members are working on the same level? Just an idea.
Love2Raid is offline   Reply With Quote
Old 03-06-10, 22:58   #5
Peanut
Member
 
Peanut's Avatar
 
Joined: Apr 2009
Posts: 4,571
Default

Cool.
Can we export TRA levels?
Peanut is offline   Reply With Quote
Old 04-06-10, 04:38   #6
Dusan
XNALara Creator
 
Joined: Sep 2008
Posts: 1,347
Default

Quote:
Originally Posted by tombraidergale View Post
Thanks for the tutorial, it works great... I exported the main area of Ghana, it works great in XNA, now I'm waiting for Blender to load the model, it's slow, I think it's my PC

EDIT: it's been loading for 10 minutes now, I think Blender crashed
Importing to Blender is extremely slow for some levels, I'll try to speed it up.


Quote:
Originally Posted by H4RR7H View Post
Also, feel like writing a synonymous tutorial for TRU via your lovely UnpackTRU?
Levels in TRU are much more tricky, there are no vertex colors, there are many layers of textures, and so the process is very different. Moreover, XNALara even isn't technologically compatible with this concept. I managed to import a few TRU levels into XNALara but in all cases I had to write special little programs to do that (for that particular level), and for most levels it wasn't even possible - because of that technological difference.

Quote:
Originally Posted by Peanut View Post
Can we export TRA levels?
Unfortunately, no export tool for TRA exists.

Last edited by Dusan; 04-06-10 at 04:44.
Dusan is offline   Reply With Quote
Old 04-06-10, 05:05   #7
H4RR7H
Member
 
H4RR7H's Avatar
 
Joined: Jun 2007
Posts: 4,997
Default

^ Ok. Darn :/

TRU's OBJs with materials are still completely extractable however, with UnpackTRU, for use in external applications

Also, I thought trltool also worked for TRA
H4RR7H is offline   Reply With Quote
Old 04-06-10, 05:32   #8
Dusan
XNALara Creator
 
Joined: Sep 2008
Posts: 1,347
Default

Update:

I uploaded a much faster version of the Blender script ImportObjX.py so please download it

(There was a problem with some particularly large levels that took ridiculously long to import into Blender - this is fixed now.)








Quote:
Originally Posted by H4RR7H View Post
Also, I thought trltool also worked for TRA
Yes, but I still doubt that TRLMeshConv is going to work with TRA levels - I think the data format is very different...

Last edited by Dusan; 04-06-10 at 05:35.
Dusan is offline   Reply With Quote
Old 04-06-10, 12:32   #9
Lara_maniac
Inactive
 
Lara_maniac's Avatar
 
Joined: Mar 2010
Posts: 902
Default

sorry Dusan when i open TRLMeshConv.exe into the directory where all the tga and mesh files are the black window appear only for an half second, so i can't write the command that you've wrote (TRLMeshConv model.obj 2.5) why? where i'm wrong? thanks and sorry for my english
Lara_maniac is offline   Reply With Quote
Old 04-06-10, 12:46   #10
tombraidergale
Member
 
tombraidergale's Avatar
 
Joined: Feb 2008
Posts: 1,470
Default

You have to open the Command Prompt, then go in your folder typing "cd [insert full location of your folder here]" (without the ""), and then type the command

(for example: "cd C:\Documents and Settings\User\Desktop\Folder")

Last edited by tombraidergale; 04-06-10 at 12:49.
tombraidergale is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 12:58.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Tomb Raider Forums is not owned or operated by CDE Entertainment Ltd.
Lara Croft and Tomb Raider are trademarks of CDE Entertainment Ltd.