Visual Diary: Collada Export

Daggerfall Modelling will be capable of exporting individual models to Collada format. This is a universal format for describing digital content such as 3D models and scenes. When this feature goes live in the next release, you will be able to export Daggerfall’s 3D data and load it back into modelling packages such as Blender and 3DS Max. You could also use this data in another 3D engine. One potential such use will be replacing Daggerfall’s standard models with high-poly variants in DaggerXL.

I’ve been working on the Collada export over the last couple of days and would like to document progress so far.


Wiring Up

The first step is to create a C# wrapper for the Collada DOM.

I started by creating a static build of the Collada DOM DLL, which is then imported into a CLI/C++ project. This wrapper project is able to handle communication between native code (the Collada DOM in this case) and managed code. Fortunately it was not necessary to wrap the entire Collada DOM, just a few methods of the DAE and daeElement classes with some string marshalling thrown in. The end result is a self-contained .NET assembly exposing the Collada DOM to any .NET language.

All I need to do now is code the exporter. I started with a simple model with a distinctive shape (pictured left). This arrow turned out to be extra useful for tackling axis-alignment in the next step.


First Import

My first pass at the exporter creates a tidy .dae file which Blender opens without any complaints. I love it when code works first run.

I did notice however the arrow was no longer pointing along the correct axis. The reason for this is that Blender uses +Z for up and XNA uses +Y for up. A quick scan of the Collada spec and forums shows this is a common issue with an easy solution. My exporter class is updated so that any axis can be considered up. This is achieved with a rotation on the model node and setting the <up_axis> in <asset> to reflect the appropriate setting.

With the model vertices in place, it’s now time to add textures.

Textured Models

This was more work than I expected. Each set of triangles references a material, each material instantiates an effect, every effect points to an image, which in turn points to a file on disk. Oh, and the materials have to be bound to the model in the scene setup.

Once my head stopped spinning from all the redirection, I could see the versatility of this method. I was also impressed how detailed scenes can be constructed using Collada, right down to cameras and lights. I want to look into exporting blocks, cities, and dungeons to Collada files at a later date.

On the left are a few screenshots of some distinctive Daggerfall models as viewed in Blender.

The exporter is more or less ready and just needs a little tidy-up. I have confirmed that my exported .dae files pass the Collada Coherency Test without any errors, and so far all the models I’ve loaded into Blender look perfect.

The Collada export feature will be available in the next release of Daggerfall Modelling. I’m looking forward to seeing what you all do with it in the future.

Daggerfall Modelling ALPHA 0.6.0

The first Alpha release of Daggerfall Modelling is now up for download. The purpose of this version is to test stability and basic exploring features.

This release does not have Collada exporting features.

You will find documentation on the Daggerfall Modelling Project Wiki. Please check system requirements and prerequisites to ensure the smoothest possible start with Daggerfall Modelling. There is an article for each view type outlining the controls for that view.

Please feel free to submit bug reports and feature requests. You can also check the Issues Page for known bugs and planned features.

Finally, you can Download Daggerfall Modelling. Happy exploring!

Visual Diary: Daggerfall Modelling Views

In my last post, I talked about the thumbnails view in Daggerfall Modelling. This is just one of the possible ways of exploring 3D data from Daggerfall. Read on to see all supported view modes and get an idea of how they work together.



Thumbnails

This has been tweaked since my last post. I’ve selected a different viewing angle to give more of a 3/4 view of each model rather than a frontal view. I have disabled back-face culling to ensure a thumbnail is rendered even when facing away from the camera. The overall effect is that almost all thumbnails show a decent representation of the model that’s easy for the eye to track.

Thumbnails are generated in real-time from model data. I plan to add a few embelishments like watching the model spin when the mouse passes over a thumbnail.

Scrolling the thumbnail view can be performed from your mouse wheel or by dragging the page as you would the touch screen of an iPhone. You can impart velocity to the scroll with a flick of the mouse. The view will keep scrolling until you grab it again or roll the mouse wheel.

The thumbnail view isn’t just for viewing thousands of models either. When you have a city or dungeon loaded, you can switch over to thumbnails to view just the models used for that location. This filtered list of thumbnails will be helpful for finding the exact model to export in large areas where models can be duplicated dozens of times.

If you double-click on a thumbnail, it takes you straight to our next view, the Single Model View.


Single Model View

After finding a model in the thumbnails view, you can explore that model in greater detail. This view is similar to the model view in Daggerfall Explorer.

It is possible to search for individual models by ID (check the left-hand pane of top screenshot).

When viewing a location, you can also jump to single model view by clicking on any model within the location itself. Daggerfall Modelling uses bounding volumes so you can pick any model right out of the scene.

Location View – Top-Down Camera

The first way of viewing locations is the default top-down camera. This camera is always facing down on the scene and you scroll around as you would a 2D map. Clicking on a specific block in the map (screenshot) will take you directly to that block.

If you’re only interested in one block, you will be able to filter out everything but the block you’ve clicked on.

When you see a model you’re interested in, you can switch to inspecting that model in the Single Model View without losing your place in the Location View (unless you change locations).


Location View – Free Camera

The free camera allows you to move around in first-person mode through city streets or narrow dungeon corridors. Pictured left is the city of Sentinel (top) and Mantellan Crux (bottom).

The Mantellan Crux screenshot shows how the dungeon layout map is displayed. Each square represents a dungeon block. Currently the starting block (dungeon entrance) is blue-green, and other blocks are gold. The RGB values match those used in Daggerfall to display dungeon layouts.

Before this tool is completed, I plan to implement an “interior view” so you can crack open building interiors to select the furniture and other models within.

You can see there will be several ways of getting around Daggerfall’s 3D data. As a pure exploring tool, Daggerfall Modelling will replace Daggerfall Explorer, Daggerfall Cartographer, and Daggerfall Scout. The goal is to create a rich visual path for exploring models individually, or as part of the locations and dungeons they build. Every view will offer some technique for identifying, isolating, and exporting a model.

I hope to have a beta of the exploring side up for download in the next few weeks. Once any problems with the GUI have been ironed out, I will begin work on export queues and saving models to Collada format.

DF Modelling Thumbnails

I mentioned in my previous post that I would allow you to browse all 10,000+ 3D models if that’s what you wanted to do. I’ve been working on how this is achieved, and I’m happy with the emerging look and feel.

For those of you who never used Daggerfall Explorer, that tool could only show one model at a time. You would use Ctrl+Left and Ctrl+Right (or the left/right arrows on the toolbar) to cycle through the models one-by-one.

In Daggerfall Modelling, I’m building a glossy thumbnail surface with full renders of models. You use the mouse to sweep through the page in a similar manner to working with an iPhone’s touch display. You can zoom in and out to fit more/less thumbnails on a page.

Below is a screenshot of the thumbnail view in action. I’ll be working on making this view as smooth as possible over the next few days. The goal is to create a responsive, tactile experience that’s also easy on the eyes.

 

Introducing Daggerfall Modelling

The last few days, I’ve been working on a new tool called Daggerfall Modelling. Where Daggerfall Imaging 2 handles everything 2D, Daggerfall Modelling has the job of browsing and exporting Daggerfall’s 3D models. This tool is also intended to be a successor to the venerable model and block viewers in Daggerfall Explorer.

This post shows off an early build of Daggerfall Modelling and talks about the user interface in development. Keep in mind this is a very early build, with only a small number of features implemented. However, this should be enough to get a feel for the direction this tool is going in.

Creating an engaging browsing experience is no easy feat. Daggerfall has over 10,000 individual 3D models. It wouldn’t be very helpful to just dump the user in the middle of this ocean of objects (as I did in Daggerfall Explorer). If an artist wants to rebuild the beehive-like castle at the centre of Sentinel, how do they go about finding that model amidst thousands of objects? More troublesome, some objects are split into many pieces and scattered throughout the model database. There are also specific textures to use depending on the geographic region a model belongs to. These regional changes affect cities and dungeons alike. Without some kind of structure to help the end user, this quickly becomes a nightmare of minutiae.

The solution was to let the world in. Specifically, allow the user to start with a location (say Wayrest or Sentinel), then drill-down to the objects of interest.

This provides an important spatial component to browsing. Want to find the Mage’s Guild in Sentinel? Just bring up the Sentinel map and click on the block containing the Mages Guild. Daggerfall Modelling uses the same auto-map data and colours as the game itself. If you’re familiar with a location in-game, it should only take a few seconds to find the models you’re after in Daggerfall Modelling.

Combine this with a search feature, and it becomes possible to rapidly and visually browse the location database for places of interest. Besides locations, you can search for a specific block or model. Or you can just swim through all 10,000+ models if that’s what you want to do.

Following are some screenshots demonstrating the “search and click” concept.

  • Below is a search for “sentinel”. The only matching location is the city of Sentinel in the region of Sentinel. After selecting the location, we’re given a map of the city to work with. We can drill-down into each block of the city map to target the models in that block. Note the red skull button just above the city map. That means this location has a dungeon. You can switch from “City Mode” to “Dungeon Mode” and locate models from the dungeon data.
  • Need a location but can’t quite remember where it was, and only vaguely what it was called? You can enter partial names and Daggerfall Modelling will match every location from the database containing your search string. Imagine you were looking for a place with “wall” in its name. Every location containing “wall” is found below, grouped by region, and given a unique icon showing whether it’s a city, temple, dungeon, etc.

The right-hand pane (not fully implemented) is an XNA-driven hardware-accelerated view. This is where you can view blocks and models in full 3D or as thumbnails. When you’ve found what you’re looking for, add it to the export queue to save out later.

Speaking of exporting, Daggerfall Modelling will save models in Collada format. This empowers 3D artists to work on Daggerfall’s models in virtually any package. This is an important step to making Daggerfall Modelling part of a tool chain for eventually replacing Daggerfall’s 3D models with higher-polygon versions in DaggerXL.

Note that Lucius does not currently have plans to allow model replacements until after significant game-play features have been implemented. However, Lucius has approved the choice of Collada as the primary file format. I will continue working on Daggerfall Modelling to make it an indispensable tool for artists interested in working with Daggerfall’s 3D objects.

Do you have any feedback? Hit the comment button below and let me know your thoughts. Daggerfall Modelling will be built in small stages with community feedback in mind.

Incoming!

I push against the Workshop’s iron-banded door. It sticks for a moment then creaks open as if welcoming me home. Dry air blows past my cheeks. With a final look to the outside world, I descend a thousand steps into darkness, stopping only to light torches along the way. Far above the heavy door slams closed, sealing me in the depths. I look around, satisfied everything is how I left it, and sit down to work. It’s great to be back.

As you can probably guess, I’ve had to step away from the Workshop for real life reasons and other projects. I’m deeply sorry for not posting at all during this time. Thankfully, Lucius has continued working his usual magic with DaggerXL. If you’ve been living under a rock like me for the last several months, make sure you go check it out. It’s way more interesting than anything going on around here (not counting that escaped Imp I can hear scratching around inside the walls).

The good news for anyone following Daggerfall Connect is that I’m going to be active again for a while. First order of business is to get my subversion repository at Google Code populated. This has been done now, with the main trunk currently versioned at 0.4.9.

The main changes in 0.4.9 are:

  • Several bugfixes and other minor improvements to the core DaggerfallConnect library and DaggerfallImaging2.
  • Map support for outdoor locations and dungeons. This is nearly complete, but needs a bit of work to finish up and get some bugs under control. If you want to play with this, please don’t be disheartened that not all maps load properly (or just throw exceptions). I’m working on fixing this now and updates will be committed to the 0.5.0 branch before long.
  • XNA support. There is now an XNALibrary project demonstrating the basics of using DaggerfallConnect to load Daggerfall’s textures, 3D objects, blocks, and maps into XNA. There are also a few XNA tutorials underway that call this library.  Disclaimer: This is exactly how I left it when I had to walk away from the Workshop last year. The XNA stuff is very rough and unfinished. I’ll be fixing all this up and posting to the 0.5.0 branch over the next week or two. All XNA code is currently based on XNA Framework 3.1.

The next full release will be 0.5.0. I also need to get all the written tutorials and other stuff moved over to my Google Code project wiki.

That’s it for now. If you’ve been interested in Daggerfall Connect in the past, but lost interest due to my infrequent updates, now is a good time to have another look. Things are finally coming together enough to be interesting.