Importing Models Into Everquest 2

Topics related to tools created by the Core Team or 3rd-party community members.

Moderator: Team Members

Post Reply
Tiger
Posts: 18
Joined: Thu Dec 25, 2008 1:20 pm
Location: New York

Importing Models Into Everquest 2

Post by Tiger » Sun Nov 18, 2012 3:37 pm

I have figured out enough of the model format (.draw) that EQ2 uses, so that I can convert arbitrary 3d models, into the .draw format, and get the game to load them. First a screenshot (The model in the screenshot I converted was a deer model, from the Playstation2 game "Trophy Bucks"):
Image

The model it replaced was "cooked\interiors\scenes\objects_race\human\chests_crates\ss_crate_small01_l0.draw", which can be seen in the eq2emulator, by using the /race 5149
where the 5149 is the appearance ID for "_exp01/zones/objects/containers/ss_crate_small01"
You can get the appearance ID table (which is called appearance.dat and is just a text file) and also everything .draw file from extracting them using Blaz's Eq2VpkTool:
http://eq2.blazlabs.com/

To replace files, and have the game use them, a .vpk file must be extracted with file paths, to your directory that has everquest2.exe.
For example the crate file I replaced in the screenshot was from the vpk file called
"dpo_housing.vpk"
to get the vpk tool to only extract just one vpk, file, make a new folder any place outside of your eq2 folder. Then inside of it, copy, everquest2.exe, and all of the .dll files. Then in that folder, make an empty folder called "PAKS", then just put in a single vpk, for example dpo_housing.vpk. Then double click everquest2.exe, and the .exe will generate a new assetslib.vpl which can be used with the EQ2VpkTool. Then use that tool, to extract all of those files, with path information, to your regular everquest2 folder. Then delete or remove (what I do is just rename the extension, so the game does not load it, for example dpo_housing.xvpk), dpo_housing.vpk from your old eq2 pak folder, and the game, will use the extracted files, instead of the .vpk.

Now you can start editing and replacing files. I wrote a script to convert, .3ds files (must contain only one model, with one set of UV's, nothing with bones deformers ect or it will not work but I will add support for those later) (which has importers and exporters for practically all 3d editing programs, blender, Maya, Cinema 4D, milkshape ect).
The script is a quickbms script so you need the free and open source program quickbms:
http://aluigi.altervista.org/quickbms.htm
Here is the script to convert .3ds files into .draw files
http://ps23dformat.wikispaces.com/file/ ... Q2Draw.bms

Code: Select all

open FDSE ? 1 ;
log MEMORY_FILE1 0 0 ;
findloc OFFSET string "\x10\x41" 0 0 ;
GoTo OFFSET 0 ;
GoTo 2 0 SEEK_CUR ;
GoTo 4 0 SEEK_CUR ;
Get vertexnumber Short 0 ;
SavePos vertexstart 0 ;
Math jump = vertexnumber ;
Math jump *= 12 ;
GoTo jump 0 SEEK_CUR ;
GoTo 6 0 SEEK_CUR ;
Get facenumber Short 0 ;
Math f3 = facenumber ;
Math f3 *= 3 ;
SavePos facestart 0 ;
Math jump = facenumber ;
Math jump *= 8 ;
GoTo jump 0 SEEK_CUR ;
findloc OFFSET string "\x00\x00\x01\x00\x02\x00\x03\x00" 0 0 ;
GoTo OFFSET 0 ;
GoTo -2 0 SEEK_CUR ;
Get d Short 0 ;
Math jump = d ;
Math jump *= 2 ;
GoTo jump 0 SEEK_CUR ;
GoTo 6 0 SEEK_CUR ;
Get uvnumber Short 0 ;
SavePos uvstart 0 ;
Math v12 = vertexnumber ;
Math v12 *= 12 ;
Math testlion = vertexnumber ;
Math testlion *= 30 ;
Math testtiger = facenumber ;
Math testtiger *= 6 ;
Math feline = testlion ;
Math feline += testtiger ;
Math feline += 52 ;
Math feline += 177 ;
Math facenumberprime = facenumber ;
Math facenumberprime *= 3 ;

For q = 1 To feline ;
Put 0 Byte MEMORY_FILE1 ;
Next q ;



GoTo 0 MEMORY_FILE1 ;
set M Byte 0x0C ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x56 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x65 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x52 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x65 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x6E ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x64 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x65 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x72 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x4D ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x65 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x73 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x68 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x02 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x0F ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x00 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x00 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x00 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x00 ;
Put M Byte MEMORY_FILE1 ;
set M Byte 0x00 ;
Put M Byte MEMORY_FILE1 ;
Put vertexnumber Long MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
For hhh = 1 To vertexnumber ;
GoTo vertexstart 0 ;
Get Type1 Long 0 ;
Get Type2 Long 0 ;
Get Type3 Long 0 ;
SavePos vertexstart 0 ;
GoTo gold MEMORY_FILE1 ;
Put Type1 Long MEMORY_FILE1 ;
Put Type2 Long MEMORY_FILE1 ;
Put Type3 Long MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
Next hhh ;
Put vertexnumber Long MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
For ggg = 1 To vertexnumber ;
GoTo gold MEMORY_FILE1 ;
Put 0 Byte MEMORY_FILE1 ;
Put 0 Byte MEMORY_FILE1 ;
Put 0x80 Byte MEMORY_FILE1 ;
Put 0x3F Byte MEMORY_FILE1 ;
Put 0 Long MEMORY_FILE1 ;
Put 0 Long MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
Next ggg ;
Put vertexnumber Long MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
For fff = 1 To vertexnumber ;
GoTo uvstart 0 ;
Get Type1 Long 0 ;
Get Type2 Long 0 ;
SavePos uvstart 0 ;
GoTo gold MEMORY_FILE1 ;
Put Type1 Long MEMORY_FILE1 ;
Put Type2 Long MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
Next fff ;
GoTo gold MEMORY_FILE1 ;
GoTo 16 MEMORY_FILE1 SEEK_CUR ;
SavePos gold MEMORY_FILE1 ;
Put facenumberprime Long MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
For ddd = 1 To facenumber ;
GoTo facestart 0 ;
Get Type1 Short 0 ;
Get Type2 Short 0 ;
Get Type3 Short 0 ;
Get Type4 Short 0 ;
SavePos facestart 0 ;
GoTo gold MEMORY_FILE1 ;
Put Type1 Short MEMORY_FILE1 ;
Put Type2 Short MEMORY_FILE1 ;
Put Type3 Short MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
Next ddd ;
Get ZE ASIZE 1 ;
Math qp = 0 ;
GoTo gold MEMORY_FILE1 ;
Put 01 Long MEMORY_FILE1 ;
Put 02 Long MEMORY_FILE1 ;
Put 00 Long MEMORY_FILE1 ;
Put vertexnumber Long MEMORY_FILE1 ;
Put 00 Long MEMORY_FILE1 ;
Put facenumber Long MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
For sss = 1 To ZE ;
GoTo qp 1 ;
Get zxc Byte 1 ;
SavePos qp 1 ;
GoTo gold MEMORY_FILE1 ;
Put zxc Byte MEMORY_FILE1 ;
SavePos gold MEMORY_FILE1 ;
Next sss ;
Get SIZE ASIZE MEMORY_FILE1 ;
Log fprt_hood_crate_small01_l0.draw 0 SIZE MEMORY_FILE1 ;
You also need a binary file which just has information about UV sets (will add support for multiple UV sets later), I call it shader.dat
http://ps23dformat.wikispaces.com/file/view/shader.dat

Code: Select all

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 03 00 FB EC 
57 01 00 00 00 3E 00 66 70 72 74 5F 68 6F 6F 64 
73 5F 65 6E 74 72 79 5F 67 61 74 65 5F 77 6F 6F 
64 77 65 61 74 68 65 72 65 64 5F 30 31 5F 66 70 
72 74 5F 68 6F 6F 64 5F 63 72 61 74 65 73 5F 73 
68 61 64 65 72 00 DC 0A 3C 50 21 C0 3E 00 00 F2 
39 41 2E 26 3F 00 00 C0 BE 50 21 C0 BE 40 89 BF 
BE 00 00 C0 3E 50 21 C0 3E 40 89 BF 3E 00 00 00 
00 00 00 00 00 00 00 00 00
Here are the instructions to run the script:

Code: Select all

This is a QuickBMS script (http://aluigi.altervista.org/quickbms.htm).
Source Code for QuickBMS is on the website.
The script must be run using the Microsoft Windows Command Prompt (it will not work if you double click quickbms.exe)

Put 3dstoeq2draw.bms and shader.dat in your quickbms folder, along with a .3ds file that you want to convert.
Then on the commandline, put something like the following but with H:\3 replaced with the path to your quickbms folder. The -w must be lower case.

H:\3\quickbms.exe -w H:\3\3dstoeq2draw.bms H:\3\gooddeer.3ds H:\3


Then when it says
"you must choose the name of the other file to load:"
Type in shader.dat
I want to make a program that combines all of the steps above, with a graphical user interface, previews ect. I will answer all questions, and will try to max out all of the settings EQ2 (EQ2 supports bump maps, cube maps, deformers so I hope to also support that too once I make a proper program, that does everything easily instead of the hodgepodge of steps I wrote above.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Importing Models Into Everquest 2

Post by John Adams » Sun Nov 18, 2012 7:35 pm

Thank you Tiger for sharing your discoveries. This is pretty exciting stuff for those wishing to create truly custom worlds!

Tiger
Posts: 18
Joined: Thu Dec 25, 2008 1:20 pm
Location: New York

Re: Importing Models Into Everquest 2

Post by Tiger » Tue Nov 20, 2012 3:43 pm

I figured out why the texture was not showing up, by looking into the alertlog.txt file, it complained about how the shader specified UV set 1, while the model contained only one. Looking into things EQ2 apparently calls the first UV set, as set 0, the second as set 1, ect. So after removing the references to set 1, I got the new textures to show, but I still got to out, how the orientation needs, to be, so I am downloading some dds tools.
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests