This project is read-only.

Custom Effects

Jul 21, 2008 at 6:33 AM

Thanks for the library, works like a charm, first time on the Xbox360.

Is there a way to use custom effects easily? The one feature I really like about is that you can create a DXMaterial in max, export a .x file with that material (it's a .fx effect) - I just couldn't get it to work on the 360 in my project.

At the moment, I loop through and add my effect file to every model mesh part and then draw it. It doesn't quite animate right and gets rid of the SkinnedModelBasicEffect. I suspect this is quite tricky due to the GPU skinning. Any custom effect would have to be based on this shader?

Thanks again for the library.

Jul 22, 2008 at 6:58 PM
Hi. Sorry for the late answer.

Right now the XNAnimation model processor will always replace your model's effect with its default skinned effect, but you can change it at runtime as you apparently did.

You can change the default effect by any effect that you like and it does not need to be based on the default effect code. The only need you need to do is have an input in your shader for a Matrix array containing the bones transformations, and use it to animate your model. If you animation is not playing correctly it could be a problem with your model too, things like freeze transformations, reset xform, and delete history before exporting it.

In the next version of the library, I will modify the model processor allowing it to retain your original effect or replace it by the SkinnedModelBasicEffect.
Jul 23, 2008 at 3:24 AM

No worries.

It turned out to be quite simple to use a custom shader. Looking forward to the next version as I currently have to manually add texture paramaters.