Loading Additional Content Types
XNA Game Studio provides standard Content Pipeline components that import and process the most commonly used game asset file types. These file types include, for example, importers for the Autodesk (.fbx) format and the DirectX (.x) format. A complete list of file types is available in the Standard Importers and Processors topic. Most digital Content creation (DCC) tools are capable of creating output in at least one of these standard formats.
Choosing to Customize
A custom importer is required for game assets available only in formats unsupported by XNA Game Studio standard importers. One may already be available from a third party. Custom importers can be developed by DCC vendors, game-engine developers, and interested game hobbyists. Once a custom importer is installed on your computer, you can associate art files with the importer to invoke it when you build the art files (see Adding a Custom Importer).
You may need to write your own custom XNA Game Studio Content Pipeline components to:
- Support a new type of game asset or format from a DCC tool.
- Derive special-purpose content from another piece of content at the time the game is built.
Here are some typical scenarios, and a summary of which Content Pipeline components require customization.
|Component||When to customize||Output options|
This section examines some typical examples where customization is needed, and illustrates which Content Pipeline components must be changed.
Supporting a New File Format
In this example, a nonstandard file format contains information that can be represented by a standard Content DOM type.
As illustrated, only a custom importer that can read the nonstandard file format and output a Content DOM object (in this case, a TextureContent object) is required. The remainder of the Content Pipeline process can be performed by a standard content processor and content loader.
Creating Special-Purpose Data from Standard Objects
For this example, a texture object that represents a map of normalized vectors derived from the original texture object is created.
Since the texture is contained in a standard format for the game asset, a standard importer can be used to create the TextureContent object. A custom content processor (NormalMapProcessor) creates the special-purpose data, but uses the standard TextureContent class to contain the result so that it can be loaded by the standard content loader.
Supporting Custom Data from a Nonstandard Game Asset
Illustrated in this example is a nonstandard game asset file containing data that does not correspond to any standard data types.
To read the nonstandard game asset file, a custom importer is required that outputs a CustomContent object. Since the output of the importer is a custom class, a custom content processor also is needed, and the ContentManager.Load method must be extended to support the custom data object.