With 100 skinned meshes that uses normal mapping my game runs at around 24fps, without normal mapping it's around 130fps. I want to make normal mapping optional so I therefor added an effect parameter (gUseNormalMap) that decides if it should be used or not.
I did this for testing:
cbuffer cbPerObject
{
bool gUseNormalMap;
}
...
if(gUseNormalMap)
{
float3 normalMapSample = gNormalMap.Sample(samLinear, pin.Tex).rgb;
pin.NormalW = NormalSampleToWorldSpace(normalMapSample, pin.NormalW, pin.TangentW);
}
else
return float4(0, 1, 0, 1);
If I set gUseNormalMap to true the fps is ~24 like it should be, but when I set it to false the fps still is 24 which it shouldn't be without normal mapping. What's makes it more weird is that the color of the mesh is green and that's correct since the else statement returns float4(0, 1, 0, 1). It's like both bodies of the if statement runs when gUseNormalMap is = false.
I also tested without using the effect parameter,
// Use normal mapping?
bool normalMapping = false;
if(normalMapping)
{
float3 normalMapSample = gNormalMap.Sample(samLinear, pin.Tex).rgb;
pin.NormalW = NormalSampleToWorldSpace(normalMapSample, pin.NormalW, pin.TangentW);
}
else
return float4(0, 1, 0, 1);but that gives the expected output. I hope I was clear enough and that someone knows what's going on!






