Qfg5model

From Quest For Glory Mods
Jump to: navigation, search

Comparison.png

Over at the Quest for More Glory Forums richardbrucebaxter and GMFattay with contributions from others, have written a small command-line program to export and import textures and meshes from the game. The current release also supports importing higher resolution textures and meshes.

Exporting & Importing textures and 3d meshes using qfg5model

You can extract MDL files files from SPK archives using Game Extractor. The MDL files are located in the hdnw.SPK archive.

Put any modified MDL files under QFG5/Data/MDL and the game engine will load the modified files over the original files.

If you wish to preview any created character skins in the game, you can use the save game editors available here: qfg5_save_editors.rar. Just create a save game and change the hero's model to the character you wish to preview.


Usage: qfg5model <input file> <output file>

To export MDL to BMP, set input file .MDL and output file .BMP

To import BMP to MDL, set input file .BMP and output file .MDL

To export MDL to HAK, set input file .MDL and output file .HAK

To import HAK to MDL, set input file .HAK and output file .MDL

HAK = 3D mesh (to generate high resolution mesh use hakenberg subdivision


The current release is available here: qfg5modelDevel-08March2013cSMALL.zip

Texture Upgrades using qfg5model

Here is an example of how to upgrade a model's skin (e.g. 010.MDL):

1. Follow the .MDL extraction procedure. To extract an MDL file from a QFG5 .SPK archive:

  • Ensure Java Runtime Environment (JRE) is installed (java.com/en/download/index.jsp, e.g. jre-7uX-windows-i586.exe/x64.exe)
  • Download and install WinRAR (http://www.rarlab.com/download.htm e.g. wrar420.exe)
  • Download QFG5 SPK plugin (Plugin_SPK_2.zip)
  • Download and Install Game Extractor (http://www.watto.org/extract/info.html / extract_201.exe) - may require administrator privileges
  • Use WinRAR to open [Game Extractor installation folder]/GameExtractor.jar, and add file Plugin_SPK_2.class
  • Run Game Extractor - may require administrator privileges (right click - run as administrator)
  • Open [QFG5 installation folder]/Data/HDNW.SPK with Game Extractor
  • Find and extract an MDL file (eg mdl/010.MDL)

2. Upgrade the model's texture using qfg5model:

  • Download and install the latest version of qfg5model.exe (qfg5modelDevel-08March2013cSMALL.zip)
    • To compile it yourself use MS Visual C++ 2010 (open qfg5model.sln, and Build All / click F7)
  • Create a backup of original MDL file (copy 010.MDL 010original.MDL)
  • Place 010.MDL in the same folder as qfg5model.exe
  • Open Windows command prompt (Start - search - cmd)
  • cd [qfg5model.exe installation folder]
  • qfg5model.exe 010.MDL 010.BMP
  • Enhance 010.BMP using an image editor (e.g. Photoshop/PSP/GIMP) and increase its resolution
    • (Ensure to save the image back to a 256 bit palette. E.g. save the original 256 color palette, perform image touch ups, then reapplying it)
  • qfg5model.exe 010.BMP 010.MDL

3. Install the MDL File and play QFG5:

  • Copy the MDL file to the [QFG5 installation folder]/Data/mdl folder (create this folder if it doesn't exist)
  • Play the game (see directions above regarding save game editors for previewing your changes)

Example Screenshots;

3D Mesh Upgrades using qfg5model

Here is an example of how to upgrade a model's 3D Mesh (e.g. 010.MDL):

1. Follow the .MDL extraction procedure. To extract an MDL file from a QFG5 .SPK archive:

  • Ensure Java Runtime Environment (JRE) is installed (java.com/en/download/index.jsp, e.g. jre-7uX-windows-i586.exe/x64.exe)
  • Download and install WinRAR (http://www.rarlab.com/download.htm e.g. wrar420.exe)
  • Download QFG5 SPK plugin (Plugin_SPK_2.zip)
  • Download and Install Game Extractor (http://www.watto.org/extract/info.html / extract_201.exe) - may require administrator privileges
  • Use WinRAR to open [Game Extractor installation folder]/GameExtractor.jar, and add file Plugin_SPK_2.class
  • Run Game Extractor - may require administrator privileges (right click - run as administrator)
  • Open [QFG5 installation folder]/Data/HDNW.SPK with Game Extractor
  • Find and extract an MDL file (eg mdl/010.MDL)

2. Extract the HAK file from the MDL file:

  • Download and install the latest version of qfg5model.exe (qfg5modelDevel-08March2013cSMALL.zip)
    • To compile it yourself use MS Visual C++ 2010 (open qfg5model.sln, and Build All / click F7)
  • Create a backup of original MDL file (copy 010.MDL 010original.MDL)
  • Place 010.MDL in the same folder as qfg5model.exe
  • Open Windows command prompt (Start - search - cmd)
  • cd [qfg5model.exe installation folder]
  • qfg5model.exe 010.MDL 010.HAK
    • Note this will generate HAK files for each submesh within 010.MDL; eg 010-0-footleft.hak

3. Convert HAK file using Hakenberg subdivision software:

  • Download hakenberg software. The Hakenberg mesh3d.exe/subdiv.exe program can be downloaded along with the source code on their website
  • Either a) use subdiv.exe straight from subdivision.zip [untested]) or b) compile a version of mesh3d.exe from the source code (volutil.zip) using Visual C++ 2010
    • To compile one's own version of the Hakenberg subdivision software:
      • Create MS Visual Studio 2010 console project
      • import relevant .cpp/.hpp files
      • Build All / click F7, and manually fix up all compilation errors;
        • Comment out all error throwing template references; eg template <class type> array<type>::array(char *fn)
        • In array.hpp, comment out this line; //if (array_output) cout << fn << " ->\t" << *this;
      • Open Start - All Programs - MS Visual Studio 2010 Express - Visual Studio Command Prompt (2010).
        • Note this will enable use of cl.exe (the VS compiler) within compile.bat. The software must be compiled using cl.exe to use it (else it may crash).
      • cd [mesh3d.exe installation folder]
      • compile.bat
  • Execute subdiv.exe/mesh3d.exe manually or create and execute a script (e.g. qfg5modelHAKconversionExampleScript.bat)
    • High resolution example: mesh3d.exe 010-0-footleft.hak b s
    • Ultrahigh resolution example: mesh3d.exe 010-0-footleft.hak b s s
      • Note this will generate .hak.out files

4. Import the HAK(.out) files into the MDL file

  • to prevent having to rename the .hak.out files back to .hak you can uncomment '#define MDL_DEVEL_IMPORT_HAK_FILE_EXPECT_APPENDED_DOT_OUT_TO_FILE_NAME' in stdafx.h (and recompile qfg5model.exe)
  • qfg5model.exe 010.HAK 010.MDL

5. Perform manual touch-ups to high resolution mesh (e.g. nose shape);

  • Create a backup of the new high resolution MDL file (copy 010.MDL 010highres.MDL)
  • locate the high resolution .HAK(.out) files generated by mesh3d.exe
  • export high res LDR files from the high resolution MDL file (qfg5model.exe 010.MDL 010.HAK)
    • (note this will also export a new set of high resolution HAK files if the original ones generated by mesh3d.exe are not available)
  • open the LDR file corresponding to the problematic submesh with LDView (e.g faceX), and identify which polygons/vertices need modification (use LDView in conjunction with a text editor, e.g. TextPad, to determine the specific nature of those modifications, e.g. move vertex XYZ by +q in the Y direction)
  • manually apply these modifications to the corresponding high res HAK file (using a text editor)
  • reimport the (touched-up) high res HAK files into the original MDL file
    • copy 010original.MDL 010.MDL
    • qfg5model.exe 010.HAK 010.MDL

6. Install the MDL File and play QFG5:

  • Copy the MDL file to the [QFG5 installation folder]/Data/mdl folder (create this folder if it doesn't exist)
  • Play the game (see directions above regarding save game editors for previewing your changes)

Downloads

The latest source (qfg5model.exe);

High resolution meshes (does not include high resolution textures);

HR Hero Texture MDL and PSD source

Batch scripts;

Submodel screenshots (HAK/LDR);


  • qfg5modelWithHakenberg3dMesh-medResDemo.gif

  • qfg5modelWithHakenberg3dMesh-hiResDemo.gif

  • qfg5modelWithHakenberg3dMesh-ultraHiResDemo.gif

Short in-game animations (<2MB);

Example in-game screenshots;


  • batty1.png

  • cerberus1.png

  • guards1.png

  • hippie.png

  • katrina.png

  • ogres2.png

  • pegasus1.png

  • pegasus2.png

  • rakeesh.png

  • statue1.png

  • town1.png

  • town2.png

  • wolfie1.png