Hi Joakim,

I've just done a code review and a bit surprised by the form of the
transformation you've applied, as while it goes in the right
direction, doesn't look right.  You have:

  p' = p * M
  v' = v * M - p'

Where p is the original position of the billboard, v is the local
vertex of the billboard, and M is the matrix we are applying. p' and
v' and the new values.

Looking at the maths I think we should have

(v +p) * M = v' + p'
p' = p*M
v' = (v+p)*M - p'

So it looks like to me we should add the original position, then
multiple my the matrix then subtract the new position.

Does this sounds correct?  Am I missing something?

Robert.




On Mon, Nov 17, 2008 at 6:39 PM, Joakim Simonsson <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> When using optimizer option
> FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS, billboards are not
> correctly handled.
>
>
> Description:
>
> If a (rotated) matrixtransform had a billboard as child, the geometry of the
> billboard did get the wrong position and/or rotation.
>
> Fix:
>
> All vertices/normals of a billboard's geometry are now transformed. The
> position of the billboard is then subtracted from the vertices of the
> geometry.
>
>
>
> Files modified:
>
> src\osgUtil\Optimizer.cpp
> include\osgUtil\Optimizer
>
>
>
>
> --
> Joakim Simonsson
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to