[osg-users] Tiny normals: osgviewer vs osgcompositeviewer

Julien Valentin julienvalentin51 at gmail.com
Fri Feb 8 21:38:00 PST 2019


In fact perhaps there's something wrong with the code:
According the comment, and considering M=transpose(M)*invert(M) is orthogonal
shoudn't it be something like:
            (*itr) = osg::Matrix::transform3x3(inverse(_im),(*itr));
or
         (*itr) = osg::Matrix::transform3x3((*itr),transpose(inverse(_im)));

Perahps it would be wiser to use a simple premult for normals 
         (*itr) = osg::Matrix::transform3x3((*itr),im));

try these solution with your model and give feedback



mp3butcher wrote:
> Hi,
> Normals transformation happen in osgUtil/TransformAttributeFunctor.cpp l.44 
> 
> Code:
>         for (osg::Vec3d* itr=begin;itr<end;++itr)
>         {
>             // note post mult by inverse for normals.
>             (*itr) = osg::Matrix::transform3x3(_im,(*itr));
>             (*itr).normalize();
>         }
> 
> 
> All seams right ..
> perhaps forcing orthogonality of the 3x3 with pseudo inverse and remove normalization could give better result...Don't know
> Cheers
> 
> Bonghi wrote:
> > Hi Per,
> > 
> > I'm finding the same problem as I'm trying to build a viewer that integrates a variety of models coming in different units (eg. mm vs. m).
> > 
> > Have you had any further look at the code to include a fix?
> > 
> > My thinking is that normals should only be rotated by the transform matrix, but I've not invested time yet to understand where this should happen in the code. 
> > 
> > Thanks,
> > Claudio
> [/code]


------------------------
Twirling twirling twirling toward freedom

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75611#75611







More information about the osg-users mailing list