Click or drag to resize
DigitalRuneModels

DigitalRune Graphics extends the XNA content pipeline and provides special content processors for models. This section explains how to load a model.

This topic contains the following sections:

Adding a model to the content project

You can add a model to the content project as usual:

  1. Right-click the content project and select Add | Existing Item....
  2. Browse for the model file (e.g. a FBX or X file) and click Add.

By default, a model in XNA is processed using the content processor "Model - XNA Framework". But DigitalRune Graphics uses a more advanced runtime representation and therefore requires a different content processor:

  1. Select the model in the content project.
  2. Right-click the model and select Properties to open the Properties window.
  3. In the Properties window search for the property Content Processor and select Model - DigitalRune Graphics from the combo box.
Pre-processing settings and materials

At this point the model can already be loaded and rendered. However, it will not use any special materials and can only be rendered using the XNA BasicEffect or SkinnedEffect. If the game uses an advanced render pipeline, such as a deferred renderer, additional data needs to be specified.

DigitalRune Graphics uses XML files to define additional data for models:

  • The Model Description is an XML file that defines pre-processing settings and assigns materials to a model. A model description file uses the file extension drmdl, for example Dude.drmdl. See Model Description (*.drmdl File)
  • The Material Definition is an XML file that references DirectX Effects and defines a effect parameters (e.g. colors and textures). A material definition file uses the file extension drmat, for example Wood.drmat. See Materials (*.drmat)

Take a look at the samples included in the download package.

Loading a model at runtime

At runtime the model can be loaded just like any other asset in XNA.

C#
// Load a model.
ModelNode myModel = game.Content.Load<ModelNode>("MyModel");
Subtopics