[osg-users] osgUtil::PositionalStateContainer::AttrMatrixList from the currentRenderStage

2014-09-24 Thread Trajce Nikolov NICK
Hi Robert, Community,

this will be hard to be described I guess, but I will try. Will make a
video as well later.

I am doing something with lights and in a CullCallback I do computation of
some light attribs for a shader. This something is splitting the
computation between the CPU and the GPU for lighting purposes.. And I am
doing sort of my LOD within this CullCallback. so the lights are not active
after a distance. And it works great but my cull time is really high so I
am about to optimize it with an LOD  (just a try). My scenegraph is like:

root->MatrixTransform->LightSource

and again it works ok as long as I add LOD between the transform and the
lightsource.

Honestly, I have no clue what is going on. The final result is as I am
getting close to the LOD switch out distance the lights are changing
position, intensity and they fade away.instead of just switch out on that
distance.

Since I am using the osgUtil::PositionalStateContainer::AttrMatrixList from
the currentRenderStage (snippet bellow) and I am using the matrices from
there for the osg::Light attributes something is telling me that these
matrices are somewhat wrong when LOD is in the scene path. But again this
is only guessing

I am aware that based on written above it is hard to give a hint and I had
big doubts to post this really, but just in case maybe someone will have an
idea.

Thanks a bunch as always

Nick

snippet from the cullcallback:

virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
  {
osgUtil::CullVisitor * cv = dynamic_cast(nv);

 osgUtil::PositionalStateContainer::AttrMatrixList &aml =
originalRenderStage->getPositionalStateContainer()->getAttrMatrixList();
 
 // here I iterate over the list and after I use the osg::Light attrib
with its associated matrix to compute stuff for the shader
 


-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgUtil::PositionalStateContainer::AttrMatrixList from the currentRenderStage

2014-09-24 Thread Trajce Nikolov NICK
Hi again,

here I managed to make some videos. The first one is without LOD in the
scene the second one is with LOD in the scene

Thanks a lot for any hint!

Nick

https://dl.dropboxusercontent.com/u/91101321/ll-1.mov
https://dl.dropboxusercontent.com/u/91101321/ll-2.mov

On Wed, Sep 24, 2014 at 2:28 PM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Hi Robert, Community,
>
> this will be hard to be described I guess, but I will try. Will make a
> video as well later.
>
> I am doing something with lights and in a CullCallback I do computation of
> some light attribs for a shader. This something is splitting the
> computation between the CPU and the GPU for lighting purposes.. And I am
> doing sort of my LOD within this CullCallback. so the lights are not active
> after a distance. And it works great but my cull time is really high so I
> am about to optimize it with an LOD  (just a try). My scenegraph is like:
>
> root->MatrixTransform->LightSource
>
> and again it works ok as long as I add LOD between the transform and the
> lightsource.
>
> Honestly, I have no clue what is going on. The final result is as I am
> getting close to the LOD switch out distance the lights are changing
> position, intensity and they fade away.instead of just switch out on that
> distance.
>
> Since I am using the osgUtil::PositionalStateContainer::AttrMatrixList
> from the currentRenderStage (snippet bellow) and I am using the matrices
> from there for the osg::Light attributes something is telling me that these
> matrices are somewhat wrong when LOD is in the scene path. But again this
> is only guessing
>
> I am aware that based on written above it is hard to give a hint and I had
> big doubts to post this really, but just in case maybe someone will have an
> idea.
>
> Thanks a bunch as always
>
> Nick
>
> snippet from the cullcallback:
>
> virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
>   {
> osgUtil::CullVisitor * cv = dynamic_cast(nv);
> 
>  osgUtil::PositionalStateContainer::AttrMatrixList &aml =
> originalRenderStage->getPositionalStateContainer()->getAttrMatrixList();
>  
>  // here I iterate over the list and after I use the osg::Light attrib
> with its associated matrix to compute stuff for the shader
>  
>
>
> --
> trajce nikolov nick
>



-- 
trajce nikolov nick
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org