This project is read-only.

Effect in 4.0

Dec 29, 2010 at 6:15 AM

I am looking into this animation library and the only concern i have after playing around with it is that there does not seem to be a way to change the effect that is being used on the skinnedModel in the 4.0 releases.

From the past discussions it seemed as though you were able to obtain the Model from the skinnedModel and then alter that as you had wished. However the newest releases of your library that are 4.0 compatible do not seem to have access to the Model in skinnedModel.

The animation library looks great but his one problem has me on the border on whether to use it or not. Any help would be useful, thank you.

 

Shevy

Dec 29, 2010 at 11:45 AM

Yes, the Model object has been exchanged for a list of SkinnedModelMesh objects. You can change the properties of the effect (matrices, colors, etc) through the properties of the SkinnedModel class. 

You can still iterate through the meshes that make the model with the SkinnedModel.Meshes property. Every SkinnedModelMesh has an Effect property, where you can change the entire effect if you want so; but keep in mind that it *must* be of type SkinnedModelBasicEffect. If you want to add new techniques or use another shader, you have to change it in the Content Pipeline.

The samples in the code repository are always updated to the latest version of the library, so you can check them for some basic reference.

Dec 29, 2010 at 7:23 PM

Thank you for the quick response, and I am starting to understand this better but I am still a little confused about how to go about changing the effect. You said that the SkinnedModelMesh all have an effect property which I see, however it is only read only making it impossible to alter also i change the source.

Which I assume is not what you wanted and leaves me with either the option to change the effect within your source or somewhere else hopefully within my own project. Sorry but I am not too keen on Content importers so if I am missing something obvious I apologize.

Dec 29, 2010 at 7:41 PM

Yes, it must be read-only because SkinnedModelBasicEffect has a pretty complex functionality inherited from the old versions of the library, and it must be strongly tied to the rest of the library. Why would you want to change it? Doesn't it fit your purposes? Do you want to use a simpler effect like XNA 4's SkinnedEffect? If you could explain a little more, perhaps we will find a solution to your problem.

Dec 29, 2010 at 8:58 PM

To be honest I am very new to shaders and what all I really want to do is to implment a simple toon shader to start.

All the knowledge i really have comes from this tutorial, http://create.msdn.com/en-US/education/catalog/sample/nonrealistic_rendering

so I have been trying to follow that logic with your library, which is to change it during run time by changing its MeshPart.Effect, however that does not seem to be the case with your library, so I guess what I am asking is how do I go about inserting a toon shader.

Thank you for your help and patience.

 

Dec 29, 2010 at 9:11 PM

You can't just entirely replace the existing shader with a new one, specially if it doesn't have any skinning information; your model would be incorrectly rendered, or at the best case it would't be animated at all. So, you have to mix the skinning code from XNAnimation's shader with the example's shading code. It won't be an easy task, though, specially if you don't have much experience with HLSL.

Dec 29, 2010 at 9:47 PM

Yeah i guessed that much from the reading the old threads. 

And so if i did do just that then how would I go about associating the new Effect with a skinnedModel? Would I have to alter source code of your content Importer or is there a way for me to do that in my own solution?

Dec 29, 2010 at 10:32 PM

Check the XNAnimationPipeline project, there's a file called "SkinnedModelEffect.txt" under the "Resources" folder where the code for the entire shader resides.

Dec 30, 2010 at 2:45 AM

Ok thanks for the help I think I am finally starting to understand this.