On Tue, 22 Apr 2008, fabio riot wrote:
> Hi Brian
> Thanks for your answer
> I have tested your code
> On my hardware (Quadro FX 3500M, 2Gb Ram ..Windows Vista, OSG (64bit
> compiled))
> The frame rate is 7 fps (80% memory using)
>
> But in my case loading ply file..the main problem isn't the rendering
> but the loading time (that takes hours...), the file's size is about
> 250Mb.
>
> May be I wrong in writing my ply file plugin...
> it reads from ply file and sets a geometry class:
>
> osg::ref_ptr<Geode> geode = new osg::Geode();
> osg::ref_ptr<Geometry> geometry = new osg::Geometry();
> geode->addDrawable(geometry.get());
> osg::ref_ptr<Vec4Array> colors=new osg::Vec4Array();
> osg::ref_ptr<Vec3Array> verices = new osg::Vec3Array;
> geometry->setVertexArray( vertices.get() );
> geometry->setColorArray(colors.get());
> geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
>
The cause for slow loading is in the loop below. Try reading your data
into a large single chunk, then step through that (in memory) while
filling your graph.
hth
-bob
> for(i=0;i<n_vertices;i++)
> {
> read from file in x y z r g b
> vertices->push_back( osg::Vec3( x, y, z) );
> colors->push_back(osg::Vec4(r,g,b,1.0f));
>
> }
>
> for(i=0;i<n_faces;i++)
> {
>
> read from file the connection list in index1 index2 index3
> osg::ref_ptr<DrawElementsUInt> face=new osg::DrawElementsUInt
> (osg::PrimitiveSet::TRIANGLES, 0);
>
> face->push_back(index1);
> face->push_back(index2);
> face->push_back(index3);
> geometry->addPrimitiveSet(face.get());
> }
>
>
>
> 2008/4/21, Brian R Hill <[EMAIL PROTECTED]>:
>> It's going to be dependent on your hardware and the osg structures you use.
>>
>> Try running this and the bring up the grid.ive in osgviewer. It generates
>> 9.000.000 verts, 18.000.000 tris. On my box Win XP 4Gb Ram, Quadro FX 4600,
>> it renders at 20 hz, using 1.3 Gb memory.
>>
>> Brian
>>
>> unsigned int num = 3000;
>> osg::HeightField* grid = new osg::HeightField;
>> grid->allocate(num,num);
>> grid->setXInterval(1);
>> grid->setYInterval(1);
>>
>> for(unsigned int rr=0;rr<num;++rr)
>> {
>> for(unsigned int cc=0;cc<num;++cc)
>> {
>> grid->setHeight(cc,rr,sin((float)(cc+rr)));
>> }
>> }
>> osg::Geode * geode = new osg::Geode;
>> geode->addDrawable(new osg::ShapeDrawable(grid));
>>
>> osgDB::writeNodeFile(*geode,"grid.ive");
>>
>>
>> [EMAIL PROTECTED] wrote: -----
>>
>>
>> To: [email protected]
>> From: "fabio riot" <[EMAIL PROTECTED]>
>> Sent by: [EMAIL PROTECTED]
>> Date: 04/21/2008 10:35AM
>> Subject: [osg-users] laser scanner file
>>
>> Hi all
>> I'm new in OSG, so I need some advices to address my work.
>> I need to visualize a large dimension laser scanner file (.ply).
>> it contains about 6.000.000 of points and 12.000.000 of triangles
>> (point's connections).
>> I'm not able to view the entire file with a single node scenegraph
>> (the program fails):
>>
>>
>> osg::Node* node = NULL
>> node = osgDB::readNodeFile("entire_file.ply"); //with my plugin
>> osg::ref_ptr<osg::Group> root = new osg::Group();
>> root->addChild(node);
>> viewer....etc
>>
>>
>> So I have broken the "laser cloud" in more little pieces
>> (at example 12 pieces each one with 500.000 points and about 1.000.000
>> triangles)
>> and I have created a scenegraph with 12 node
>>
>>
>> osg::ref_ptr<osg::Group> root = new osg::Group();new osg::Group();
>> root->addChild(node1);
>> root->addChild(node2);
>>
>> .....
>>
>> root->addChild(node12);
>>
>> where each node contains one pieces of data
>>
>> In this way I can load and view the all strucure...but the loading
>> time is very very long (60 min)
>>
>> I'would like to know if this is the correct way to tackle my problem
>> or if there's a clever way...Thanks
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> This is a PRIVATE message. If you are not the intended recipient, please
>> delete without copying and kindly advise us by e-mail of the mistake in
>> delivery. NOTE: Regardless of content, this e-mail shall not operate to
>> bind CSC to any order or other contract unless pursuant to explicit written
>> agreement or government initiative expressly permitting the use of e-mail
>> for such purpose.
>> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org