XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Shadow Map Sample Model Pre-requisites

Last post 11-04-2008 8:31 PM by Nathan Cross. 3 replies.
  • 10-06-2008 9:17 PM

    Shadow Map Sample Model Pre-requisites

    I've tried the shadow mapping sample, and it looks pretty good, for a quick and easy way to get shadows working in a game. But I went to implement the technique into my game and an exception was thrown concerning my model.

    At first I assumed that it was just an error with the way I had written the model and material processor (typing out the ones from the sample) so I tried the same model in place of "dude.fbx" in the sample, and the same exception was thrown.

    The model I was using had no textures associated with it at all, so I quickly created another model in 3dsmax and "textured" it and embedded the media in the fbx file.

    The content processor is throwing an exception, so would somebody be able to explain to me what requirements there are for making a model that will work with this technique?

    Thanks as usual everyone.

    This is the exception:


    Error   1   Building content threw ArgumentNullException: Value cannot be null
    Parameter name: value 
       at Microsoft.Xna.Framework.Content.Pipeline.NamedValueDictionary`1.AddItem(String key, T value) 
       at Microsoft.Xna.Framework.Content.Pipeline.OpaqueDataDictionary.AddItem(String key, Object value) 
       at Microsoft.Xna.Framework.Content.Pipeline.NamedValueDictionary`1.Add(String key, T value) 
       at CustomEffectPipeline.CustomEffectModelProcessor.ConvertMaterial(MaterialContent material, ContentProcessorContext context) in C:\Documents and Settings\Administrator\Desktop\ShadowMapping\CustomEffectPipeline\CustomEffectModelProcessor.cs:line 47 
       at Microsoft.Xna.Framework.Content.Pipeline.Processors.ModelProcessor.ProcessMesh(MeshBonePair meshBonePair, ContentProcessorContext context) 
       at Microsoft.Xna.Framework.Content.Pipeline.Processors.ModelProcessor.Process(NodeContent input, ContentProcessorContext context) 
       at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context) 
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item) 
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item) 
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild() 
       at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[ sourceAssets, String[& outputContent, String[& rebuiltContent, String[& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[& warnings)   C:\Documents and Settings\Administrator\Desktop\ShadowMapping\ShadowMapping\Content\box.FBX ShadowMappingWindows 
     

  • 11-04-2008 5:11 PM In reply to

    Re: Shadow Map Sample Model Pre-requisites

    I've been having similar problems. To try to narrow things down a bit further, I duplicated and renamed 'dude.fbx'. Adding it to the sample's content and setting the Content Processor to the same CustomEffectModelProcessor gives the same error as above. Apparently you can't have anything other than dude.fbx or grid.fbx, or everything breaks. I'll poke around some more, but this is my first week of XNA...
  • 11-04-2008 6:51 PM In reply to

    Re: Shadow Map Sample Model Pre-requisites

    Time for a quick debugging tutorial I think...

    If you look in the callstack for the exception, you will see it is coming from "CustomEffectModelProcessor.cs:line 47". Let's look at that line to see what it does:

        processorParameters.Add("CustomEffect", customEffect);

    Hmm, something here is null when it shouldn't be? This must be either the processorParameters or the customEffect fields, right? But it can't be processorParameters, because that was allocated just one line earlier. So it must be customEffect that is null.

    Ok, where does the customEffect value come from? Looks like this is a content processor parameter. Have you set this parameter (in the Visual Studio properties pane) the same way for your new assets as it was for the original ones in the sample?
    XNA Framework Developer - blog - homepage
  • 11-04-2008 8:31 PM In reply to

    Re: Shadow Map Sample Model Pre-requisites

    Ah... No. No I haven't. I didn't even see that [+] next to Content Processor until you pointed me at it in fact, and didn't understand how the .fx files were getting used. But now it all works, and I am enlightened (relatively)! Cheers!
Page 1 of 1 (4 items) Previous Next