Friday, December 14, 2018

JediFirefly Gaming: Old DAT Modding Tutorials from 2008

Here's some old videos from ten years ago (Jesus Christ has it really been that long!?) that go over some of the basics of simple DAT swapping, as well as editing models in a program called Virtual Reality Studio (VRS). I did not make these videos. I'm simply sharing them here for the sake of convenience.

DAT Modding Part 1 - Basic DAT Swapping:


Basic DAT Swapping - Taking 1 in-game model and switching it for another.

DAT Modding Part 2 - Basic DAT Swapping 2:


Basic DAT swapping using downloaded DAT mod's instead of in-game models.

DAT Modding Part 3 - Basic DAT Editing:


Basic DAT editing - Removing unwanted parts of an armor model.

Tuesday, November 20, 2018

AreaDemo Patched to Work With North American Client

Many of you probably remember the old AreaDemo program I talked about back in April of 2017. Well, one of the people who's been helping me with my zone conversion project, a guy who goes by the username atom0s, has taken the initiative to hack AreaDemo and do a custom patch that allows the program to work with the North American version of FINAL FANTASY XI. As a result, AreaDemo is now brain dead easy to use, whereas before it was a huge pain in the ass.

You can download this new patched version of AreaDemo from the following Dropbox folder:

Dropbox Download:
AreaDemo.US.patch.by.atom0s.7z

And if you happen to bump into atom0s anywhere, be sure to tell him thanks!

List of Model Viewer Programs for FINAL FANTASY XI

There are several different model viewing programs for FFXI, and it can be difficult to keep track of them all because they're spread out over many different websites and forums. That's why I decided to put together this list, so people could have a centralized hub that would make it easy to find whatever program they were looking for.

Character Viewer Programs:

Zone Viewer Programs:

Other Community Resources:


Other links and resources will be added to this list as I learn of them.

Fixing Noesis Exports in Maya

While it is certainly possible to just import an FFXI zone model directly into Unreal Engine 4 (or Unity, if that's the game engine you prefer), sometimes it helps to fix the zone up first by editing it in a 3D modeling program such as Maya or 3Ds Max (both published by Autodesk). There don't appear to be any major issues when importing FFXI zone models into 3Ds Max, so I won't bother covering that. However, there are some relatively minor issues that occur when importing FFXI zone models into Maya, and this tutorial will go over how to fix them.

The first issue is that Maya doesn't like for there to be any whitespace in the names of object meshes, materials, or texture nodes. If Maya encounters any whitespace characters in names of these object nodes, it will replace each instance with some variation of "FBXASC0##" (the ## will be either 32, 48, or 49). This is of course assuming you exported your FFXI zone model as an FBX file using Noesis. If you exported using the OBJ file format, you'll probably get something different.

For this tutorial, I loaded the zone Ru'Aun Gardens, which should be located at ROM2/12/107.DAT in the FFXI root directory, and I used the following advanced options in Noesis:

Advanced Load Options:

-ff11blendhack 0.99 -ff11renderunref -ff11keepnames -ff11optimizegeo

Advanced Export Options:

-rotate 180 0 -90 -fbxsmoothgroups -fbxtexrelonly -fbxtexext .tga

I exported the model as an FBX, and used TGA as the file format for my textures. I then opened up a new scene in Maya, and imported the FBX file I had just created. This was the result:


Pretty ugly, right? Nobody wants to deal with object names like that. It's impossible to read! Thankfully, this problem is incredibly easy to fix. Simply go to the "Modify" dropdown menu on the main toolbar, and then select the "Search and Replace Names..." option about halfway down.


In the options box that pops up, simply type "FBXASC032" the field labeled "Search for:", and type an underscore in the field labeled "Replace with:". (An underscore is that short little line character: "_". We use an underscore instead of a space because Maya doesn't like whitespace.) Then just hit the "Apply" button multiple times until every instance of "FBXASC032" has been replaced with an underscore.


Then do the same thing again, except this time search for instances of "FBXASC048" and replace them all with an underscore followed by the number zero (i.e. "_0"). And finally, repeat the process a third time for instances of "FBXASC049" and replace them all with an underscore followed by the number one (i.e. "_1").

Search for:Replace with:
FBXASC032_
FBXASC048_0
FBXASC049_1

Note that you will have to click the "Apply" button many, many times when replacing instances of FBXASC032, but instances of FBXASC048 and FBXASC049 should only require a single click each. When you're done, the names of your mesh geometry should look something like this:


There we go, that's much better!

Double-check the Hypershade window (Windows → Rendering Editors → Hypershade) to ensure that the naming problems have also been fixed on all of your materials, textures, utilities, and shading groups. We don't want there to be any naming issues anywhere.


This should fix all the naming problems that occur when importing FFXI zone meshes into Maya.

This tutorial is a work in progress. If I encounter any other issues with importing FFXI zone geometry into Maya, I will add them into this tutorial.

Tuesday, October 23, 2018

Quick Start Guide: Importing FFXI zones into Unreal Engine 4

This tutorial will teach you how to extract zones from FINAL FANTASY XI and import them into Unreal Engine 4 using a program called Noesis. You will need to have FFXI installed. You can download the FFXI game client from the game's official website. It is not necessary to actually have an active FFXI account in order to extract the zone files. Simply having the game installed is enough, though if your game client is not updated, you will be unable to load zones that were added to the game via updates.

Loading Into and Exporting From Noesis:

The first step is to create or download a Noesis scene file, which is just a text file, except that it uses the extension ".noesis" instead of ".txt" like a regular text file. You can edit the Noesis scene file in Windows Notepad, or any other standard text editor. Notepad++ is a good option, too. When creating or editing a scene file, note that white space doesn't really matter. Noesis will parse the file the same regardless of whether you use tabs or spaces, so use whichever you prefer.

If you would rather just download a ready-made Noesis scene file instead of creating your own, you can grab one from the following Dropbox folder:

Dropbox Download: Noesis Scene Files - FFXI Zones

A proper scene file should look something like this:


The purpose of creating a scene file is so that you can take advantage of the special advanced load options that Noesis provides. Technically, you can load FFXI's zones without creating a scene file by just opening the corresponding DAT file from within Noesis, but doing it that way doesn't allow you to specify any load options, some of which are necessary to render the finalized geometry correctly after we export it. The load options you want to specify in your scene file are as follows:

Advanced Load Options:

-ff11blendhack 0.99 -ff11keepnames -ff11optimizegeo

There is one advanced load option in particular that I would actually recommend against using unless you have a 3D modeling program and corresponding technical skills, and that's the "-ff11renderunref" command  (i.e. Render Unref), which renders unreferenced geometry — such as the skydome and water pieces — out in the middle of the zone. The reason I recommend against using this particular load option if you're new to this whole process is because the Render Unref command does not position the unreferenced geometry pieces correctly, but instead just spits them all out at identity, thus leaving you to pull them apart and manually place them yourself if you actually want to do anything with them. Trying to do that within Unreal Engine 4 is huge pain in the ass, so you practically need some kind of 3D modeling program to do it effectively and efficiently, and that's going to require more time and effort on your part. If you're just trying to extract a zone using Noesis and import it directly into UE4 as quickly as possible, then it's best to just leave off the Render Unref command.

Anyway, once you've created or downloaded your scene file, open it in Noesis, and then go to "File" → "Export from Preview," which will bring up the Export Media window below:


Click on the "Browse" button and create a new folder named after the zone you're exporting. It's also a good idea to use the zone name as the filename. Next, select the following output options:
  • For "Main output type," select ".fbx - Autodesk FBX."
  • For "Additional texture output," select ".tga - TGA Image."
  • For "Additional animation output," just leave it on "Default" as the selection.
  • For the "Advanced options" field, copy and paste the line of code under the "Advanced Export Options" heading below.
All other options can be left on their default settings.

Advanced Export Options:

-rotate 180 0 180 -scale 90 -fbxscalehack -fbxsmoothgroups -fbxtexrel -fbxtexext .tga
The order in which you list the advanced options does not matter.

Please note that there is a difference between Advanced Load Options and Advanced Export Options. Advanced Load Options do nothing if used as export options, and Advanced Export Options do nothing if used as load options.

A detailed explanation of each advanced option used in this tutorial is provided below:

Advanced Load Options:

-ff11blendhack <arg>

FF11 Blend Hack
sw render to determine alpha coverage, <arg>=min frac.
EXAMPLE: -ff11blendhack 0.99

Technically, this option isn't actually necessary at all. The only thing it does is enable transparencies within the Noesis viewer window. Even if this option isn't used, transparencies will still be exported if you save your texture files in a format that includes an alpha channel.

-ff11renderunref

FF11 Render Unref
render unreferenced map geo at identity.

This option will load in the skydome, the sun, the moon, water pieces, and other unreferenced pieces of geometry which are included in the DAT file but for which there is no position specified. It is assumed that in the official game, these pieces of geometry are placed by either SE's servers or the game client.

-ff11keepnames

FF11 Keep Names
keep map object names intact.

This option will prevent Noesis from renaming the mesh geometry pieces in the scene.

-ff11optimizegeo

FF11 Optimize Geometry
remove degenerates and redundant verts.

This option will combine overlapping and duplicate vertices. Without this option, every individual polygon in the entire scene will technically be a separate piece of geometry, which will cause very hard edges on everything.

Advanced Export Options:

-rotate # # #

Rotate X Y Z
transform all vertices by the given angles.
EXAMPLE: -rotate 180 0 180

Rotates the entire scene by 180 degrees on the X axis and the Z axis. Without this option, your zone will load upside down and backwards when imported into Unreal Engine 4.

-scale #

Scale
scale all vertices on the model, where # is the scale factor.
EXAMPLE: -scale 90

Use this option to increase the size of the zone to the proper dimensions. Without this option, the zone will be too tiny to walk around in when imported into Unreal Engine 4. If you forget this option, you can adjust the "Import Uniform Scale" option when importing into Unreal Engine 4.

-fbxscalehack

FBX Scale Hack
transform override for scale correction.

I'm still not entirely sure what this option does. It sounds likes something to do with the transform (i.e coordinate position) of the geometry, and is to be used in conjunction with the -scale option above. Maybe this command isn't necessary, though? I'm not sure. More experimentation is needed here.

-fbxsmoothgroups

FBX Smooth Groups
generate smoothgroups from vertex normals on export.

Unreal Engine 4 will complain at you if you try to import a 3D model that doesn't have smooth groups.

-fbxtexrel

FBX Tex Rel
only set relative paths for texture filenames.

This option is necessary to preserve the connection between materials and textures. Without it, the filepaths to textures will be incorrect, and models will import as grey and textureless.

NOTE: A previous version of this tutorial listed this option as -fbxtexrelonly instead of -fbxtexrel. Although the command -fbxtexrelonly was correct when this tutorial was originally written, the command was apparently changed in an update to Noesis at some point. I am not certain when exactly this change occurred, but the tutorial has now been updated to reflect this change.

-fbxtexext <arg>

FBX Tex Ext
appends given value to texture names on export.
EXAMPLE: -fbxtexext .tga
EXAMPLE: -fbxtexext .png
EXAMPLE: -fbxtexext .bmp

This option is also necessary to preserve the connection between materials and textures, as it allows you to specify the texture filetype extension. Without this option, UE4 won't be able to determine exactly which texture files its supposed to import for the materials, and so it won't import any, thus leaving your models grey and textureless. If you're saving your texture files in a format other than .tga, then replace ".tga" with the format that you're using.

NOTE: A previous version of this tutorial included an Advanced Export Option called -fbxmtlfrommeshname, which allegedly is supposed to create materials with names matching the pieces of geometry they're applied to. However, the option didn't appear to actually work (at least not for models extracted from FFXI), so I removed it from the tutorial.

Importing into Unreal Engine 4:

When you're importing the FFXI zone geometry into Unreal Engine 4, you'll want to enable the "Combine Meshes" option under the Advanced options for the Mesh section. Otherwise you'll get hundreds of little geometry pieces that will bog down your computer and make rendering a nightmare.


If you used the advanced scale option when you exported your zone from Noesis, then when importing into Unreal you should be able to keep the "Import Uniform Scale" option at its default value of 1.0. If you omitted the scale option in Noesis, then you should set "Import Uniform Scale" to 90.0 in Unreal. If you edit the zone in some other third-party 3D modeling software in between Noesis and Unreal, you may have to experiment with the "Import Uniform Scale" option until you find something that looks correct.


Material Setup:

If you entered the correct Advanced Export Options when you exported your zone data from Noesis, all of the materials should already be hooked up to the correct textures automatically. If everything is gray, go back and try to figure out what you did wrong.

Materials in FFXI can be grouped into four basic types: Standard, Decal, Shiny, and Foliage.

Standard Material Setup:

By default, materials in Unreal Engine 4 are slightly shiny, which does not match the aesthetic of FFXI as presented in the official game client. In order to get rid of the shininess, create a Constant with a value of 0 and plug it into the material's Metallic, Specular, and Roughness channels. Do this for all of the materials (this is very tedious and may take a while). Your finished standard material should look like this:


Decal Material Setup:

Some geometry pieces in FFXI are used as decals to add extra detail to the environment. However, in order to get the decals to display correctly in Unreal Engine 4, you will need to set up the corresponding decal material slightly differently from the standard material above. For decal materials, you should set up the material like this:


Foliage Material Setup:

In order to get materials for bushes and tree leaves to display correctly in UE4, plug the Alpha channel of the Texture Sample into the Opacity Mask channel of the material. Select "Masked" as the Blend Mode, change the Shading Model to "Two Sided Foliage," and put a check in the box for the Two Sided option. The finished foliage material should look like this:




Tuesday, September 18, 2018

Noesis – Advanced Commands

On the surface, Noesis may appear to be a relatively simple and straightforward program. But it actually has a lot of hidden depth to it. Most of this depth comes in the form of special advanced commands for loading and exporting data files. You can view a complete list of all advanced commands by opening the "Export Media" window and clicking on the "Advanced commands" button. The "Export Media" window can be opened by going to "File" in the main toolbar, and then selecting either "Export" or "Export from Preview" from the dropdown menu.

For your convenience, I have compiled a list of advanced commands which are most likely to be relevant when using Noesis to view and export data files from FINAL FANTASY XI. Please note that some of these commands can only be invoked when loading a file, while others can only be invoked when exporting a file! In order to invoke a command when loading a file, you must first use Notepad to create a .noesis scene file which points to the model you want to load, and then open that scene file in Noesis instead of opening the actual file directly. I will explain how to create a .noesis scene file in another post.

I'm still not completely sure which commands can only be invoked on load, and which ones can only be invoked on export, but I will continue to experiment and update this post accordingly. For now, I will distinguish between commands which I know for certain can only be invoked on load or export by marking them with either a red "Load" tag or a blue "Export" tag, respectively. If a command is unmarked, that means either that command works on both load and export, or I am uncertain.



Generic Noesis Commands:

CommandPurpose
-rotate # # #transform all vertices by the given angles. (Order is X Y Z)
-scale #scale all vertices on the model, where # is the scale factor.
(There are many more generic commands than just these two, but so far these are the only ones that I've personally found to be useful when working with data files from FFXI.)



FF11 Model/Data:

CommandPurpose
-ff11blendhack <arg>sw render to determine alpha coverage, <arg>=min frac.Load
-ff11optimizegeoremove degenerates and redundant verts.Export
-ff11keepnameskeep map object names intact.Export
-ff11renderunrefrender unreferenced map geo at identity.Load
-ff11forcelightingforce lighting.
-ff11forcecullforce culling.
-ff11novertcolorno vertex colors.
-ff11noshinyno special assignment for shiny materials.
-ff11shiftvertalpha <arg>explicitly shift vert alpha <arg> bits.
-ff11shiftvertcolor <arg>explicitly shift vert color <arg> bits.
-ff11shiftcolor <arg>explicitly shift tex color <arg> bits.
-ff11shiftalpha <arg>explicitly shift tex alpha <arg> bits.



FF11 SQLE Model:

CommandPurpose
-ff11sqleanim load sqle animation as relative path.Load



Autodesk FBX:

CommandPurpose
-fbxnewexportexports current fbx format instead of legacy.Export
-fbxzupsets the scene axis to z up on export.Export
-fbxsmoothgroupsgenerate smoothgroups from vertex normals on export.Export
-fbxtexrelonlyonly set relative paths for texture filenames.
-fbxmultitakeexport a take for each anim sequence.Export
-fbxbsnonormalsdon't use blendshape normals.Export
-fbxbonestomeshtfderive mesh transforms from bones, and don't write bones.
-fbxpreservecpdoes not allow welding between controlpoints.
-fbxnooptimizedisables fbx geometry optimization pass.
-fbxnoesidecarenables .noefbx sidecar files to preserve extra data.
-fbxcanimtimeuse curve key times instead of clamped evaluator time.
-fbxmtlfrommeshnamecreate materials from mesh names.
-fbxunifybi unifies binormals on import. (0=no, 1=yes, 2=flipped)Load
-fbxrottanrotates tangent/binormals on import.
-fbxnotandisables reading/writing tangents for fbx.
-fbxnoextraframeavoids adding an extra frame for timing.
-fbxframecount overrides the fbx anim frame count.
-fbxframerate specifies the fbx framerate. (frames per second)
-fbxtexext appends given value to texture names on export.Export
-fbxscalehacktransform override for scale correction.
-fbxtritopoly tris to polys, is max degrees for combine.
-fbxtritopolyconctol is concavity tolerance.
-fbxcollapsecpcollapse controlpoints.
-fbxreducekeysreduce animation keys.
-fbxnonlinrotspecifies nearest snap for rotations.
-fbxnomeshhierarchyno separate udcommon mesh hierarchy.
-fbxnomeshbonesno bones generated from mesh nodes.



WaveFront OBJ:


CommandPurpose
-objmtlenables export of mtl file with the obj.Export



DDS:

CommandPurpose
-ddsati2nonormdon't derive+renormalize when decoding DXT ATI2/BC5.



That's all for now. Please comment below if you've found any other of the advanced commands for Noesis to be useful for working with FFXI's data files.

Friday, April 14, 2017

AreaDemo

AreaDemo a Japanese program for previewing a limited number of zones in FFXI outside of the game.

EDIT: Do not bother trying to use AreaDemo for modding purposes. It simply isn't worth the hassle, as I've discovered that everything I was using AreaDemo for can be done using only Noesis. It turns out that Noesis has a built-in Data Viewer tool that allows users to see the file names of all textures and materials on any given DAT file, which means that there's simply no point in going through the trouble of installing AreaDemo simply to get the correct file names for the textures (which is all I was using AreaDemo for, anyway). I'll leave this post up for informational purposes in case you still want to try out AreaDemo simply for the sake of curiosity, but don't feel pressured to download and install it for the sake of modding, and don't bother trying to integrate AreaDemo into your development pipeline. You don't need it.

The primary purpose of using AreaDemo for FFXI zone extraction is to get the texture files, since Noesis (the other model viewing program capable of viewing FFXI's zones) often doesn't correctly save all the textures, and when it does, it generally doesn't preserve the file names of the textures for some reason. AreaDemo does not have this problem, and saves all zone textures with their correct file names intact. Without the correct file names, hooking up texture files to their appropriate materials in Unity, Unreal, or Autodesk Maya becomes an almost impossible guessing game. AreaDemo saves us that trouble by keeping the file names intact.

AreaDemo also converts zone geometry, but unfortunately AreaDemo only saves the geometry data as an MQO file, a custom file format created for the Japanese 3D modeling program, Metasequoia, which is not compatible with either the Unreal or Unity game engines. The most common format of 3D model used in Unity and Unreal is FBX, and although Metasequoia does technically have the ability to convert from MQO to FBX, this feature is only available with Metasequoia's EX License, which costs $150. Because of this, I personally prefer to use Noesis to extract geometry data, and AreaDemo to extract texture data, and then I combine the two in Maya. From there, exporting to either Unreal or Unity is a piece of cake (especially since Maya literally has special menu options specifically for exporting to either Unity or Unreal).

Unfortunately, one major limitation of AreaDemo is that, as far as I can tell, the program appears to only provide its users access to the original zones. That means that there is no way for AreaDemo users to access zones from any of FFXI's expansion packs, not even Rise of the Zilart.

Additionally, it should be noted that AreaDemo only works with the Japanese version of FFXI. This isn't a huge problem, since you don't have to actually purchase the Japanese version, you only have to have it installed, and Square-Enix has made the installation files for FFXI available to download for free from the official website, but it does create an issue in that Square has chosen to make it so that the Japanese version and the North American version cannot both be installed simultaneously on the same PC, which makes this whole process rather annoying for people who don't have multiple computers, or who don't want to dual boot multiple operating systems.

Anyway, relevant links below:
AreaDemo
(requires Japanese version)
FFXI Japanese verison
(required to use AreaDemo)