An error occurred while compiling the resource
unable to unroll loop, loop does not appear to terminate in a timely manner (21 iterations), use the [unroll(n)] attribute to force an exact higher number
Content\GeonBit.Core\Effects\NormalMapLitEffect.fx 141
Content\GeonBit.Core\Effects\LitEffectAlphaTest.fx 123
Content\GeonBit.Core\Effects\LitEffect.fx 116
What are the problems with these fx files?
Please post code that caused the error.. Thanks.
This is where the Error in NormalMapLitEffect.fx 141 is reported
for (i = DirectionalLightsCount; i < ActiveLightsCount; ++i)
{
// if fully lit stop here
if (LightsColor.r > 1 && LightsColor.g > 1 && LightsColor.b > 1) { break; }
// calculate distance and angle factors for point light
float disFactor = 1.0f - (distance(input.WorldPos, LightPosition[i]) / LightRange[i]);
// out of range? skip this light.
if (disFactor > 0)
{
// power distance factor
disFactor = pow(disFactor, 2);
// calc with normal factor
float3 lightDir = normalize(input.WorldPos - LightPosition[i]);
float cosTheta = saturate(dot(-lightDir, fragNormal));
// add light to pixel
LightsColor.rgb += (LightColor[i]) * (cosTheta * LightIntensity[i] * disFactor);
}
}
This is where the Error in LitEffectAlphaTest.fx 123 is reported
for (i = DirectionalLightsCount; i < ActiveLightsCount; ++i)
{
// if fully lit stop here
if (LightsColor.r > 1 && LightsColor.g > 1 && LightsColor.b > 1) { break; }
// calculate distance and angle factors for point light
float disFactor = 1.0f - (distance(input.WorldPos, LightPosition[i]) / LightRange[i]);
// out of range? skip this light.
if (disFactor > 0)
{
// power distance factor
disFactor = pow(disFactor, 2);
// calc with normal factor
float3 lightDir = normalize(input.WorldPos - LightPosition[i]);
float cosTheta = saturate(dot(-lightDir, input.Normal));
// add light to pixel
LightsColor.rgb += (LightColor[i]) * (cosTheta * LightIntensity[i] * disFactor);
}
}
This is where the Error in LitEffect.fx 116 is reported
for (i = DirectionalLightsCount; i < ActiveLightsCount; ++i)
{
// if fully lit stop here
if (LightsColor.r > 1 && LightsColor.g > 1 && LightsColor.b > 1) { break; }
// calculate distance and angle factors for point light
float disFactor = 1.0f - (distance(input.WorldPos, LightPosition[i]) / LightRange[i]);
// out of range? skip this light.
if (disFactor > 0)
{
// power distance factor
disFactor = pow(disFactor, 2);
// calc with normal factor
float3 lightDir = normalize(input.WorldPos - LightPosition[i]);
float cosTheta = saturate(dot(-lightDir, input.Normal));
// add light to pixel
LightsColor.rgb += (LightColor[i]) * (cosTheta * LightIntensity[i] * disFactor);
}
}
They all went wrong on this paragraph. The three places seem to have the same mistake
Are you working on windows?
yes. windows10