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 

Problem about osgCUDA::Geometry


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgCompute [osgCompute]
View previous topic :: View next topic  
Author Message
martin31567
Newbie


Joined: 25 Aug 2011
Posts: 4

PostPosted: Thu Aug 25, 2011 9:16 am    Post subject:
Problem about osgCUDA::Geometry
Reply with quote

Hi,

I find it is very time-consuming if osgCUDA::Geometry is added too much PrimitiveSet. But if replace osgCUDA::Geometry with osg::Geometry, it is very fast even if osg::Geometry is added the same number of PrimitiveSet.

for example,
osgCuda::Geometry* geometry = new osgCuda::Geometry;
for (unsigned int i=0;i<60000;i++)
{
geometry->addPrimitiveSet( otherGeometry->getPrimitiveSet(i) );
}
otherGeometry is a osg::Geometry, a model.
the running time is over 10 minutes.
but if I use osg::Geometry, the running time is only several seconds.

So I want know the reason and how to improve.

Thank you!

Cheers,
Zhen
Back to top
View user's profile Send private message
martin31567
Newbie


Joined: 25 Aug 2011
Posts: 4

PostPosted: Fri Aug 26, 2011 3:31 am    Post subject:
It is related about VBO and EBO
Reply with quote

Hi,
I find:
if geom->setUseVertexBufferObjects(true), the process of "addPrimitive()" is also very long.
for example:
osg::Geometry* geometry = new osg::Geometry;
geom->setUseVertexBufferObjects(true)
for (unsigned int i=0;i<60000;i++)
{
geometry->addPrimitiveSet( otherGeometry->getPrimitiveSet(i) );
}
The running time is also more than 10 minutes.
So I quess, osgCuda::Geometry is creating VBO and EBO when many PrimitiveSets are added into.
I haven't read the source code about VBO and EBO, and I don't know why the process of creating VBO and EBO is so long if the number of PrimitiveSets is large.



Thank you!

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


Joined: 18 Mar 2009
Posts: 10983

PostPosted: Fri Aug 26, 2011 7:49 am    Post subject:
Problem about osgCUDA::Geometry
Reply with quote

HI Zhen,

In normal OpenGL/OSG usage VBO+EBO's do not take long to create.
Whether osgCuda is the bottleneck or whether it's the crazy number of
primitives you trying to add that might be the problem I can't say. I
havn't used osgCuda myself so can't comment on this specifically.
However, I can say that for best performance with OpenGL applications
it's best to keep the number of separate batches of geometry down.
Which it be possible to cut the number of primitives sets down to 1 by
just using a DrawElementUShort/UInt?

Robert.

On Fri, Aug 26, 2011 at 4:31 AM, Zhen Xu <> wrote:
Quote:
Hi,
I find:
 if geom->setUseVertexBufferObjects(true), the process of "addPrimitive()" is also very long.
for example:
osg::Geometry* geometry = new osg::Geometry;
geom->setUseVertexBufferObjects(true)
for (unsigned int i=0;i<60000;i++)
{
geometry->addPrimitiveSet( otherGeometry->getPrimitiveSet(i) );
}
The running time is also more than 10 minutes.
So I quess, osgCuda::Geometry is creating VBO and EBO when many PrimitiveSets are added into.
I haven't read the source code about VBO and EBO, and I don't know why the process of creating VBO and EBO is so long if the number of PrimitiveSets is large.



Thank you!

Cheers,
Zhen

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









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


Joined: 16 Mar 2009
Posts: 30

PostPosted: Fri Aug 26, 2011 8:22 am    Post subject:
Reply with quote

Hi Zhen, hi Robert,

You are right Zhen, osgCuda::Geometry always creates vertex buffers
and/or element buffers. CUDA can only handle this kind of OpenGL
geometry. However, osgCuda does not introduce any new operation to
the implementation of osg::Geometry in case you use it in the rendering
process only.

It maybe synchronizes memory in a cuda operation in case you write into
a geometry's memory from the CPU (e.g. if you have called map() with
osgCompute::MAP_HOST_TARGET). Otherwise there is no overhead
introduced by osgCuda.

I agree with Robert. Maybe you should check your primitive count.

Best regards,
Jens
Back to top
View user's profile Send private message
martin31567
Newbie


Joined: 25 Aug 2011
Posts: 4

PostPosted: Sat Aug 27, 2011 3:10 am    Post subject:
Reply with quote

Hi Jens,Hi Robert,

I have read the source code of osgCompute and I find my problem is caused by the large number of PrimitiveSet, not a bottleneck of osgCuda::Geometry.

osgCuda is very good and I will do some research about FEM with osgCuda .

In next step, I will reduce the number of Primitive in my model.

Thank you!

Cheers,
Zhen
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgCompute [osgCompute] 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 ViewerBase::frame() method slow after... gambr General 7 Fri Jul 21, 2017 9:11 am View latest post
No new posts Multi layer effect rendering problem ... not3not4 General 0 Wed Jul 19, 2017 9:44 am View latest post
No new posts osgUtil::IntersectionVisitor slow wit... gambr General 4 Tue Jul 18, 2017 10:17 am View latest post
No new posts problem with osgearth_pick.exe 徐志敏 General 0 Thu Jul 13, 2017 6:15 pm View latest post
No new posts A problem of depth on osgText::Text i... gyw General 4 Mon Jul 10, 2017 7: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