[osg-users] Tiny normals: osgviewer vs osgcompositeviewer
Per Nordqvist
nordqvist at gmail.com
Mon Feb 11 05:20:29 PST 2019
Hello Claudio / Julien,
This is still an unsolved problem for me, it normally occurs when I
integrate purchased models
in Remo3d (osg-based tool). Last time we discussed this I used osg
optimizer as a workaround
to rescale the normals but I would be really happy for a permanent fix.
I am not in a position to test Juliens code at the moment, but if anyone
does I am interested.
Cheers,
Per
On Sat, 9 Feb 2019 at 06:37, Julien Valentin <julienvalentin51 at gmail.com>
wrote:
> 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
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190211/f0e161c9/attachment.html>
More information about the osg-users
mailing list