[osg-users] Lightpoint behavior with DirectionalSector
Robert Osfield
robert.osfield at gmail.com
Tue Feb 23 01:25:18 PST 2016
On 23 February 2016 at 09:13, Renato Semadeni <rsemadeni at flyelite.ch> wrote:
> Hi Robert
>
> Thanks a lot for the quick answer. And yes, I forgot that I could change
> the osg code and recompile it from scratch.
>
> The behavior was just bizarre, since there was no symmetrie between the
> behavior on the left side of the two lights compared to the right side.
> Since it would be obvious that it could be a geometric problem. But what we
> found was that the position in the frustum seems to be the souce of the
> behavior.
>
The direction vector between the eye point and the light point is used to
calculator intensity of the light point in the sector calculation, so one
would expect the things to change as the light point moves within the
frustum. The code that does this is in LightPointNode.cpp, note the if
(lp._sector.valid()) block at the bottom of the extract I've posted below.
// delta vector between eyepoint and light point.
osg::Vec3 dv(eyePoint-position);
float intensity = (_lightSystem.valid()) ?
_lightSystem->getIntensity() : lp._intensity;
// slip light point if its intensity is 0.0 or negative.
if (intensity<=minimumIntensity) continue;
// (SIB) Clip on distance, if close to limit, add transparancy
float distanceFactor = 1.0f;
if (_maxVisibleDistance2!=FLT_MAX)
{
if (dv.length2()>_maxVisibleDistance2) continue;
else if (_maxVisibleDistance2 > 0)
distanceFactor = 1.0f - osg::square(dv.length2() /
_maxVisibleDistance2);
}
osg::Vec4 color = lp._color;
// check the sector.
if (lp._sector.valid())
{
intensity *= (*lp._sector)(dv);
// skip light point if it is intensity is 0.0 or negative.
if (intensity<=minimumIntensity) continue;
}
Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160223/71d2be0e/attachment-0003.htm>
More information about the osg-users
mailing list