Pocketmnky

So I create an EffectMaterialContent, I attach my effect, and I stick any material data that my effect file needs in the OpaqueData with the Keys coinciding with the parameter names in the effect file and this seems to work; with one exception.

In my effect file I have a structure called "material" which holds several key bits of material data such as ambient/diffuse color, specular color, etc. I've tried adding them to the OpaqueData under the key "material.ambient" hoping that the processor recognize the parameter and attach it as needed, but it doesn't work.

I know that I can always pull that data out of the node and plug it into the MeshContent.Tag object; but that leads me to the second problem I have with my EffectMaterialContent.

I have no idea how to recognize my EffectMaterialContent at runtime. It turns into an EffectMaterial type that doesn't hold on to the NodeContent.Name property (that I can tell) so when I see it at runtime; I could be looking at any one of several possible custom EffectMaterials that I have made. The best I can figure is to try and loop through the effect parameters to see if I can determine which effect I'm looking at, but other than that; I'm lost.

Any ideas




Re: XNA Framework Questions about custom EffectMaterialContent?

Shawn Hargreaves - MSFT

The content pipeline doesn't handle structure effect parameters at the moment. If you'd like to see this added, could you file a suggestion over on the connect website, please

In the meantime a workaround would just be to flatten out your effect, moving these fields from the structure into independent variables.





Re: XNA Framework Questions about custom EffectMaterialContent?

Pocketmnky

I was afraid of that; I'll file the suggestion asap.

I guess it's better to find these things out early than later ;)