Shawn Hargreaves Blog
This article is prerecorded. Shawn is away (on honeymoon). Replies to comments will be delayed.
In previous XNA versions, the Content Pipeline imported materials like so:
To use custom effects that are not directly referenced by a model, you have two options:
Game Studio 4.0 works the same way, but adds a new processor parameter for choosing which of the five built-in effects is selected by default (if the source model does not directly reference a .fx material):
Along with this parameter come new design-time material types, so BasicMaterialContent is joined by SkinnedMaterialContent, EnvironmentMapMaterialContent, etc.
Depending which effect you choose, some additional work may be needed to configure it:
EnvironmentMapEffect has a bug.
1. dynamic generate TextureCube.
2. use EnvironmentMapEffect
3. Tex reverses X
Thanks! This looks useful...
I tried to use those "other material properties", but can't find them. In the MaterialContent.OpaqueData I only see the properties that the BasicMaterial uses.
If I change the Default Effect to EnvironmentMapEffect, the additional properties are still ignored, including those that the EnvironmentMapEffect knows.
I'm using XNA 4.0
Andrew: the way materials work in the pipeline is to have a strongly typed class (eg. BasicMaterialContent, or EnvironmentMappedMaterialContent), which has certain properties that it knows about, plus a bag of any other unknown property values in case a custom processor wants to do something with them. The input from the model importer will always be a BasicMaterialContent, never an EnvironmentMappedMaterialContent. The Default Effect property lets you specify that the input material should be converted to some other type, but if you have custom behaviors or extra property values that you want to apply while doing this, you need to write a custom processor to do that conversion. The default one only knows about the standard BasicMaterialContent properties, and has no idea what to do with any extra custom values that you might have stored in the opaque data property bag.
I wrote a custom ModelProcessor, and overrode the ConvertMaterial function. At that point the extra properties are already missing from the MaterialContents OpaqueData dictionary.
Can I access the imported material earlier?
Or may be the problem is that it's a Windows Phone 7 app, where custom shaders are not supported?
What I'm trying to do is to select a material from the built-in ones and set up it's properties using only the imported fbx file.