[osg-users] Scale object based on camera distance
Trajce Nikolov NICK
trajce.nikolov.nick at gmail.com
Sun Jan 6 22:22:04 PST 2019
Hi David,
have a look at osg::AutoTransform
On Mon, Jan 7, 2019 at 1:41 AM David Mitchell <moohasha at gmail.com> wrote:
> I have certain nodes/objects in my scene that I always want to be the same
> size regardless of their distance from the camera and I'm trying to figure
> out the best way to go about doing this. My first thought is to create a
> custom NodeCallback to add to the node as a cull callback and then get the
> distance from the node to the camera and apply the appropriate scale to the
> node (as a MatrixTransform). Is that a reasonable approach?
>
> The other thing I'm struggling with is how to calculate the proper scale.
> What I'd like is for the object's geometry to translate to pixel units,
> meaning if the vertices range from (-10, -10, -10) to (10, 10, 10), then it
> would take up roughly 20x20 pixels on the screen when scaled. Rather than
> fumbling around with different matrices and transforms trying to get this
> to work, I thought I'd try asking first.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75383#75383
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190107/e7055d9d/attachment.html>
More information about the osg-users
mailing list