Models & Flats

Prerequisites


Explores and exports all of Daggerfall’s 3D models, cities, and dungeons.
Works like a visual atlas for searching and exploring anywhere in Daggerfall’s world.

The code library that interfaces between Daggerfall’s DOS game files and Daggerfall Unity. You can read a tutorial here. Daggerfall Tools for Unity also allow to inspect billboards properties. Your best option is to download Daggerfall Unity from Github (video tutorial), as it contains all the tools and it allows to test models directly in game.

 

Export from your modelling software


When exporting your model from a modelling software you need to take a few things in consideration:

  • Models exported from Daggerfall Modelling are forty times bigger than they need to be in order to be used in Unity, so you need to scale them down by 0.025.
  • Unity engine reads models as Y-up not Z-up. You can use this plugin for blender to address this.
  • Your model can’t have more than 65,534 vertices. If you need, split your model in several parts and put them togheter inside the prefab.
  • Unity supports different formats, but exporting to .fbx is suggested.

 

 

Import your model in Daggerfall


Models

  1. Go to daggerfall-unity-master\Assets\Resources\Models and create a subfolder. Rename it with the ID of the model, then create another folder inside this one and place the .xfb file inside.

    Model 43109 from Daggerfall Modelling

  2. Place the relative textures inside daggerfall-unity-master\Assets\Resources\Textures. You need to do so even if you’re using vanilla textures.
  3. Now open Unity and let it import all the new files. When it’s done, navigate to the model subfolder in the project window and create new materials, one for each texture you need to use.

    Assets/Resources/Models/43109/Assets

  4. Drag your model in the scene view and assign materials to the model. Then place it in a prefab with the same name as the folder: /models/modelID/modelID.prefab. If the model has a winter version, create another prefab called modelID_winter.prefab.

    Assets/Resources/Models/43109: 43109.prefab (for summer/interiors) and 43109_winter.prefab (for winter).

  5. When you’re done, you can compile the project and look for your model in-game.

Flats

A few example models and their respective billboards.

  1. Go to \Assets\Resources\Flats and create a subfolder, named after the sprite texture we are replacing.
    For example 205_0 for the texture 0-0 in archive 205.
  2. Place your model inside this folder (maybe in a subfolder called Mesh or Assets, for example), the texture you need to use in the usual Resources/Textures folder and create materials.
  3. Create the prefab, name it with the same ID as above and place it in the main subfolder.
    In our case we will have /Flats/205_0/205_0.

 

Common notes


  • Models should have the origin in the same position as vanilla mesh.
    Custom flats prefabs are placed in game assuming the origin of the model is at the base, where they touch the ground or the surface they are positioned on, so place it in this position.
  • If the model is supposed to collide with the player, check Generate colliders in the mesh inspector inside the Unity editor.
  • Using prefabs give us a lot of freedom as they allow combining more than one mesh, using particles and scripts.
    If your model is split in parts, import an .xfb file for each of them. Them set one as parent, associate the others as children and drag the parent in the prefab. Note: do not use an empty gameobject as parent, always use one of the components.

 

  • Why the difference in scale?

// Using 1/40 scale (or * 0.025).
// True world scale is 1/39.37007874015748 (or * 0.0254). Basically conversion is inches (Daggerfall) to metres (Unity).
// 1/40 scale has been carefully chosen as it is close to true scale but requires less floating-point precision
// for tiling assets. It also produces numbers easier to remember for editor layouts and is easier to
// calculate manually (i.e. just divide by 40 to convert native units to Unity units).
// For example, an RMB block dimension is 4096 native units.
// 4096 / 40 = 102.4 (easy to remember for manual editor layouts, less precision required).
// 4096 * 0.0254 = 104.0384 (harder to remember for manual editor layouts, more precision required).
// This means world is slightly smaller over large distances (13107.2m error across entire map width).

  • How can i change the filter type of imported textures?
    There is a .ini setting (MainFilterMode, under [Video]) which change it for both vanilla and custom textures.