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 

Limit in size of VBOs?


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


Joined: 06 Dec 2013
Posts: 45

PostPosted: Wed Sep 06, 2017 8:49 am    Post subject:
Limit in size of VBOs?
Reply with quote

Dear OSG forum,

I am currently switching from using display lists to using VBOs.

I display 2 different meshes with it:

  • one is a usual mesh with ~1000 triangles
  • the other one is very dense ~10M vertices (from a room scan)


The usual mesh displays fine with the VBOs, but when adding the dense mesh I have a crash in the rendering, here is my calls stack:



As you can see, it is really at the rendering stage that the problem happens, not when setting up the VBO.

Here is my code (it is the same code that sets up both the usual and dense meshes):

Code:

osg::ref_ptr<osg::Geode> SetupMesh(const Eigen::Vector3Array& vertices, IntegerArray const& triangles, const Eigen::Vector3Array& normals, const osg::Vec4f& color, Node* node)
{
    osg::ref_ptr<osg::Geode> geode = new osg::Geode();
    assert(geode);
    osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry();
    assert(geometry);
    osg::ref_ptr<osg::Vec3Array> vertices_osg = new osg::Vec3Array();
    assert(vertices_osg);
    osg::ref_ptr<osg::Vec3Array> normals_osg = new osg::Vec3Array();
    assert(normals_osg);
    osg::ref_ptr<osg::DrawElementsUInt> triangles_osg = new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, 0);
    assert(triangles_osg);
    osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array();
    assert(colors);

    osg::ref_ptr<NodeReference> userData = new NodeReference(node);
    geometry->setUserData(userData);

    // VBO.
//    geometry->setUseDisplayList(false);
    geometry->setUseVertexBufferObjects(true);

    // Setup.
    geode->addDrawable(geometry);
    geometry->setVertexArray(vertices_osg);
    geometry->setNormalArray(normals_osg);
    geometry->addPrimitiveSet(triangles_osg);
    geometry->setColorArray(colors);

    // Vertices.
    vertices_osg->reserve(vertices.size());
    for (int i = 0; i < vertices.size(); ++i)
        vertices_osg->push_back(EigenToOsgVector3(vertices[i]));

    // Normals.
    normals_osg->setBinding(osg::Array::BIND_PER_VERTEX);

    normals_osg->reserve(normals.size());
    for (int i = 0; i < normals.size(); ++i)
        normals_osg->push_back(EigenToOsgVector3(normals[i]));

    // Triangles.
    triangles_osg->reserve(triangles.size());
    for (int i = 0; i < triangles.size(); ++i)
        triangles_osg->push_back(triangles[i]);

    // Colors.
    colors->setBinding(osg::Array::BIND_OVERALL);

    colors->push_back(color);

    return geode;
}


The config being tested is OSG 3 4.0, Ubuntu 14.04, nvidia driver 367.48, and gcc 4.8 4.

Any idea of what's going on?

Thanks,

Antoine


Last edited by arennuit on Wed Sep 06, 2017 10:11 am; edited 1 time in total
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11154

PostPosted: Wed Sep 06, 2017 8:56 am    Post subject:
Limit in size of VBOs?
Reply with quote

Hi Antoine,


There isn't much we can pinpoint from the information provided.  It could be a driver bug, it could be a straight out of memory issue.


What OSG version are you using?  What OS/hardware/drivers/build tools are you using?



Have you tried other OS/hadwardware/driver combinations?



Robert.


On 6 September 2017 at 09:49, Antoine Rennuit < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Dear OSG forum,

I am currently switching from using display lists to using VBOs.

I display 2 different meshes with it:

         one is a usual mesh with ~1000 triangles

         the other one is very dense ~10M vertices (from a room scan)



The usual mesh displays fine with the VBOs, but when adding the dense mesh I have a crash in the rendering, here is my calls stack:

[img]]https://drive.google.com/open?id=0B4i1g-UqIF8yZFk4TlRrblVrUVk[/img]

As you can see, it is really at the rendering stage that the problem happens, not when setting up the VBO.

Here is my code


Code:

osg::ref_ptr<osg::Geode> SetupMesh(const Eigen::Vector3Array& vertices, IntegerArray const& triangles, const Eigen::Vector3Array& normals, const osg::Vec4f& color, Node* node)
{
    osg::ref_ptr<osg::Geode> geode = new osg::Geode();
    assert(geode);
    osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry();
    assert(geometry);
    osg::ref_ptr<osg::Vec3Array> vertices_osg = new osg::Vec3Array();
    assert(vertices_osg);
    osg::ref_ptr<osg::Vec3Array> normals_osg = new osg::Vec3Array();
    assert(normals_osg);
    osg::ref_ptr<osg::DrawElementsUInt> triangles_osg = new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, 0);
    assert(triangles_osg);
    osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array();
    assert(colors);

    osg::ref_ptr<NodeReference> userData = new NodeReference(node);
    geometry->setUserData(userData);

    // VBO.
//    geometry->setUseDisplayList(false);
    geometry->setUseVertexBufferObjects(true);

    // Setup.
    geode->addDrawable(geometry);
    geometry->setVertexArray(vertices_osg);
    geometry->setNormalArray(normals_osg);
    geometry->addPrimitiveSet(triangles_osg);
    geometry->setColorArray(colors);

    // Vertices.
    vertices_osg->reserve(vertices.size());
    for (int i = 0; i < vertices.size(); ++i)
        vertices_osg->push_back(EigenToOsgVector3(vertices[i]));

    // Normals.
    normals_osg->setBinding(osg::Array::BIND_PER_VERTEX);

    normals_osg->reserve(normals.size());
    for (int i = 0; i < normals.size(); ++i)
        normals_osg->push_back(EigenToOsgVector3(normals[i]));

    // Triangles.
    triangles_osg->reserve(triangles.size());
    for (int i = 0; i < triangles.size(); ++i)
        triangles_osg->push_back(triangles[i]);

    // Colors.
    colors->setBinding(osg::Array::BIND_OVERALL);

    colors->push_back(color);

    return geode;
}




Any idea of what's going on?

Thanks,

Antoine[/code]

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





_______________________________________________
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
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Wed Sep 06, 2017 10:03 am    Post subject:
Reply with quote

Robert,

From the call stack it looks like an OSG problem, no?

Anyways, I have updated my initial post with more info on the config tested, to give all readers more clues, and hopefully nail this bug down.

Regards,

Antoine.
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Wed Sep 06, 2017 10:04 am    Post subject:
Reply with quote

Robert,

From the call stack it looks like an OSG problem, no?

Anyways, I have updated my initial post with more info on the config tested, to give all readers more clues, and hopefully nail this bug down.

Regards,

Antoine.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11154

PostPosted: Wed Sep 06, 2017 10:25 am    Post subject:
Limit in size of VBOs?
Reply with quote

Hi Antoine,

On 6 September 2017 at 11:04, Antoine Rennuit < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
From the call stack it looks like an OSG problem, no?


There isn't anything to indicate that it's an OSG specific problem, it's crashing in an internal memcpy implementation, the OSG's compileBuffer() doesn't use memcpy so it'll be the driver that is calling it.  So the crash is the in the driver.



Quote:
Anyways, I have updated my initial post with more info on the config tested, to give all readers more clues, and hopefully nail this bug down.


Not everyone uses the forum, so updating an old post doesn't help us using the osg-users mailing list.  I've had a to follow the link to forum thread to find the details.  In future could you just add the details into replies.


W.r.t the version you are using, could you try OSG-3.4.1 or master?  I don't recall any bug fixes related to the GL buffers but there are various fixes in both that are worth having.


You don't mention the hardware you are working on, what is main memory and GPU memory?  Have you tried other hardware+drivers?


Also have you checked how much memory is availalbe in main memory when you are running your application?


Robert.







 
 

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 789

PostPosted: Wed Sep 06, 2017 10:25 am    Post subject:
Limit in size of VBOs?
Reply with quote

Hi Antoine,

The stack indicates, that the last thing attempted is compiling the
buffer and the crash seems to be in the memcpy. Either you're running
out of memory or your array is corrupted.

A more complete example for us to compile and try would help a lot.

Cheers
Sebastian
Quote:
Robert,

From the call stack it looks like an OSG problem, no?

Anyways, I have updated my initial post with more info on the config tested, to give all readers more clues, and hopefully nail this bug down.

Regards,

Antoine.

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









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


Joined: 06 Dec 2013
Posts: 45

PostPosted: Wed Sep 06, 2017 10:29 am    Post subject:
Reply with quote

And it is actually am SIGBUS error...
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Wed Sep 06, 2017 10:41 am    Post subject:
Reply with quote

Robert, Sebastian,

I am afraid your analysis of the problem seems relevant.

I won't have access to my laptop for a few hours, though I will try to work on a simplified example hopefully by tomorrow and update my version of OSG.

@Robert: I won't edit posts from then on.

Thanks a lot,

Antoine.
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Thu Sep 07, 2017 2:52 pm    Post subject:
Reply with quote

Robert, Sebastian,

After updating all I could driver-related on my machine with no luck, I ended up upgrading from 3.4.0 to OSG 3.4.1... and that did the trick.

I tried reviewing the change log but I got lost in a 2 years old commits history. So I am not sure what was its cause but problem solved.

Thanks for your help,

Antoine.
Back to top
View user's profile Send private message
arennuit
User


Joined: 06 Dec 2013
Posts: 45

PostPosted: Thu Sep 07, 2017 2:57 pm    Post subject:
Reply with quote

By the way, I was wondering if VBOs should not become the default draw mode. Defaulting to display lists is a bit old-fashioned no, if not deprecated, no?

What do you think?
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11154

PostPosted: Thu Sep 07, 2017 3:27 pm    Post subject:
Limit in size of VBOs?
Reply with quote

Hi Antoine,


Good to hear 3.4.1 fixed the issue.  Suggests it was a bug in 3.4.0, as to what it might be I can't think of any specific fix that addressed a crash like you described. 


On 7 September 2017 at 15:57, Antoine Rennuit < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
By the way, I was wondering if VBOs should not become the default draw mode. Defaulting to display lists is a bit old-fashioned no, if not deprecated, no?

What do you think?


For master/next stable version of the OSG I may switch across to defaulting o VBO's.  For 3.4.x I will stick with the defaults of display lists to avoid significant changes in behaviour.


The topic of display lists vs VBO's is not a clear cut one, VBO's might the "modern" way but for certain scenes (lots of small geometries) and certain drivers (NVidia) performance is still better with DL's. Even support in master for VertexArrayObjects doesn't completely change this, DL's can still be faster.  I know as I've tried really hard to avoid the call overheads associated with not using DL's have and in the end just can't avoid the overhead completely - this is a big reason why Vulkan exists as OpenGL call overhead is serious performance issue when you have ten's/hundreds of thousands of separate geometries.


Robert.

 

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


Joined: 06 Dec 2013
Posts: 45

PostPosted: Fri Sep 08, 2017 4:12 pm    Post subject:
Reply with quote

Robert,

Thanks a lot for you answer.

Your positions makes sense. As for the overheads in relation to optimizations and default behaviors, my position is that OSG should be as standard as possible (i.e. look like default GL), so as to ease the learning curve - but leave the possibility to optimize. Now, it is only my opinion and you and your 15 years of experience are final judges Wink

Kind regards,

Antoine.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11154

PostPosted: Fri Sep 08, 2017 4:19 pm    Post subject:
Limit in size of VBOs?
Reply with quote

On 8 September 2017 at 17:13, Antoine Rennuit < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Robert,

Thanks a lot for you answer.

Your positions makes sense. As for the overheads in relation to optimizations and default behaviors, my position is that OSG should be as standard as possible (i.e. look like default GL), so as to ease the learning curve - but leave the possibility to optimize. Now, it is only my opinion and you and your 15 years of experience are final judges Wink


15 years of experience.... I wish I was so young!



I've actually being using IrisGL then OpenGL since 1992, so 25 years!! Smile

 

As to default GL, well it's a bit of open book.  Which version of default GL? GL1.x, GL2.x, 3.x, 4.x?  GLES 1.x. 2.x, 3.x?  What hardware? What OS?


With middleware like the OSG we're stuck trying to weave out a way through all this variations as they evolve over time, it's not a static or unified platform we are trying to track.   The OSG can try to hide some of the complexities but in the end it's something application developers need to be aware of as well.



Robert.

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Gedalia Pasternak
Guest





PostPosted: Fri Sep 08, 2017 7:14 pm    Post subject:
Limit in size of VBOs?
Reply with quote

I've seen a perf hit from using VBO's over display lists, but it's been worth it to be able to debug rendering with NSight, The modern OSG opengl clean path has a few other perf hits. The various model/view/projection matrix should probably be a uniform buffer object, instead of independent uniforms. That speeds up rendering a bit as well.-gedalia


On Fri, Sep 8, 2017 at 12:17 PM, Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
On 8 September 2017 at 17:13, Antoine Rennuit < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Robert,

Thanks a lot for you answer.

Your positions makes sense. As for the overheads in relation to optimizations and default behaviors, my position is that OSG should be as standard as possible (i.e. look like default GL), so as to ease the learning curve - but leave the possibility to optimize. Now, it is only my opinion and you and your 15 years of experience are final judges Wink


15 years of experience.... I wish I was so young!



I've actually being using IrisGL then OpenGL since 1992, so 25 years!! Smile

 

As to default GL, well it's a bit of open book.  Which version of default GL? GL1.x, GL2.x, 3.x, 4.x?  GLES 1.x. 2.x, 3.x?  What hardware? What OS?


With middleware like the OSG we're stuck trying to weave out a way through all this variations as they evolve over time, it's not a static or unified platform we are trying to track.   The OSG can try to hide some of the complexities but in the end it's something application developers need to be aware of as well.



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





--
DI-Guy Engineering Lead, VT MÄK
150 Cambridge Park Drive, 3rd Floor, Cambridge, MA 02140

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


Joined: 06 Dec 2013
Posts: 45

PostPosted: Wed Sep 13, 2017 3:51 pm    Post subject:
Reply with quote

Hi Robert,

I get your point about the ill-defined target. It makes sense.

PS: it is usually a good sign when people get old (that is slowly) but this is another debate.

Thanks for your answer Wink

Antoine
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 How to reduce the size of the terrain qiaokun VirtualPlanetBuilder [vpb] 0 Fri May 19, 2017 7:49 am View latest post
No new posts Geometry in world coordinates but wit... Roko General 11 Wed Jan 18, 2017 8:43 am View latest post
No new posts How to render the image without reduc... umadevi2193 General 5 Tue Nov 22, 2016 12:58 pm View latest post
No new posts Draw geometry that keeps its size in ... Bruno Oliveira General 3 Mon Nov 21, 2016 3:09 pm View latest post
No new posts Text size and overlapping on osg sphe... Inna General 0 Thu Nov 10, 2016 1:52 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