I dont think those are just per-vertex lighting artifacts however, there is absolutely no attenuation (It gets cut off due to radius before getting a chance to attenuate).
I encountered similar issues and solved it by setting attenuation manually after applying radius but I haven't had a chance to take a look at the engine code that might be causing this problem.
EDIT:
Try this:
Code: Select all
lightNode->setRadius(lightRadius);
lightNode->getLightData().Attenuation = vector3df(1.0f, 1.0f / lightRadius, 1.0f / (lightRadius * lightRadius));
EDIT2:
What's strange is that MSDN does suggest this:
Typically, an application sets Attenuation0 to 0.0, Attenuation1 to a constant value, and Attenuation2 to 0.0.
So if that does indeed fix the problem then I'm at a loss as to why.
EDIT3:
The formula that the GPU uses to calculate the strength of a light at a vertex is:
Code: Select all
Atten = 1/( att0i + att1i * d + att2i * d2)
Now assuming that att0i and att2i == 0, the light radius is 5 and att1i is set to 1/5, at 0 distance we get "1/(1/5 * 0)", which is infinity. As we approach the light's border, at distance 5 we get "1/(1/5 * 5)" which is equal to 1 exactly.
Basically what this means is that the attenuation factor irrlicht is currently using (0, 1/d, 0) would provide a light strength of > 1 everywhere inside the light's radius, leading to the artifacts visible in that screenshot (That being, an instant cutoff).
Surely I am missing something here. Either the MSDN docs are suggesting something ridiculous or there is another cause for this issue.
I am moving this to bug reports as I'm almost certain there is something wrong here.
EDIT4:
Oh yeah, I just noticed that you set the radius using SLightData and not using ILightSceneNode::setRadius (And therefore the attenuation factors did not even get calculated). If this solves your issue then I guess we don't have a problem here.