OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgText - alignment differences using the new implementation


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
gwaldron (Glenn Waldron)
Appreciator


Joined: 25 Aug 2011
Posts: 213

PostPosted: Thu Feb 01, 2018 5:51 pm    Post subject:
osgText - alignment differences using the new implementation
Reply with quote

Robert,

I've been working with your new osgText implementation. The improvement in quality is great, especially with outlines and SDF!


I did notice something interesting however. The GREYSALE and SDF shader techniques yield different extents when you call Text::getBoundingBox(). Since I use the bounding box to align elements on the screen, this became immediately obvious when switching to the new osgText code.


Here is a simple program you can use to validate: https://pastebin.com/WhFsQSMT


In the "osgtext" example, you can also see a wider margin in the alignment box when using SDF vs. GREYSCALE.



The SDF technique uses a non-zero glyph texel margin, which I believe accounts for this difference. That got me wondering whether the various AlignmentType techniques ought to be compensating for this extra margin as well. 


Your thoughts? Should the two techniques be drawing at the same location?
Glenn Waldron

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12027

PostPosted: Sat Feb 03, 2018 2:39 pm    Post subject:
osgText - alignment differences using the new implementation
Reply with quote

Hi Glenn,

I don't have time to look into this right away, hopefully I'll have
time next week.

In principle SDF and GREYSCALE should be aligned the same way, and the
rendering result should be broadly similar. At this point I can't
think of reason for differences that you have observed so will have to
put in some time with your test code and the osgText source code to
see what might be going on.

Robert.

On 1 February 2018 at 17:47, Glenn Waldron <> wrote:
Quote:
Robert,

I've been working with your new osgText implementation. The improvement in
quality is great, especially with outlines and SDF!

I did notice something interesting however. The GREYSALE and SDF shader
techniques yield different extents when you call Text::getBoundingBox().
Since I use the bounding box to align elements on the screen, this became
immediately obvious when switching to the new osgText code.

Here is a simple program you can use to validate:
https://pastebin.com/WhFsQSMT

In the "osgtext" example, you can also see a wider margin in the alignment
box when using SDF vs. GREYSCALE.

The SDF technique uses a non-zero glyph texel margin, which I believe
accounts for this difference. That got me wondering whether the various
AlignmentType techniques ought to be compensating for this extra margin as
well.

Your thoughts? Should the two techniques be drawing at the same location?

Glenn Waldron





------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12027

PostPosted: Tue Feb 06, 2018 6:17 pm    Post subject:
osgText - alignment differences using the new implementation
Reply with quote

Hi Glenn,

I have now started looking into the alignment issue and tracked it
down to the way that the bounding box is expanded the glyph size plus
the margin required for the SDF/mipmapping sampling. The margin for
the SDF is bigger than is require for the greyscale so the bounding
box ends up being bigger.

This is good for rendering and culling purposes as it makes sure that
the whole glyph is always rendered, but it is adversely affecting the
alignment set up, and usage cases like yours.

It looks like I need to decouple the margin from contributing so much
to the alignment calculation. Not sure yet what the best thing to do
is.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12027

PostPosted: Tue Feb 06, 2018 6:23 pm    Post subject:
osgText - alignment differences using the new implementation
Reply with quote

Hi Glenn, el. al.

On 6 February 2018 at 17:42, Robert Osfield <> wrote:
Quote:
It looks like I need to decouple the margin from contributing so much
to the alignment calculation. Not sure yet what the best thing to do
is.

What I have done is to change the text bounding box calculation so
that it's only based on the glyph width and height and doesn't take
into account the extra margin used to account for texel sampling.

In theory the new approach might lead to view frustum culling a text
drawable when a sliver of edge might be visible due to mipmapping
blurring the text out. Outlines may be an issue too.

What the new approach does it to provide a consistent position now
regardless of the shader technique used. The commit is:

https://github.com/openscenegraph/OpenSceneGraph/commit/55a45e3c0e2634925a06f1e54877c808e8fc5786

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
gwaldron (Glenn Waldron)
Appreciator


Joined: 25 Aug 2011
Posts: 213

PostPosted: Wed Feb 07, 2018 4:12 pm    Post subject:
osgText - alignment differences using the new implementation
Reply with quote

Robert,Thank you! Your fix checks out; the positioning is now consistent for me in both versions.



Glenn Waldron




On Tue, Feb 6, 2018 at 12:59 PM, Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi Glenn, el. al.

On 6 February 2018 at 17:42, Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
It looks like I need to decouple the margin from contributing so much
to the alignment calculation.  Not sure yet what the best thing to do
is.

What I have done is to change the text bounding box calculation so
that it's only based on the glyph width and height and doesn't take
into account the extra margin used to account for texel sampling.

In theory the new approach might lead to view frustum culling a text
drawable when a sliver of edge might be visible due to mipmapping
blurring the text out.  Outlines may be an issue too.

What the new approach does it to provide a consistent position now
regardless of the shader technique used.  The commit is:

https://github.com/openscenegraph/OpenSceneGraph/commit/55a45e3c0e2634925a06f1e54877c808e8fc5786

Robert.
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts osgText: two thread-safety issues gwaldron General 1 Tue Jul 31, 2018 2:54 pm View latest post
No new posts Extra draw calls in osgText? gwaldron General 1 Thu Jul 19, 2018 8:48 pm View latest post
No new posts strange behaviour with osgText::Text christoph General 0 Wed Jul 18, 2018 12:06 pm View latest post
No new posts Why is osgText::Text very slow when i... OmegaDoom General 1 Wed Jul 04, 2018 5:31 am View latest post
No new posts setAxisAlignment(osgText::Text::SCREE... OmegaDoom General 1 Tue Jun 26, 2018 9:40 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP