Scaling billboard text with a transform? #985
-
Hi Robert, To reproduce this, you can alter vsgtext.cpp to insert a scaling transform on one of the nodes: (Line 287): #if 0
scenegraph->addChild(text);
#else
auto mt = vsg::MatrixTransform::create();
mt->matrix = vsg::scale(5.0);
mt->addChild(text);
scenegraph->addChild(mt);
#endif It scales the position itself, which is interesting, but the actual size of the text doesn't change. Any advice on this? |
Beta Was this translation helpful? Give feedback.
Answered by
robertosfield
Sep 29, 2023
Replies: 1 comment 6 replies
-
Could it be that the default camera position is simply moving back to encompass the now larger scene? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vsg::Text is able to do this out of the box, you should just need to set the vsg::StandardLayout with billboard set to true, set the screen size via the horizontal and vertical parameters, and set the billboardAutoScaleDistance to the maximum distance that you want the text to be scaled until it is simply scaled as if object coordinates.
I implemented this combination to enable one to control the screensize when close enough but then have it shrink as other object space objects do when you are far enough away that text labels would otherwise overlap.
This scaling is done entirely by the vertex shader in the code I linked to above, so it's very lightweight and scales nicely for large numbe…