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 

Drawing large number of labels


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
loopy
User


Joined: 11 Mar 2009
Posts: 81

PostPosted: Fri Mar 31, 2017 12:12 am    Post subject:
Drawing large number of labels
Reply with quote

Hi, I am looking for suggestion on how to efficiently draw 'large' ( aka many thousands) numbers of 'labels' or 'string markers'
Typically these are short numeric strings. Instancing a osgText object for each label is likely to be very inefficient

Andrew
Thanks
Back to top
View user's profile Send private message
Chris Hanson
Guest





PostPosted: Fri Mar 31, 2017 2:04 am    Post subject:
Drawing large number of labels
Reply with quote

https://github.com/robertosfield/osgPairo


On Thu, Mar 30, 2017 at 6:12 PM, Andrew Cunningham < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,  I am looking for suggestion on how to efficiently draw 'large' ( aka many thousands) numbers of 'labels' or 'string markers'
Typically these are short numeric strings. Instancing a osgText object for each label is likely to be very inefficient

Andrew
Thanks

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70620#70620





_______________________________________________
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




--
Chris 'Xenon' Hanson, omo sanza lettere. http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Code Forensics • Digital Imaging • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel facebook.com/alphapixel (775) 623-PIXL [7495]

------------------
Post generated by Mail2Forum
Back to top
loopy
User


Joined: 11 Mar 2009
Posts: 81

PostPosted: Fri Mar 31, 2017 4:20 am    Post subject:
Reply with quote

Ok, will need to digest that. I am correct in assuming it will work on Windows.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Fri Mar 31, 2017 8:02 am    Post subject:
Drawing large number of labels
Reply with quote

HI Andrew,

On 31 March 2017 at 01:12, Andrew Cunningham <> wrote:
Quote:
Hi, I am looking for suggestion on how to efficiently draw 'large' ( aka many thousands) numbers of 'labels' or 'string markers'
Typically these are short numeric strings. Instancing a osgText object for each label is likely to be very inefficient

The osgPairo project that Chris mentioned is a merge of
osgPango/osgCairo that I made to make it simpler to build and easier
to adapt the internal subgraphs it creates for rendering, osgPairo and
osgPango in their native form run much slower than osgText so on it's
own would be a step back performance/scalability-wise, the approach
take is to trade visual quality and flexibility with performance so I
wouldn't recommend using it as is.

I haven't benchmarked it for thousands of labels but over the last
month I did a rewrite of the internals of osgText to facilitate usage
with vertex array objects that are required under some recent GL
variants. The new osgText classes are now utilise vertex arrays
properly and push significantly less state changes than before so
should be more efficient.

What it may be worth doing is performance test using osgText as is,
then osgText in OSG master just to see if ether work well enough in
your usage case. If they do then job done.

If they don't then the most efficient way to do thousands of labels is
to use create osg::Geometry that geographically batch quads from
multiple labels. I have used this approach to take the osgPairo text
and build it into a form that is most efficient for rendering and it
allowed us to massively cut the CPU and GPU overhead associated with
osgPairo text - it was several orders of magnitude faster, ten's of
thousands of labels on screen at 60Hz isn't a problem.

However, the batching code was for a client and not open source so
it's not something one can leverage beyond the knowledge that the
approach works well. There a number of other approaches you could take
creative use of shaders, they are unlikely to perform better than the
batching approach and require greater investment in
design/development/testing. If you need to dynamically update the
text labels on a per frame basis then coming up with a shader approach
that generates the labels from within
vertex/tessellation/geometry/fragment shader combination will likely
be worth it.

All the alternative approaches to just osgText are progressively more
expensive to write so I'd suggest just benchmarking what things are
like using osgText both older and the OSG master versions, let us know
how things scale and if things need to improve we can guide you in the
right direction. When bencharking, try to create a representative
test for your usage case, benchmark with a release build, vsync off,
look at overall frame rate, but in particular the views that cause the
most performance issues. For problem areas create a specific
benchmark. For instance one can use an osg::CameraPath written out to
disk and then reloaded and replayed by the
osgGA::CameraPathManipulator, different paths can test different view
combinations. You can then use the same set of paths for testing as
try various approach to check progress.

When looking at benchmarking the overall framerate is coarse indicator
of problem, it doesn't tell you the cause, for the cause you'll need
to look at full on-screen stats provided by the OSG's StatsHandler,
the update, event, cull, draw dispatch and draw GPU are elements that
may be bottlenecks, the larges of these will be the area you'll want
to concentrate on first.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
loopy
User


Joined: 11 Mar 2009
Posts: 81

PostPosted: Fri Mar 31, 2017 3:47 pm    Post subject:
Reply with quote

Hi Robert,
Thanks for the very detailed reply - I don't know where you find the time! I think you gave me some good ideas. For example, I only need to render numbers. I could render each digit and reuse the vertex arrays to compose the number.
Thanks a bunch!
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Fri Mar 31, 2017 4:25 pm    Post subject:
Drawing large number of labels
Reply with quote

Hi Andrew,

Vertices are cheap. Reusing them might be more expensive than just
duplicating. Rather than ruse vertices you may be better off just
uses shaders to generate the glyphs and select the required texcoords.
It'd be easier just to duplicate vertices and use straight
osg::Geometry.

Robert.

On 31 March 2017 at 16:47, Andrew Cunningham <> wrote:
Quote:
Hi Robert,
Thanks for the very detailed reply - I don't know where you find the time! I think you gave me some good ideas. For example, I only need to render numbers. I could render each digit and reuse the vertex arrays to compose the number.
Thanks a bunch!

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70628#70628








------------------
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 Mapping texture coordinates to a port... ijwolf8 General 0 Thu Oct 25, 2018 8:11 pm View latest post
No new posts Culling and instanced drawing wernerM General 7 Fri Jul 13, 2018 4:45 pm View latest post
No new posts indirect drawing sergio2k18 General 2 Sun Jul 08, 2018 7:09 pm View latest post
No new posts Drawing a partially transparent image... Jose Pedro Canilho General 6 Mon Jul 02, 2018 9:28 am View latest post
No new posts Large number of occluder nodes d_a_heitbrink General 5 Wed May 30, 2018 10:10 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