Hi Daniel,

I faced the same problem

http://forum.openscenegraph.org/viewtopic.php?t=14354

How I fixed and hints from Robert. Hope it helps

Nick

On Fri, Dec 12, 2014 at 4:08 PM, Daniel Schmid <
daniel.sch...@swiss-simtec.ch> wrote:
>
> Hi all
>
> Trust me, I searched the forum for a hint but couldn't find stuff that
> could point me into a solution...
> To understand the situation, please have a look at the screenshot.
> I have tracks from a vehicle that are prerendered into a texture, and then
> blended with underground during the main shader. Everything works fine and
> I'm happy with the visual result.
>
> But there is one problem...
> As soon as I move (rotate) my main camera, the track texture starts to lag
> with the underground, it looks like if the modelview matrix are nomore in
> sync.
>
> Technical details:
>
> The model view and projection matrices for the prerender camera are
> calculated and passed into a uniform :
>
>
> Code:
>
> ...
> osg::Matrix MVP = m_Camera->getViewMatrix() *
> m_Camera->getProjectionMatrix();
>
> osg::Matrix MVPT = l_MainCamera->getInverseViewMatrix() * MVP *
> osg::Matrix::translate(1.0,1.0,1.0) * osg::Matrix::scale(0.5,0.5,0.5);
>
> m_TextureMatrix = MVPT;
>
> m_Camera->accept(*a_cv);
> ...
>
>
>
>
> The uniform with the textureMatrix is added to the root scene nodes
> stateset. In the shader, I calculate the TextureMatrix:
>
>
> Code:
>
> vec4 ecPos = gl_ModelViewMatrix * gl_Vertex;
> TexCoordTracksmap = tracksmapTextureMatrix * ecPos;
>
>
>
>
> What is the reason for the lagging? What do I have to consider? By the way
> I use ViewDependentShadowMap, and it also uses prerender camera and they
> don't produce lagging shadow, so there has to be a solution.
>
> Can anybody help?[/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=62044#62044
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>

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

Reply via email to