I just came across this today and it saved me soo much hassle. I'm working on a game which is quite high poly, unfortunately when I was stress testing GDK and doing some maths on how many poly's I can have on screen and the amount of enemies and friendlies I can have, it just didn't meet the criteria on what I wanted.
Then I found fastbone!!!!! which boost the framerate X3 and I could meet my goal. Only problem, is that it has a pixel shader in it that does lighting on the model, and I don't want that because I'm doing a cartoonish game.
If anyone one knows how to get rid of this I would be soooooooooooo happy. I've spent a long time doing trial and error to remove it but never had any luck.
Edit:
The problem I was having was when I'm animating a model. Since GDK uses the CPU for vertex manipulation it creates a lot of stress on the cpu. fastbone.fx uses the GPU, making it better in performance, as we all know GPU is more powerful than CPU.
Also I would like to use this fx with cartoon shader on the one model.
//
// Fast Bone
//
/************* UNTWEAKABLES **************/
float4x4 WorldIT : WorldInverseTranspose;
float4x4 WorldViewProj : WorldViewProjection;
float4x4 World : World;
float4x4 ViewInv : ViewInverse;
/*********** DBPRO UNTWEAKABLES **********/
float4x4 boneMatrix[32] : BoneMatrixPalette;
/************* SURFACE **************/
float4 lhtDir < string UIDirectional = "Light Direction"; >;
float4 LightPos : Position
<
string UIObject = "PointLight";
string Space = "World";
> = {100.0f, 100.0f, -100.0f, 0.0f};
float4 LightColor
<
string UIType = "Color";
> = {0.75f, 0.75f, 0.75f, 1.0f};
float4 AmbiColor : Ambient
<
string UIName = "Ambient Light Color";
> = {0.01f, 0.01f, 0.01f, 1.0f};
float4 SurfColor : Diffuse
<
string UIName = "Surface Color";
string UIType = "Color";
> = {1.0f, 1.0f, 1.0f, 1.0f};
/************* TEXTURES **************/
texture colorTexture : DiffuseMap
<
string Name = "default_color.dds";
string type = "2D";
>;
sampler2D colorSampler = sampler_state
{
Texture = <colorTexture>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};
/************* DATA STRUCTS **************/
struct appdata {
float3 Position : POSITION;
float4 UV : TEXCOORD0;
float4 Normal : NORMAL;
float4 Blendweight : TEXCOORD1;
float4 Blendindices : TEXCOORD2;
};
/* data passed from vertex shader to pixel shader */
struct vertexOutput {
float4 HPosition : POSITION;
float4 TexCoord : TEXCOORD0;
float4 Col : COLOR;
};
/*********** vertex shader ******/
vertexOutput mainVS(appdata IN)
{
vertexOutput OUT;
float3 netPosition = 0, netNormal = 0;
for (int i = 0; i < 4; i++)
{
float index = IN.Blendindices[i];
float3x4 model = float3x4(boneMatrix[index][0], boneMatrix[index][1], boneMatrix[index][2]);
float3 vec3 = mul(model, float4(IN.Position, 1));
vec3 = vec3 + boneMatrix[index][3].xyz;
float3x3 rotate = float3x3(model[0].xyz, model[1].xyz, model[2].xyz);
float3 norm3 = mul(rotate, IN.Normal);
netPosition += vec3.xyz * IN.Blendweight[i];
netNormal += norm3.xyz * IN.Blendweight[i];
}
float4 tempPos = float4(netPosition,1.0);
netNormal = normalize(netNormal);
float3 worldSpacePos = mul(tempPos, World).xyz;
OUT.TexCoord = IN.UV;
OUT.HPosition = mul(tempPos, WorldViewProj);
float3 L = -lhtDir;
float4 gogo;
gogo = (max(0, dot(netNormal, L))*SurfColor*0.8) + (SurfColor*0.2) + AmbiColor;
gogo.w=1;
OUT.Col = gogo;
return OUT;
}
float4 PS(
float4 Diff : COLOR0,
float2 Tex : TEXCOORD0) : COLOR
{
return tex2D(colorSampler, Tex) * Diff;
}
/****** technique *******/
technique dx9textured
{
pass p0
{
Sampler[0] = (colorSampler);
VertexShader = compile vs_2_0 mainVS();
PixelShader = compile ps_1_0 PS();
}
}