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 

How to improve frame rate when loading multiple buildings ??


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


Joined: 28 Dec 2016
Posts: 18

PostPosted: Wed Feb 22, 2017 2:01 pm    Post subject:
How to improve frame rate when loading multiple buildings ??
Reply with quote

Hi Community,

I am creating buildings using osg::Geometry from shapefile data. I am draping textures on each side of the building... Its rendering fine, but frame rate it too low..... Its because it has too many buildings to be rendered.

Is there a way to hide buildings from viewing frustum which are overshadowed by building in front of the camera ???

Any suggestions or alternate method to improve frame rate is appreciated...

I hereby attach the screenshot for reference....

Thank you!

Cheers,
Vinoth R
Back to top
View user's profile Send private message
Steal
User


Joined: 26 Jan 2017
Posts: 56

PostPosted: Wed Feb 22, 2017 2:52 pm    Post subject:
Reply with quote

Maybe the optimizer can do a few things here.

Also, you could maybe explicitly turn on backface culling with
Code:
ss->setMode(GL_CULL_FACE, osg::StateAttribute::ON);


Robert may have some great advice to give here. I'm actually curious as to how to optimize things as well, because just dumping a model into the viewer also gives me suboptimal performance.

One of the golden rules for OSG specifically, is to minimize unnecessary state changes. The graph accumulates and inherits so called 'states' like a stack, if I'm correct, and it's a feature but it's easy to abuse.
Back to top
View user's profile Send private message
d_a_heitbrink (David Heitbrink)
User


Joined: 23 Sep 2013
Posts: 37

PostPosted: Wed Feb 22, 2017 6:51 pm    Post subject:
Reply with quote

I would try to look at instancing. The OSG Forest is a good example.

Instancing is were you tell the GPU to draw an object X number of times, and in the vertex shader you get a built in var gl_InstanceID, that tells you which item it is drawling (i.e. if you are drawling 100 versions, this will go from 0 to 99). So in the vertex shader you move each vertex to a new position, based the instance ID.

You might have to get a little creative in terms of textures management/mapping so each building has a different texture. You could say create a large texture mosaic, and adjust the texture coordinates based on your instance ID.
Back to top
View user's profile Send private message Send e-mail
Voerman, L.
Guest





PostPosted: Thu Feb 23, 2017 8:28 am    Post subject:
How to improve frame rate when loading multiple buildings ??
Reply with quote

HiĀ Vinoth,
First question:are you running a debug build? For all your osgdem work you seemed to be running a debug build - those are very slow.
we need more stats to begin on an answer to what could be optimized: maybe every building has it's own stateset?
make a screenshot with the graphs and camera stats.
Laurens.


On Wed, Feb 22, 2017 at 7:51 PM, David Heitbrink < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
I would try to look at instancing. The OSG Forest is a good example.

Instancing is were you tell the GPU to draw an object X number of times, andĀ  in the vertex shader you get a built in var gl_InstanceID, that tells you which item it is drawling (i.e. if you are drawling 100 versions, this will go from 0 to 99). So in the vertex shader you move each vertex to a new position, based the instance ID.

You might have to get a little creative in terms of textures management/mapping so each building has a different texture. You could say create a large texture mosaic, and adjust the texture coordinates based on your instance ID.

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





_______________________________________________
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
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 703

PostPosted: Thu Feb 23, 2017 9:00 am    Post subject:
How to improve frame rate when loading multiple buildings ??
Reply with quote

Hi Vinoth,
Quote:
Quote:
Hi Community,

I am creating buildings using osg::Geometry from shapefile data. I am draping textures on each side of the building... Its rendering fine, but frame rate it too low..... Its because it has too many buildings to be rendered.
Quote:


Is there a way to hide buildings from viewing frustum which are overshadowed by building in front of the camera ???
This would be occlusion culling. The problem is, that potentially every building is an occluder, so you might sacrifice more of CPU and GPU to determine visibility than you gain.
Quote:
Quote:


Any suggestions or alternate method to improve frame rate is appreciated...

I hereby attach the screenshot for reference....

But be sure to measure where you actually lose the performance! Send us a screenshot of the stats, so we can help you into the right direction.
Usually reducing the number of draw calls and state-changes is the right track. Could you produce a small sample graph so we might inspect it? Maybe you're structuring your graph to flat and to much time is spent to determine visibility/draw-calls.

If you're brave and your problem is draw calls you can use instancing with LoD. See the osggpucull example. Adding multiple textures can be done by adding a textureArray and passing the index per instance in a vertex attribute.

Cheers
Sebastian
Quote:
Quote:


Thank you!

Cheers,
Vinoth R

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





Quote:
_______________________________________________
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
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 10776

PostPosted: Thu Feb 23, 2017 9:02 am    Post subject:
How to improve frame rate when loading multiple buildings ??
Reply with quote

Hi Vinoth,

The first step with optimization is to figure out the bottlenecks,
only once you know these can you decide what the most effective change
will be to improve performance. You only provide guidance on overall
framerate not being sufficient so there isn't any way for us at this
stage to be able to pinpoint what you can do.

At you end the best thing you can do is run your performance stats
with the full on screen stats on, this will show the costs of the
update, cull, draw dispatch and draw GPU. You absolutely must do the
tests with a full optimized build of the OSG and your application,
testing with a debug build will show completely wrong bottlenecks.

A screenshot of the on screen full stats will be able to tell us what
the major bottlnecks are, the rough make up of your scene. Once you
provide this well be able to provide some appropriate advice.

Also information about the OS, OSG version, compilers, hardware and
drivers you are using is also important.

Robert.

On 22 February 2017 at 14:01, Vinoth Rajendran
<> wrote:
Quote:
Hi Community,

I am creating buildings using osg::Geometry from shapefile data. I am draping textures on each side of the building... Its rendering fine, but frame rate it too low..... Its because it has too many buildings to be rendered.

Is there a way to hide buildings from viewing frustum which are overshadowed by building in front of the camera ???

Any suggestions or alternate method to improve frame rate is appreciated...

I hereby attach the screenshot for reference....

Thank you!

Cheers,
Vinoth R

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








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


Joined: 26 Jan 2017
Posts: 56

PostPosted: Thu Feb 23, 2017 11:21 am    Post subject:
Re: How to improve frame rate when loading multiple buildings ??
Reply with quote

SMesserschmidt wrote:
[...] Maybe you're structuring your graph to flat and to much time is spent to determine visibility/draw-calls.


Is the culling really a perf. hit? E.g. op has neatly provided a group for each building versus not, if he looks at it from a distance like in the photo, would this mean a difference? Does the cull traversal degrade to vertices when it hasn't bounded things in spheres or whatever structures it uses?
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 703

PostPosted: Thu Feb 23, 2017 11:28 am    Post subject:
How to improve frame rate when loading multiple buildings ??
Reply with quote

Am 23.02.2017 um 12:21 schrieb Johny Canes:
Quote:
SMesserschmidt wrote:
Quote:
[...] Maybe you're structuring your graph to flat and to much time is spent to determine visibility/draw-calls.

Is the culling really a perf. hit? E.g. op has neatly provided a group for each building versus not, if he looks at it from a distance like in the photo, would this mean a difference? Does the cull traversal degrade to vertices when it hasn't bounded things in spheres or whatever structures it uses?
Still each group has to be traversed each frame to determine visbility.
Try to run the optimizer with the SpatializeGroups option. That's not
really helping if you can see the whole scene, but that's what LoDs are
for ....

Of course if the bounding sphere of a geometry is inside the frustum the
geometry will be rendered. There are no additional per-geometry
visibility checks.


Quote:

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









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


Joined: 28 Dec 2016
Posts: 18

PostPosted: Thu Feb 23, 2017 2:20 pm    Post subject:
Reply with quote

Hi Guys,

Thanks for all your feedbacks....

Let me start answering with @RobertOsfield first , bcoz it's kind of easy to start with

OS : Windows 8
OSG Version : 3.5.1
compilers : Visual Studio 2013
CPU : i5-3450 @ 3.10 Ghz (4 CPU)
GPU : Radeon HD 7700 Series (Memory - 3803 MB)

Right now i am using debug built application....

I hereby attach screenshot with complete performance stats of my application...

I will ping with information related to Release Built soon.....

Thank you!

Cheers,
Vinoth
Back to top
View user's profile Send private message
vinothrajendran4
Newbie


Joined: 28 Dec 2016
Posts: 18

PostPosted: Thu Feb 23, 2017 2:34 pm    Post subject:
Reply with quote

Hi Community,

When i built my application with Release Build i am getting frame Rate 60...Debug built was the issue.......

Thanks for pointing out @Voerman, L. and @RobertOsfield

I attach screenshot for reference...

Thank you!

Cheers,
Vinoth R
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 Significant drop in frame rate when u... wernerM General 1 Mon Mar 20, 2017 3:32 pm View latest post
No new posts Frame Rate bhanu406 General 1 Tue Mar 14, 2017 5:40 am View latest post
No new posts Multiple cameras sharing multisample fbo ravidavi General 1 Sat Mar 11, 2017 8:17 am View latest post
No new posts How to use frame buffer object in exi... saedrna1 General 2 Sat Feb 18, 2017 3:54 am View latest post
No new posts Buildings bhanu406 VirtualPlanetBuilder [vpb] 14 Fri Jan 06, 2017 6:03 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