However, I did notice a small problem. The render spheres for your point lights appear to be too small. There is a visible boundary where the lights suddenly drop off to zero.

This can be fixed by adding the line:

Code: Select all

`outerRadius = (-b + sqrt(b*b - 4*a*(c - 256 ))) / (2*a);`

Pictures: (Left is before the code was added, right is after)

Keep up the good work.

EDIT:

I almost forgot:

Code: Select all

```
if( a == 0 )
if( b != 0 )
outerRadius = (256 - c) / b;
else
outerRadius = mParentLight->getAttenuationRange();
```

Code: Select all

```
Ogre::ColourValue diffuse = mParentLight->getDiffuseColour();
float initial = (diffuse.r > diffuse.g? diffuse.r : diffuse.g);
initial = (diffuse.b > initial? diffuse.b : initial);
outerRadius = (-b + sqrt(b*b - 4*a*(c - 256 * initial ))) / (2*a);
if( a == 0 )
if( b != 0 )
outerRadius = (256 * initial - c) / b;
else
outerRadius = mParentLight->getAttenuationRange();
```

This would create smaller spheres for dimmer lights.

This could also be optimized more by decreasing the lower bound value. This calculates the distance until the light is zero, but could be modified to stop at a higher value.