[osg-users] Scale object based on camera distance
David Mitchell
moohasha at gmail.com
Fri Jan 4 08:58:03 PST 2019
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
More information about the osg-users
mailing list