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 

Improving performances


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


Joined: 26 Nov 2012
Posts: 37

PostPosted: Wed Feb 15, 2017 3:02 pm    Post subject:
Improving performances
Reply with quote

Hi,

I posted some question about OSG performance in the past and now I would like to definitively improve visualization performance of my application.
I want to say that now I already have very good performances with OSG but now I need to start thinking how to manage also some "extreme" scenes.

It is a CAD-like application and a possible scene is composed by some objects (let's say from 1 to some hundreds) each one with 100K to some millions of triangles.
Each of these objects can have up to some thousands of children each one with around 100 triangles.
For all objects I use vertexbuffer instead of display lists to reduce waiting time at first draw (due to display list compilation).
I use a matrixtransform for each object and few groups for all the scene.
Normally objects are not modified but sometimes they can be modified on the fly by user. So I did not set DataVariance (I supposed it is set automatically to STATIC if I did not modify an object).
The application is GPU bounded as I can see from on-screen stats.

I cannot merge objects or groups into one becouse I need to do some operations on them so I need to keep them separated.
I am using KdTrees to improve object picking, it now works well but the interaction is still not smooth becouse of the slow frame rate.
I think I cannot use LODs becouse triangle reduction on-the-fly can take very long time on this type of scenes.
I tried with osgViewer and more or less it have the same performance of my application.
At the moment I can just show bounding boxes for raw scene manipulation but often I need to show object details.

Could you give me some hint to improve performances? I hope information I give you are enough to do a first analysis.
At the moment I am not able to setup such a scene to send you screenshots of the stats but I can do it in next days if needed.

Thank you in advance.

Best regards,
Ale
Back to top
View user's profile Send private message
wernerM
User


Joined: 06 Feb 2013
Posts: 62

PostPosted: Wed Feb 15, 2017 4:41 pm    Post subject:
Improving performances
Reply with quote

Hi Alex,
I'm doing simulations of textile structures and work with yarn objects being deformed according to Bentsen stretches etc.
The number of triangles is also extreme. I have a COUPLE bound version doing the geometries by CPU threads and a second version working with geometry shades. Both versions have their pros and cons. But performance wise the second version is far the best - at least with a very good graphics card.
I think the biggest advantage is the dramatically reduced amount of data to be transferred. This results in immediate appearance on the screen and reduced processing time for culling etc.
Also with vertex parameters I can control the geometry shades. In this case vertices are just center line polygon points.
May be this helps you in finding your best approach.
Werner

On 15. Februar 2017 16:03:12 MEZ, Ale Maro <> wrote:
Quote:
Quote:
Hi,I posted some question about OSG performance in the past and now I would like to definitively improve visualization performance of my application.I want to say that now I already have very good performances with OSG but now I need to start thinking how to manage also some "extreme" scenes.It is a CAD-like application and a possible scene is composed by some objects (let's say from 1 to some hundreds) each one with 100K to some millions of triangles. Each of these objects can have up to some thousands of children each one with around 100 triangles.For all objects I use vertexbuffer instead of display lists to reduce waiting time at first draw (due to display list compilation).I use a matrixtransform for each object and few groups for all the scene.Normally objects are not modified but sometimes they can be modified on the fly by user. So I did not set DataVariance (I supposed it is set automatically t
o
STATIC if I did not modify an object).The application is GPU bounded as I can see from on-screen stats.I cannot merge objects or groups into one becouse I need to do some operations on them so I need to keep them separated.I am using KdTrees to improve object picking, it now works well but the interaction is still not smooth becouse of the slow frame rate.I think I cannot use LODs becouse triangle reduction on-the-fly can take very long time on this type of scenes.I tried with osgViewer and more or less it have the same performance of my application.At the moment I can just show bounding boxes for raw scene manipulation but often I need to show object details.Could you give me some hint to improve performances? I hope information I give you are enough to do a first analysis.At the moment I am not able to setup such a scene to send you screenshots of the stats but I can do it in next days if needed.Thank y
ou in
advance.Best regards,Ale------------------Read this topic online here:http://forum.openscenegraph.org/viewtopic.php?p=70200#70200osg-users mailing http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


Joined: 18 Mar 2009
Posts: 10892

PostPosted: Thu Feb 16, 2017 12:26 pm    Post subject:
Improving performances
Reply with quote

Hi Ale,

Without knowing more details about the specifics about the data
structure, the bottlenecks you are seeing etc. one can't provide exact
steps of what to do to improve performance.

The general approach to performance improvement is to first benchmark
your application to see where the biggest bottlenecks are, for you
application it could be CPU w.r.t update or cull traversals, draw
dispatch into OpenGL fifo or on the draw on the GPU. Benchmarking
should only be done with a release build of the OSG and your
application and on hardware that is representation of what your client
will use, and using data that is representative.

What steps you should take to optimize will depend upon where the
biggest costs are. There are a range of things you could do, at this
stage it's too opened end what the bottleneck is to provide specific
guidance.

Cheers,
Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 294

PostPosted: Mon Feb 20, 2017 5:55 pm    Post subject:
Re: Improving performances
Reply with quote

Hi Ale
If I read you correctly,you're said to be gpu bound because of the huge amount of vertices to process.
You're also saying you're working with CAD representation (which AFAIK have parametric representation(shape) )
I think the good approach is to keep your geometry parametric (shape) and update geometry parameter (and so on explicit geometry) based on viewer distance...

Hope it helps in some way:/
Cheers


Ale wrote:
Hi,

I posted some question about OSG performance in the past and now I would like to definitively improve visualization performance of my application.
I want to say that now I already have very good performances with OSG but now I need to start thinking how to manage also some "extreme" scenes.

It is a CAD-like application and a possible scene is composed by some objects (let's say from 1 to some hundreds) each one with 100K to some millions of triangles.
Each of these objects can have up to some thousands of children each one with around 100 triangles.
For all objects I use vertexbuffer instead of display lists to reduce waiting time at first draw (due to display list compilation).
I use a matrixtransform for each object and few groups for all the scene.
Normally objects are not modified but sometimes they can be modified on the fly by user. So I did not set DataVariance (I supposed it is set automatically to STATIC if I did not modify an object).
The application is GPU bounded as I can see from on-screen stats.

I cannot merge objects or groups into one becouse I need to do some operations on them so I need to keep them separated.
I am using KdTrees to improve object picking, it now works well but the interaction is still not smooth becouse of the slow frame rate.
I think I cannot use LODs becouse triangle reduction on-the-fly can take very long time on this type of scenes.
I tried with osgViewer and more or less it have the same performance of my application.
At the moment I can just show bounding boxes for raw scene manipulation but often I need to show object details.

Could you give me some hint to improve performances? I hope information I give you are enough to do a first analysis.
At the moment I am not able to setup such a scene to send you screenshots of the stats but I can do it in next days if needed.

Thank you in advance.

Best regards,
Ale
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 294

PostPosted: Mon Feb 20, 2017 5:56 pm    Post subject:
Re: Improving performances
Reply with quote

Hi Ale
If I read you correctly,you're said to be gpu bound because of the huge amount of vertices to process.
You're also saying you're working with CAD representation (which AFAIK have parametric representation(shape) )
I think the good approach is to keep your geometry parametric (shape) and update geometry parameter (and so on explicit geometry) based on viewer distance...

Hope it helps in some way:/
Cheers


Ale wrote:
Hi,

I posted some question about OSG performance in the past and now I would like to definitively improve visualization performance of my application.
I want to say that now I already have very good performances with OSG but now I need to start thinking how to manage also some "extreme" scenes.

It is a CAD-like application and a possible scene is composed by some objects (let's say from 1 to some hundreds) each one with 100K to some millions of triangles.
Each of these objects can have up to some thousands of children each one with around 100 triangles.
For all objects I use vertexbuffer instead of display lists to reduce waiting time at first draw (due to display list compilation).
I use a matrixtransform for each object and few groups for all the scene.
Normally objects are not modified but sometimes they can be modified on the fly by user. So I did not set DataVariance (I supposed it is set automatically to STATIC if I did not modify an object).
The application is GPU bounded as I can see from on-screen stats.

I cannot merge objects or groups into one becouse I need to do some operations on them so I need to keep them separated.
I am using KdTrees to improve object picking, it now works well but the interaction is still not smooth becouse of the slow frame rate.
I think I cannot use LODs becouse triangle reduction on-the-fly can take very long time on this type of scenes.
I tried with osgViewer and more or less it have the same performance of my application.
At the moment I can just show bounding boxes for raw scene manipulation but often I need to show object details.

Could you give me some hint to improve performances? I hope information I give you are enough to do a first analysis.
At the moment I am not able to setup such a scene to send you screenshots of the stats but I can do it in next days if needed.

Thank you in advance.

Best regards,
Ale
Back to top
View user's profile Send private message
Ale
User


Joined: 26 Nov 2012
Posts: 37

PostPosted: Thu Feb 23, 2017 10:07 am    Post subject:
Reply with quote

Hi all,

thanks for the hints and sorry for the late reply.

Attached is a screenshot of OSG stats on a sample scene with 5 instances of an object (camera#1 is a secondary camera, not important).
The scene have about 109M vertices (~22M x 5 instances) and 36M triangles (~7M x 5 instances) at 4FPS on an old nVidia Quadro 4000 (Windows 10)

As you can see GPU cycle is the bottleneck (243.40 against less than 0.5 of all other cycles)

OSG is single threaded becouse I am using Qt and I am not able to setup multi-threading with Qt.

Cheers,
Ale
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 725

PostPosted: Thu Feb 23, 2017 10:33 am    Post subject:
Improving performances
Reply with quote

Am 23.02.2017 um 11:07 schrieb Ale Maro:
Quote:
Hi all,

thanks for the hints and sorry for the late reply.

Attached is a screenshot of OSG stats on a sample scene with 5 instances of an object (camera#1 is a secondary camera, not important).
The scene have about 109M vertices (~22M x 5 instances) and 36M triangles (~7M x 5 instances) at 4FPS on an old nVidia Quadro 4000 (Windows 10)
Holy smokes! 22Million? I guess your hitting a driver limit on the
vertex count here. Usually a vertexbuffer is around ~65k vertices. Try
to split your geometries in to smaller pieces to find the sweet-spot.
Maybe you should consider testing with different vertex-counts to find
out if there is a limit at which the GPU/driver starts to drop massively.
Splitting will also help to display only what you need and not
transfering the whole scene more or less every frame.

Another thought: the GPU might simply hitting a memory limit. With
vertex colors, normals and texture-coordinates your geometry alone uses
more than a gig of video ram. Can you check how much VRAM there is on
your card?

Last thought: Use VBO instead of display lists. Quadro drivers might be
different here.

Cheers
Sebastian
Quote:

As you can see GPU cycle is the bottleneck (243.40 against less than 0.5 of all other cycles)

OSG is single threaded becouse I am using Qt and I am not able to setup multi-threading with Qt.

Cheers,
Ale

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




Attachments:
http://forum.openscenegraph.org//files/grab1_194.png






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


Joined: 18 Mar 2009
Posts: 10892

PostPosted: Thu Feb 23, 2017 10:45 am    Post subject:
Improving performances
Reply with quote

On 23 February 2017 at 10:07, Ale Maro <> wrote:
Quote:
Attached is a screenshot of OSG stats on a sample scene with 5 instances of an object (camera#1 is a secondary camera, not important).
The scene have about 109M vertices (~22M x 5 instances) and 36M triangles (~7M x 5 instances) at 4FPS on an old nVidia Quadro 4000 (Windows 10)

As you can see GPU cycle is the bottleneck (243.40 against less than 0.5 of all other cycles)

OSG is single threaded becouse I am using Qt and I am not able to setup multi-threading with Qt.

Quote:
From the screen stats it's clear that you are GPU limited and given
the scene stats it's almost certainly down to amount of data.

Running single threaded or multi-threading won't affect performance as
you aren't CPU limited in any way.

To improve performance you need to do a combination of the following:

1) Reduce the number of vertices and primitives that are being
rendered. Either LOD's or adaptive meshes, or simply generating a
mesh with an appropriate density required for rendering.

2) Improve the way that the vertex and primitives are passed to
the GPU. Use of VBO's and batching of geometry into sizes that work
best are both important ways of achieving this.

Robert.


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


Joined: 26 Nov 2012
Posts: 37

PostPosted: Thu Feb 23, 2017 12:16 pm    Post subject:
Reply with quote

Hi all,

my graphic card have 2GB of dedicated RAM and 6GB of shared RAM

I tried to reduce number of triangles (to use LODs) using osgUtil::Simplifier but geometries are too big.

I think it is correct not to use indexed sets to have good performances.
I already use VBOs... but I use one single geometries for each object
If I understand correctly I can try to split geometries.
I will do some tests to find a good size.


Thank you again.

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


Joined: 18 Mar 2009
Posts: 10892

PostPosted: Thu Feb 23, 2017 12:38 pm    Post subject:
Improving performances
Reply with quote

HI Ale,

On 23 February 2017 at 12:16, Ale Maro <> wrote:
Quote:
I think it is correct not to use indexed sets to have good performances.

I don't understand what you mean by "indexed sets".

With the OSG/OpenGL you can use osg::DrawArrays/glDrawArrays and
osg::DrawElements*/glDrawElements to define what primitives to render,
DrawElements you provide indices into the vertex arrays and enables
you to share vertices so typically reduce the vertex count, lower
memory footprint and bandwidth and if done efficiently can utilize the
vertex processing cache on the GPU to reduce the vertex load. For
this reason it's generally more efficient to use osg::DrawElements
than osg::DrawArrays.

Robert.


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


Joined: 26 Nov 2012
Posts: 37

PostPosted: Tue Mar 07, 2017 3:06 pm    Post subject:
Reply with quote

Hi,

as you suggested, I tried to use multiple geometries instead of a single huge geometry.
I had best results using 50k to 150k triangles for each geometry.
In my test files I notices a good frame rate improvement (around 2x to 3x)

Thank you for the hint.

Ale
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 Improving this scene frame rate Pertur General 9 Thu Nov 20, 2014 8:51 am View latest post
No new posts Improving performance of OBJ renderin... kaharoth General 8 Sun May 27, 2012 6:12 pm View latest post
No new posts osgWidget performances Vincent.B General 5 Mon Apr 16, 2012 3:13 pm View latest post
No new posts [VRML plugin] Performances issue ... GlouglouLeDindon Plugins [osgPlugins] 5 Thu Apr 29, 2010 3:47 pm View latest post
No new posts Discussion on improving compatibility... Wang Rui General 1 Fri Apr 23, 2010 7:01 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