I did a quick trial’n’error step by step recognition on this one for my own work in progress / learning purposes.
I thought some other tech artists might fancy seeing this shared around as well
When you export your stuff to fx format : it doesn’t run as it is in the DXviewer.
That’s because it needs some SAS bananas (the Mircosoft one “version 1.1.0” not the Nvidia one “version 0.8”).
So here is what I found :
// Add a global parameter with the script version :
int sas : SasGlobal
<
bool SasUiVisible = false;
int3 SasVersion= {1,1,0};
>;
// Add the proper transformation matrices names
// and their data bindings to make DXviewer happy :
float4x4 matWorld : World
<
bool SasUiVisible = false;
string SasBindAddress= "Sas.Skeleton.MeshToJointToWorld[0]";
>;
float4x4 matView : View
<
bool SasUiVisible = false;
string SasBindAddress= "Sas.Camera.WorldToView";
>;
float4x4 matProjection : Projection
<
bool SasUiVisible = false;
string SasBindAddress= "Sas.Camera.Projection";
>;
In your vertex shader you’re probably multiplying position with the “matViewProjection” matrix.
(which is reckonned as “predefined” Semantic by R-monkey but somehow isn’t talking “DXviewer’s language”).
//So you need to split this from :
Output.Position = mul( Input.Position, matViewProjection );
//into :
Output.Position = mul( Input.Position, mul(matWorld, mul(matView, matProjection)));
Basically using the matrices you’ve declared previously in a slightly more decomposed fashion.
You should now have the beast not yelling “Reverting to the default effect.” anymore.
If you only see a black ball your textures are missing.
// You need to switch variables from this :
texture my_rendermonkey_texture
<
string ResourceName = "C:\\bla.dds";
>;
// to something like this :
texture my_microsoft_texture
<
string SASResourceAddress = "C:\\bla.dds";
bool SasUiVisible = false;
>;
Et voila!:D:
Please feel free to add more of your findings if I missed anything else required.
Btw : some shader syntax coloring would be nice when posting code blocks : they seem to have a way to do this cool thing on XNA forums.