[osg-users] osgText: problem with SCREEN_COORDS mode
Robert Osfield
robert.osfield at gmail.com
Sat May 19 04:11:01 PDT 2018
Hi Glenn,
While I haven't got to the bottom of the change in behaviour, I am not sure
that SCREEN_COORDS scaling is wholly appropriate for you usage case, the
originally behaviour might have worked OK for you but I know it wasn't
working 100% correct w.r.t scaling.
If I could rewrite osgText without worrying about backwards compatibility I
most like wouldn't push scaling and auto rotation functionality in the
basic osgText, rather I'd leave this to AutoTransform/Billboard type
nodes. As we are trying to walk the tightrope of retaining backwards
compatibility and fixing bugs we have less wriggle room.
At this point in time I don't know if the new SCREEN_COORDS should behave
how you are wanting it to behave as strictly you can't have it scaling in
screen coords if the text isn't aligned to the screen. What you are
probably after is uniform scaling of the text based on it's center, but not
clear on how one would encode that into an actual function to get the exact
behaviour you want. This is where making it a custom behaviour would
allow users to resolve this. Subclassing from osgText is possible so
perhaps this is an avenue.
Robert.
On 18 May 2018 at 18:01, Glenn Waldron <gwaldron at gmail.com> wrote:
> Robert,
> Thank you for look into this. Indeed, my use case is an earth graticule
> with labels in the grid cells.
>
> As the labels become more rotated away from the camera, things begin to
> break down:
>
> [image: 2018-05-18_125340.jpg]
>
> Removing the rotational elements yields a better result:
>
> [image: 2018-05-18_125144.jpg]
>
> I understand that just removing rotations might cause other side effects
> so maybe there's a better approach.
>
> Even if this is not a bug, it is a regression relative to OSG 3.4.1. Let
> me know if you want me to do any further testing.
>
> Glenn Waldron
>
>
> On Fri, May 18, 2018 at 6:27 AM Robert Osfield <robert.osfield at gmail.com>
> wrote:
>
>> Hi Glenn,
>>
>> I have now looked at your test program and can reproduce the stretched
>> text.
>>
>> The example is a bit unusual in that you have text size set to
>> SCREEN_COORDS but the orientation of the text is free to move with the
>> scene as it gets rotated by the viewer's camera,
>>
>> What I'd normally expect is that if you are using:
>>
>> text->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
>>
>> Then it would be normal to also us:
>>
>> text->setAxisAlignment(osgText::Text::SCREEN);
>>
>> Adding this to your test example fixes the issue. So I'm curious, do you
>> have an instance where the character size should be scaled to SCREEN_COORDS
>> but with the AxisAlignment set to SCREEN.
>>
>> As a general comment, if you are scaling the text to screen coords the
>> rotation of the text will be important to take into account as the aspect
>> ratio of the window can be altered so required the horizontal and vertical
>> scaling can be different, which will be affected by the rotation of the
>> text.
>>
>> At this point I don't think we are looking at a bug, rather just an odd
>> behaviour when using text is an odd way.
>>
>> Robert.
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
> _______________________________________________
> 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/20180519/3b29f3fa/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2018-05-18_125144.jpg
Type: image/jpeg
Size: 291374 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180519/3b29f3fa/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2018-05-18_125340.jpg
Type: image/jpeg
Size: 306838 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180519/3b29f3fa/attachment-0003.jpg>
More information about the osg-users
mailing list