With the same finder in animtkviewer: struct AnimationManagerFinder : public osg::NodeVisitor { osg::ref_ptr<osgAnimation::BasicAnimationManager> AniMan; AnimationManagerFinder() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} void apply(osg::Node& node) { if (AniMan.valid()) return; if (node.getUpdateCallback()) { osgAnimation::AnimationManagerBase* b = dynamic_cast<osgAnimation::AnimationManagerBase*>(node.getUpdateCallback()); if (b) { AniMan = new osgAnimation::BasicAnimationManager(*b); return; } } traverse(node); } };
On Thu, Nov 29, 2012 at 6:46 PM, Bruno Fanini <phoeni...@gmail.com> wrote: > Hello, > I'm testing some solutions and I have an exported animated model (it > contains just one animation) that is correctly animated through the > animationviewer player. > In my code I just want to play (in loop) that single animation forever, > but nothing happens with these lines: > > _myModel = osgDB::readNodeFile("my-animated-model.osg"); > > AnimationManagerFinder finder; > _myModel->accept( finder ); > if (finder.AniMan.valid()){ > _aniMan = finder.AniMan.get(); > _myModel->setUpdateCallback( _aniMan.get() ); > > const osgAnimation::AnimationList& animations = > _aniMan->getAnimationList(); > for (unsigned int i=0; i < animations.size(); ++i ){ > _aniMan->playAnimation( animations[i] ); > printf("Animation %d found\n",i); > animations[i]->setPlayMode( osgAnimation::Animation::LOOP ); > } > } > > I've did examine animtkviewer example and other, but I'm not able to > figure out what's missing to play the animation... maybe somthing really > stupid? > > Thanks > > > > On Fri, Nov 23, 2012 at 11:08 AM, Sergey Polischuk <pol...@yandex.ru>wrote: > >> Hi >> >> You can use any .fbx model with skinned character, as osg can read those >> just fine. I think you should be able to find some of those in the web. >> >> Cheers. >> >> 22.11.2012, 03:41, "Bruno Fanini" <phoeni...@gmail.com>: >> >> Hello Jan and Christian, >> Thanks for your hints >> The simulation has to run on medium-sized crowds (order of 1000-2000agents) >> since we are planning to run on just a portion of a city, so >> actually theres no need for huge-sized crowds. At least not at the present >> times. >> The architecture I'm developing should allow to separate completely the >> engine (collisions, social influences, etc) and let a separate FrontEnd to >> receive produced data, so it should be feasible both at CPU and GPU level. >> Now I'm wondering where I can find some osgAnimation-based characters >> (apart from the classic "avatar.osg" in osg-data) or how can I generate a >> very basic walking character - I just need to control independently the >> walking speed - and have some tests. I've read something involving the >> Blender exporter: is this the only workflow (modeling) or I can find some >> basic animated agents around on the web that I can somehow convert to a >> osgAnimation-based setup? >> Thanks, >> >> >> On Tue, Nov 20, 2012 at 5:16 PM, Jan Ciger <jan.ci...@gmail.com> wrote: >> >> Hello, >> >> Back in the day I have done about 2000 walking skeletons for a demo using >> the osgCal plugin - i.e. no instancing, separate node each of them, >> software skinning (ok, skeletons don't have much skin :-p) they just shared >> some data. That was running at ~20fps on a GeForce4 back then. So it is >> certainly possible. Not sure how amenable the osgAnimation stuff is to that >> - to me it looked a bit unfinished and clunky when I worked with it last >> time. >> >> The comment from Christian about billboards is certainly valid if you >> want to scale the simulation above some ~20k-50k characters - bellow that >> you probably will be able to drive fully articulated characters. With some >> clever LOD you can do even something like this: >> >> http://archiveweb.epfl.ch/vrlab.epfl.ch/Movies/Movies_index.html (scroll >> down for the "Real-Time Navigating Crowds: Scalable Simulation and >> Rendering" video, the paper is here: >> http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.90.3149&rep=rep1&type=pdf >> ) >> >> Of course, the CPU is the bottleneck, as Christian said - you need to >> push as much simulation as you can on the GPU. >> >> Jan >> >> >> >> On Tue, Nov 20, 2012 at 3:54 PM, Christian Buchner < >> christian.buch...@gmail.com> wrote: >> >> >> Are you sure your agents need to be full 3D models? >> >> I've done something using perspective billboards, in the osgrvo2 sample >> in the osgRecipes repository maintained by Wang Rui. The billboards were >> rendered in Poser using a python script that rendered it out from many >> viewing angles. >> >> The GPU can easily render 10000 agents with different walking speeds at >> interactive frame rates. The bottleneck is the agent simulation on the CPU. >> ;) >> >> >> 2012/11/17 Bruno Fanini <phoeni...@gmail.com> >> >> Hello osgUsers, >> >> Within a osg-based crowd simulator I'm currently developing, I was trying >> to investigate a simple skeletal animation for a given set of agents. >> I'm digging the animtkviewer.cpp example (osganimationviewer) and it >> looks like a good solution for this case. >> In this context, I would just need a plain simple "walking" animation for >> my characters. >> I've a set of PositionAttitudeTransforms nodes to control position & >> attitude of a single agent, so my questions are: >> - is it possible to control the independent speed of the walking >> animation for a single agent? (i.e. another agent is walking faster, etc..) >> - what about instancing 3d models? is it still possible with this >> approach somehow? (i.e. every p.a.t pointing to the same 3d model) >> - what about the performance drop (estimate)? >> - is there any example out there applied to crowd simulations or similar? >> Thanks, >> >> -- >> Bruno Fanini >> http://BrunoFanini.co.nr >> http://DevHelio.co.nr (Software Development) >> http://www.facebook.com/DigitalDivadlo<http://www.facebook.com/digitaldivadlo> >> (Digital >> Art) >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> >> >> -- >> Bruno Fanini >> http://BrunoFanini.co.nr >> http://DevHelio.co.nr (Software Development) >> http://www.facebook.com/DigitalDivadlo<http://www.facebook.com/digitaldivadlo> >> (Digital >> Art) >> , >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > > -- > Bruno Fanini > http://BrunoFanini.co.nr > http://DevHelio.co.nr (Software Development) > http://www.facebook.com/DigitalDivadlo<http://www.facebook.com/digitaldivadlo> > (Digital > Art) > > -- Bruno Fanini http://BrunoFanini.co.nr http://DevHelio.co.nr (Software Development) http://www.facebook.com/DigitalDivadlo<http://www.facebook.com/digitaldivadlo> (Digital Art)
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org