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 

OSGNode VBO Control


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


Joined: 27 Apr 2015
Posts: 2

PostPosted: Tue Oct 27, 2015 2:40 pm    Post subject:
OSGNode VBO Control
Reply with quote

Hi,

I'm starting to work my way through the source for Geometry and Drawable, but more experienced minds might be able to point me in the right directions sooner.

I'm working on a AR HUD and because a later point in the project might require the loading of complex models to represent avatars or vehicles inside the AR space we have chosen to use OSG as a starting point. The current UI is currently relatively primitive and basically consist entirely of billboards of varying textures with minor text glyphs to indicate various properties.

I've implemented most of the billboards in a single VBO based Geometry node. Because the target hardware is lacking I wanted to play with partial updates to the VBO contents based on our current draw performance. First pass I simply created a post function for manually controlling where in the draw thread buffer transfers occur, but it has become apparent to me from profiling that this might only be marking the VBO as dirty and the actual upload occurring during the next draw frame.


Code:
   void OSGVboMarker::post()
   {
      if (m_frontVBO.isInitialized && m_bDirtyBit)
      {
         m_swapLock.lock();
         int count = m_frontVBO.vertices->size();
         m_pGeometry->setVertexArray( m_frontVBO.vertices );

         m_pGeometry->setNormalArray(m_frontVBO.normal, osg::Array::BIND_OVERALL);
         m_pGeometry->setColorArray(m_frontVBO.color, osg::Array::BIND_OVERALL);
         
         m_pGeometry->setTexCoordArray(0,m_frontVBO.texCoords, osg::Array::BIND_PER_VERTEX);
         
         m_pGeometry->setVertexAttribArray(5, m_frontVBO.centers, osg::Array::BIND_PER_VERTEX);
         m_pGeometry->setVertexAttribArray(6, m_frontVBO.scaleValues, osg::Array::BIND_PER_VERTEX);
         
         m_pDrawArrays->setCount(count);
         m_pDrawArrays->set(osg::PrimitiveSet::QUADS, 0, count);


So, I have two questions related to the above.

1. When do modified VBO nodes push memory to the card.
2. Is it possible to manually control this operation and possibly do sub buffer updates.
...

Thank you!

Cheers,
Ignitus
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12323

PostPosted: Tue Oct 27, 2015 2:57 pm    Post subject:
OSGNode VBO Control
Reply with quote

Hi Ignitus,


I can't help feel that you are diving into low level stuff way you've established that it's required.


The OSG can manage update's to VBO's for you, it doesn't current support updating parts of osg::Array, potentially you can implement this yourself with a custom draw callback or custom Drawable, but personally I'd recommend not attempting anything like this early in your project.


My recommendation would be to implement what you need just using standard OSG components and once you have what you want rendered onscreen then do performance profiling (with an optimized build) on the target platforms to see whether you have the performance you are after.  If you have the performance you need, job done, not need to waste any more time.  If you don't have the performance you need then start looking at what the bottleneck is.  Only once you've established what the bottleneck is should you start considering looking at re-organizing your scene graph. Using custom custom VBO management would the amongst the last things I'd try.


Robert.


On 27 October 2015 at 14:40, Ignitus Boyone < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

I'm starting to work my way through the source for Geometry and Drawable, but more experienced minds might be able to point me in the right directions sooner.

I'm working on a AR HUD and because a later point in the project might require the  loading of complex models to represent avatars or vehicles inside the AR space we have chosen to use OSG as a starting point. The current UI is currently relatively primitive and basically consist entirely of billboards of varying textures with minor text glyphs to indicate various properties.

I've implemented most of the billboards in a single VBO based Geometry node.  Because the target hardware is lacking I wanted to play with partial updates to the VBO contents based on our current draw performance.  First pass I simply created a post function for manually controlling where in the draw thread buffer transfers occur, but it has become apparent to me from profiling that this might only be marking the VBO as dirty and the actual upload occurring during the next draw frame.



Code:
        void OSGVboMarker::post()
   {
                if (m_frontVBO.isInitialized && m_bDirtyBit)
                {
                        m_swapLock.lock();
                        int count = m_frontVBO.vertices->size();
                        m_pGeometry->setVertexArray( m_frontVBO.vertices );

                        m_pGeometry->setNormalArray(m_frontVBO.normal, osg::Array::BIND_OVERALL);
                        m_pGeometry->setColorArray(m_frontVBO.color, osg::Array::BIND_OVERALL);

                        m_pGeometry->setTexCoordArray(0,m_frontVBO.texCoords, osg::Array::BIND_PER_VERTEX);

                        m_pGeometry->setVertexAttribArray(5, m_frontVBO.centers, osg::Array::BIND_PER_VERTEX);
                        m_pGeometry->setVertexAttribArray(6, m_frontVBO.scaleValues, osg::Array::BIND_PER_VERTEX);

                        m_pDrawArrays->setCount(count);
                        m_pDrawArrays->set(osg::PrimitiveSet::QUADS, 0, count);




So, I have two questions related to the above.

1. When do modified VBO nodes push memory to the card.
2. Is it possible to manually control this operation and possibly do sub buffer updates.
...

Thank you!

Cheers,
Ignitus

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





_______________________________________________
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
Ignitus
Newbie


Joined: 27 Apr 2015
Posts: 2

PostPosted: Tue Oct 27, 2015 3:43 pm    Post subject:
Reply with quote

Hi,

I can spend sometime exploring render order. The scene has a few dynamic elements and I believe if the uploads for those elements happens after the VBO draw-calls then I am likely suffering a longer pipeline stall then I really can afford.

...

Thank you!

Cheers,
Ignitus
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12323

PostPosted: Tue Oct 27, 2015 4:07 pm    Post subject:
OSGNode VBO Control
Reply with quote

Hi Ignitus,

On 27 October 2015 at 15:43, Ignitus Boyone < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
I can spend sometime exploring render order. The scene has a few dynamic elements and I believe if the uploads for those elements happens after the VBO draw-calls then I am likely suffering  a longer pipeline stall then I really can afford.


It still sounds like you've decided upon what the problem is, what it may not be an issue at all.



Don't make any assumptions what performance problem might be before doing benchmarking, there are many things that affect performance, and many different solutions.



Robert.

 

------------------
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 Control the content in a HUD window u... 徐志敏 General 0 Wed Jul 13, 2016 3:23 am View latest post
No new posts hard to understand behavior of contro... mg969 General 0 Mon Dec 15, 2014 8:11 pm View latest post
No new posts 3d control in scene (ignore scene dep... Jason Anderssen General 4 Fri Aug 15, 2014 1:19 am View latest post
No new posts Rubber-band control for resizing an o... mots_g General 2 Mon Dec 09, 2013 4:41 am View latest post
No new posts again_question about black-out(BO) of... kim jong bum General 1 Tue Nov 05, 2013 4:29 am 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