<div dir="ltr">On 23 February 2016 at 09:13, Renato Semadeni <span dir="ltr"><<a href="mailto:rsemadeni@flyelite.ch" target="_blank">rsemadeni@flyelite.ch</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Robert<br>
<br>
Thanks a lot for the quick answer. And yes, I forgot that I could change the osg code and recompile it from scratch.<br>
<br>
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.<br></blockquote><div><br></div><div>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.<br><br><br> // delta vector between eyepoint and light point.<br> osg::Vec3 dv(eyePoint-position);<br><br> float intensity = (_lightSystem.valid()) ? _lightSystem->getIntensity() : lp._intensity;<br><br> // slip light point if its intensity is 0.0 or negative.<br> if (intensity<=minimumIntensity) continue;<br><br> // (SIB) Clip on distance, if close to limit, add transparancy<br> float distanceFactor = 1.0f;<br> if (_maxVisibleDistance2!=FLT_MAX)<br> {<br> if (dv.length2()>_maxVisibleDistance2) continue;<br> else if (_maxVisibleDistance2 > 0)<br> distanceFactor = 1.0f - osg::square(dv.length2() / _maxVisibleDistance2);<br> }<br><br> osg::Vec4 color = lp._color;<br><br> // check the sector.<br> if (lp._sector.valid())<br> {<br> intensity *= (*lp._sector)(dv);<br><br> // skip light point if it is intensity is 0.0 or negative.<br> if (intensity<=minimumIntensity) continue;<br><br> }<br><br><br></div><div>Robert.<br></div><div> </div></div></div></div>