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.

Opens and exports Daggerfall’s image files, including billboard textures.

The code library that interfaces between Daggerfall’s DOS game files and Daggerfall Unity. The included Importer allow to explore specifics models and billboards (disable Billboard Batch) as well as towns and dungeons layouts. 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.

Basic


Common

Once you have the Unity Editor running, you can import a model placing a fbx or obj file in a subfolder of  Assets, for example Assets/Resources/Models, Assets/Resources/Flats or Assets/Game/Addons/MyMod. You can find all required informations about Unity and Models at this page, but here are provided the essential parts.

  • 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 so you need to address this in your modelling software. If is blender, you can use this plugin.
  • Your model can’t have more than 65,534 vertices. If needed, split your model in several parts and put them togheter inside a prefab. You can also include additional components such as lights and particle effects.
  • If the model is supposed to collide with the player, check Generate colliders in the mesh inspector inside the Unity editor.
  • When you replace an exterior model, is a good idea to provide a LOD Group.
  • Wind is natively supported for SpeedTrees and trees created with the Unity Tree Creator. Additionally, it can affect particle systems through the External Forces module.

Models

Daggerfall uses models for buildings and props, which can be explored with Daggerfall Modelling. This tool associates every mesh with a numeric ID which is also used by Daggerfall Unity to identify them for the purpose of modding. In order to replace a vanilla mesh, a gameobject named with this ID must be provided via dfmod packages.

The first step is to place a mesh file, typically a .fbx or .obj, in a subfolder of Assets and let the Unity Editor import it. At this point default material(s) are created. You can simply assign them a texture or, if you desire more customization, create a prefab and assign components to it. What’s important is that the parent gameobject (prefab) is named as the mentioned ID.

Daggerfall often reuses the same mesh with a different material for different climates. Additionally, many buildings and props have a summer and winter version.

When a custom prefab is injected, this behavior is lost. We can replicate it providing prefabs with a tag for specific climate and season. This means diversity can also be increased with different meshes. For example the winter version can have more realistic snow, while summer version can include 3d vegetation.

Nomenclature

  1. ID
  2. ID_ClimateSeason (1)

(1) Desert has no seasons: use ID_Desert.

Climates

  • Desert
  • Mountain
  • Temperate
  • Swamp

Seasons

  • Fall
  • Spring
  • Summer
  • Winter

The base name is used as a per-mod fallback. All mods are seeked with load order and query stops on first match. Base name matches everything.
For example a mod that only provides base models can be extended with other mods with specific seasons and climates, while the base model is still used for the non-provided seasons and climates. But if mod with base is loaded in a lower position, load order is respected and “overrides” everything.

When you build a mod (as explained here) you only need to pack this parent prefab; children such as meshes, materials, particle effects etc. are automatically imported.

Flats

The original game used billboards (sprites) to render characters, enemies, animals and small props, and so does Daggerfall Unity.  Altough this gives an interesting and characteristic look, the ability of replacing them with 3d models is surely one of the most requested features of the modding system.  We can do this in the same way we supply new models as explained above.

First of all we need the identificative, which is composed of two numbers: archive and record. Daggerfall stores billboard images in the same manner as any other textures, so Daggerfall Imaging is the tool for this job. Once we have these numbers, we can import a mesh with the Unity Editor as usual and call it archive_record. We ignore the third number, frame, because is up to the imported gameobject deal with animations.

It’s important to note that these models are placed in game assuming the origin is at the base, where they touch the ground or the surface they are positioned on, so place it in this position when you create them with a modelling software. Rotation on the up axis of the 3d mesh is randomized to make up for the camera-following movement of 2d billboards.

Advanced


FaceWall

Normally, models are instantiated with the same rotation as originals while flat replacements have a random rotation for increased variety.  There are some situations, though, where a random rotation is not appropriate. Wall torches, for example, are camera-facing billboards in the original game, but when we replace them with a 3d model we want them to have a specific position; unfortunately this is not immediate because the rotation amount for every torch is not specified in the game: it’s simply not necessary for billboards.

To overcome this issue we can use a script which will find the position of the wall at run time and rotate the torch accordingly. This can be found in the inspector of the Unity editor and added as a component of the GameObject (Add Component).

 

 

 

 

 

 

Max Distance

The wall will be seeked inside this radius. Big values can cause wrong results.

Align To Wall 

Make the GameObject parallel to non-straight walls.

Minor Angle To Ignore

Angles lower than this will be ignored.

Rotation Correction

The actual rotation is corrected by this value to take small inaccuracies into account.

Move Near Wall

Translate the GameObject so that it touches the wall.

Fix Clipping

Fix issue where GameObject clips with the wall if the origin is next to it.

Destroy On Bad Position

Remove the GameObject if it can’t be positioned correctly.

DayNight

Daggerfall has dinamic changes during the day time flow; for example towns buildings have a light blue emission map for windows when the sun is up, while a yellow map is used at night.

To reproduce this behaviour on imported models we can use the component DayNight, which can also toggle lights and particles of lamps and torches.

 

 

 

 

 

 

 

Toggle Lighting

Turn on lights and particles at night time, turn them off at day time.

  • SelectedOnly: Toggle only selected lights and particle.
  • All: Toggle all lights and particle in the prefab and its children.

Particles

Selected Particle Systems  (only for SelectedOnly).

Lights

Selected Lights  (only for SelectedOnly).

Emission Colors

Update the color applied to the emissive material according to day time.

  • NoColors: Does nothing.
  • DaggerfallColors: Use Daggerfall colors.
  • CustomColors: Use specified colors.

Material Index

The index for the MeshRenderer of the material whose emission color will be dinamically changed (only for DaggerfallColors and CustomColors).

This is found from Inspector -> Mesh Renderer -> Materials.  This material can (and typically should) have an emission map, while emission color and emission strength will be overridden with day and night colors and strengths.

Day Color

The HDR color applied to the emission map at day time (only for CustomColors).

Daggerfall Unity default is #406E80.

Night Color

The HDR color applied to the emission map at night time (only for CustomColors).

Daggerfall Unity default is #CC922D.

Doors

Transition from exterior to interior is implemented through a trigger placed in the same position as the door on the mesh. This trigger is indipendent from the mesh, so there aren’t any troubles with imported building as long as the door is in the same position as the original.

Nevertheless, sometime you may want to slightly alter the door position for aesthetic purposes. In this case it’s possible to include with your model both a textured door which is visible in the game and an invisible door in the correct position which acts as the collider for the trigger effect.

This is as simple as a planar mesh, with the same size of the door and enabled Generate Colliders. To achieve transparency set the material rendering mode to Cutout and albedo to a color with full alpha, for example #00000000.