Re: [osg-users] Threading bug
Hi Mark, Thanks for uncovering this issue. This is a bug that will need to be fixed, I'm just heading out to a all day meeting so will have to look into it further on my return. Robert. On Wed, Sep 3, 2008 at 3:01 AM, Mark Sciabica [EMAIL PROTECTED] wrote: Hello Robert (and other list members), I have found what may be a bug in multithreaded usage of some objects when _OSG_REFERENCED_USE_ATOMIC_OPERATIONS is #defined. The problem is that osg::Node, osg::Drawable, and osg::StateSet all use the getRefMutex() method of osg::Referenced to control addition and removal of obects to their _parents lists. This method always returns null when _OSG_REFERENCED_USE_ATOMIC_OPERATIONS is #defined. So some code that works when not using atomic operations may crash when using atomic operations. My question is whether it is intended to be safe to add a parent to an object that is being used in another thread. My first thought was that it was, otherwise why bother using the mutex when it is available? However, on further examination, there are other usages of the _parents list that are unprotected by the mutex, so the intention may have changed since the mutex protection code was added. For context, I ran into this problem creating an osgText::Text object on a secondary thread and assigning a font to it. Assigning a font entails setting the font's stateset to the osgText::Text object. Even if I don't share my fonts between threads, osgText::DefaultFont has a static instance that is used by all osgText::Text objects that haven't had their fonts set and would cause similar problems. So my workaround for now is to change my build settings so that the mutex is used instead of the atomic operations. Or perhaps I should abandon this line of coding and the above mentioned mutex use should be deleted from osg. Regards, Mark ___ 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
Re: [osg-users] Easy way to pick nearest edge?
OK, I will take a look at the implementation to find out why the index/ratioLists are empty. At the moment I use a workaround that interprets the PrimitiveSet and the geometry's Index/VertexArray which seems to work with our scene generation code. Tanks a lot, Simon Robert Osfield schrieb: Hi Simon, Go have a dig in the LineSegmentIntersector.cpp implementation, it should be possible to get the index and ratios out. Robert. On Tue, Sep 2, 2008 at 10:17 AM, Simon Notheis [EMAIL PROTECTED] wrote: Hi Robert, When i pick e.g. a 3d model of a table my result looks like taht: intersection.ratio 0.298972 intersection.localIntersectionPoint -37.4626 -162.331 25 intersection.localIntersectionNormal -0 0 1 intersection.getWorldIntersectionPoint() 2187.54 -1787.33 750 intersection.getWorldIntersectionNormal() 0 0 1 intersection.primitiveIndex 11 BUT: intersection.indexList.size() 0 intersection.ratioList.size() 0 intersection.drawable.library/className osg::Geometry geometry-getNumPrimitiveSets() 1 geometry-getVertexArray()-getNumPrimitiveSets() 8 Simon Robert Osfield schrieb: Hi Simon, The LineSegmentIntersector records the indices of the vertices of the primitive that has been hit. The LineSegmentIntersector::Intersection::indexList and ratioList provide the indices and barycentric coords. Robert. On Tue, Sep 2, 2008 at 8:54 AM, Simon Notheis [EMAIL PROTECTED] wrote: Hi everyone, I want to use mouse events to pick an object of the 3D scene. Instead of working with the intersection point, I want to find the nearest vertex or edge of the polygon that was hit. Until now I used code similar to the following one: // Get the hitlist by using osg::Viewer::computeIntersection(...) const osgUtil::LineSegmentIntersector::Intersection intersection = *(hitlist.begin()) osg::Geometry* geometry = intersection.drawable-asGeometry() Then i used intersection.indexList and the geometry's VertexArray to iterate through all vertices to find the closest vertex (vx) wrt the intersection point. Then I calculated the angles between vx and the both neighbouring vertices in the indexList to determine which one belongs to the closest edge. Finally, the nodePath gave me the local=world transformation. All of that only worked because we had some bad code to load/convert our own scene format into OSG. This code generated seperate triangles or quads, so actually I always hit a polygon with 3 or 4 vertices, what made it easy to determinie the neighbours of vx. Now that we're using some optimization steps (e.g. triangle strips), I can't use the above code (e.g. the indexList is empty). I tried to use the geometry's IndexArray instead, but the problem is that without knowing the exact primitive type, it is hard to determine which vertices are the neighbouring ones to find the edge. E.g. in case of an triangle strip I would have to check the last 2 and next 2 vertices in the index/vertex list. Also the code won't work if the drawable can't be cast to a Geometry. So my question is, if there's a more easy or flexible way to determine the closest vertex and edge of the intersected polygon/primitve? Looking forward to your ideas or solutions, if something similar was already discussed here. Simon ___ 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 osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Drawing 3D arrows
Hi, Arrows link in VTK for vector field visualisation ? may you can have a look at osgimpostor example. this would be a really efficient way to draw hunders of arrows . regards 2008/9/2 LH [EMAIL PROTECTED] Hi, Anyone has tried drawing 3D arrows in OSG? What will be the most efficient way of accomplishing it or any sample codes to share with? Thanks regards, LH ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Examples osgviewerMFC resize artefact
Hi osg-users, I've been posting some times about resize artefacts and i finally found the solution, it seems to be related to a drivers problem. I've downloaded last beta NVIDIA drivers 177.92 and the problem disappeared... 2008/9/2 amalric alexandre [EMAIL PROTECTED] Hi Jean-Sébastien, I'm neither a Win32 programming expert so if someone has an idea on how to avoid those kind of behaviour please let the community knows. I haven't been able to find the bug, I searched deeper in osg code without success. I'm so sad to not find why it refuse to update viewport size... 2008/8/8 Jean-Sébastien Guay [EMAIL PROTECTED] Hi all, Here is what to do : 1) Launch osgviewerMFC sample 2) open a model 3) reduce window size (not maximised) 4) open an other different model 5) reduce second window size (not maximised) 6) close first window 7) try to resize second window This is also reproducible with stock osgviewer on Win32 when using 2 screens. 1. osgviewer cow.osg (make sure it starts on both screens, fullscreen) 2. press 'f' to go out of fullscreen mode. you will get 2 windows, one on each screen. 3. resize one of the windows (make it bigger), it works fine. 4. close one of the windows. 5. resize the remaining window (make it bigger), and you get the same artifact as in the attachment in the OP. I'm not a win32 programming expert so I can't really see what would cause this. The cow still rotates if you try, so the update loop is still being executed... I can't see why the viewport would not be updated to the new window size if one of the windows was closed... Perhaps someone more knowledgeable than me can trace through the code. And I can't test right now if the same happens on other platforms, but I suspect not. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Alexandre AMALRIC Ingénieur RD === PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille http://www.pixxim.fr -- Alexandre AMALRIC Ingénieur RD === PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille http://www.pixxim.fr ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Nvidia beta drivers 177.92 resolve bugs
Hi osg-users, I've been posting some times about resize artefacts with MFC and osgViewer integration and i finally found the solution, it seems to be related to a drivers problem. I've downloaded last beta NVIDIA drivers 177.92 and the problem disappeared... Hope it will work with final drivers WHQL certified :-) -- Alexandre AMALRIC Ingénieur RD === PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille http://www.pixxim.fr ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shadow Map
Hi guys, About the performance i guessed it was not free, but i did not have an idea about the cost, so i made a little test in my application, I hacked shadowmap.cpp to render the shadowmap only on node with the nodemask receiveShadow then other are renderer as if they were outside the shadowscene The first scene: Hacked shadowmap - the earth model - receive shadow - 100 * dumptruck - cast shadow but does not receive result = 63fps No hacked Version: - the earth model - receive shadow - 100 * dumptruck - cast shadow and receiveshadow result = 38fps The second scene: Hacked shadowmap - the earth model - receive shadow - 100 * cow - cast shadow but does not receive result = 82fps The second test was with regular shadowmap implementation so: No hacked Version: - the earth model - receive shadow - 100 * cow - cast shadow and receiveshadow result = 102fps the test was on GeForce 8600M GT - 512 MB - dual core 2 2.4Ghz Then it's just mean that it's not so free if you have a lot of object shadowed. It's a quick test so maybe it's not accurate but it think it gives an idea. But the other argument to control the self shadowing feature it's to just to control if you want to see shadow or not on object. Sometime in non realistic rendering or special rendering you want to control what cast and receive shadow. But i know it's not most of usage so i understand ShadowMap is not designed for that. Any way it was interesting to understand the current ShadowMap implementation. Is there a version of the futur ShadowMapStandard available on the web ? Cheers Cedric Jean-Sébastien Guay wrote: Hello Cedric, With this solution an object that cast shadow will get it's own shadow isn't it , i know in most of the case it's what you want but i would like to avoid when i can for performance reason. I would like something like a list a of caster and a list of receiver. Maybe i could just write a shadowmap technic that allow that. The osgShadow::ShadowMap technique has just not been designed to do that. You have the option of either: 1. Casts and receives : object is under ShadowedScene, and has the correct nodemasks 2. Does not cast but receives : object is under ShadowedScene, and has ~CastsShadow nodemask 3. Does not cast, does not receive : object is not under ShadowedScene. Doing anything more would require some changes. You can always subclass ShadowMap to do it, but as the class stands it's not very useful since you'll need to copy-paste most of it anyways because it was not really designed to be subclassed (all the work is done in the cull() method). I think the upcoming improvements by Wojtek will make this sort of thing much more doable. But in any case, I don't really see why you don't want an object to self-shadow. In a shadow map technique, it does not involve any additional cost. If the object casts shadows on other objects, then it's already part of the ShadowMap RTT, and thus, where it casts its shadows has no effect on performance (at least as far as I know, perhaps I'll learn something new...). Hope this helps, J-S -- +33 (0) 6 63 20 03 56 Cedric Pinson mailto:[EMAIL PROTECTED] http://www.plopbyte.net ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shadow Map
Hi Cedric, Interesting observations. In a sense ShadowMap technique forks cull traversal. One cull traversal build render bins to draw the scene on the screen the other traversal bulids render bins for shadow map camera. By removing a number of objects from this second traversal you should be able to get some more fps. So it was expected. But there should be no real gain on draw traversal unless you stopped rendering shadow casters on the screen (they are only rendered into shadow map). Can you check on the bars which traversal benefits the most ? Cheers, Wojtek Hi guys, About the performance i guessed it was not free, but i did not have an idea about the cost, so i made a little test in my application, I hacked shadowmap.cpp to render the shadowmap only on node with the nodemask receiveShadow then other are renderer as if they were outside the shadowscene The first scene: Hacked shadowmap - the earth model - receive shadow - 100 * dumptruck - cast shadow but does not receive result = 63fps No hacked Version: - the earth model - receive shadow - 100 * dumptruck - cast shadow and receiveshadow result = 38fps The second scene: Hacked shadowmap - the earth model - receive shadow - 100 * cow - cast shadow but does not receive result = 82fps The second test was with regular shadowmap implementation so: No hacked Version: - the earth model - receive shadow - 100 * cow - cast shadow and receiveshadow result = 102fps the test was on GeForce 8600M GT - 512 MB - dual core 2 2.4Ghz Then it's just mean that it's not so free if you have a lot of object shadowed. It's a quick test so maybe it's not accurate but it think it gives an idea. But the other argument to control the self shadowing feature it's to just to control if you want to see shadow or not on object. Sometime in non realistic rendering or special rendering you want to control what cast and receive shadow. But i know it's not most of usage so i understand ShadowMap is not designed for that. Any way it was interesting to understand the current ShadowMap implementation. Is there a version of the futur ShadowMapStandard available on the web ? Cheers Cedric Jean-Sébastien Guay wrote: Hello Cedric, With this solution an object that cast shadow will get it's own shadow isn't it , i know in most of the case it's what you want but i would like to avoid when i can for performance reason. I would like something like a list a of caster and a list of receiver. Maybe i could just write a shadowmap technic that allow that. The osgShadow::ShadowMap technique has just not been designed to do that. You have the option of either: 1. Casts and receives : object is under ShadowedScene, and has the correct nodemasks 2. Does not cast but receives : object is under ShadowedScene, and has ~CastsShadow nodemask 3. Does not cast, does not receive : object is not under ShadowedScene. Doing anything more would require some changes. You can always subclass ShadowMap to do it, but as the class stands it's not very useful since you'll need to copy-paste most of it anyways because it was not really designed to be subclassed (all the work is done in the cull() method). I think the upcoming improvements by Wojtek will make this sort of thing much more doable. But in any case, I don't really see why you don't want an object to self-shadow. In a shadow map technique, it does not involve any additional cost. If the object casts shadows on other objects, then it's already part of the ShadowMap RTT, and thus, where it casts its shadows has no effect on performance (at least as far as I know, perhaps I'll learn something new...). Hope this helps, J-S -- +33 (0) 6 63 20 03 56 Cedric Pinson mailto:[EMAIL PROTECTED] http://www.plopbyte.net ___ 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] VPB for OSG2.6
Hi, Is there a working version of VPB for OSG 2.6? With current VPB-trunc I get a couple of error concerning 'getSetName()' from different osgTerrain-objects. To build I uncomment these lines but don't know if this is ok... Thx in advance rob - IABG mbH Sitz der Gesellschaft: Ottobrunn, Registergericht: Amtsgericht Muenchen, HRB 5499 Geschaeftsfuehrung: Prof. Dr.-Ing. Rudolf F. Schwarz Vorsitzender des Aufsichtsrats: General a. D. Wolfgang Altenburg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VPB for OSG2.6
There was a discussion a few day ago about that. Search in the mailing list vpb revision Cheers, Cedric Schrader Robert wrote: Hi, Is there a working version of VPB for OSG 2.6? With current VPB-trunc I get a couple of error concerning ‘getSetName()’ from different osgTerrain-objects. To build I uncomment these lines but don’t know if this is ok… Thx in advance rob IABG mbH Sitz der Gesellschaft: Ottobrunn, Registergericht: Amtsgericht Muenchen, HRB 5499 Geschaeftsfuehrung: Prof. Dr.-Ing. Rudolf F. Schwarz Vorsitzender des Aufsichtsrats: General a. D. Wolfgang Altenburg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- +33 (0) 6 63 20 03 56 Cedric Pinson mailto:[EMAIL PROTECTED] http://www.plopbyte.net ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Collision of Spheres
Hi I am trying to implement simple collision detection using OSG. Just few balls/spheres enclosed in a closed box colliding with each other and deflecting. Since the objects are spheres, I used BoundingSphere objects to detect collision. I expect the bounding sphere to coincide with actual spherical object, so collision should be accurate, That's where I face the problem. The the collision is being detected (intersects true) some distance *before* balls actually touch with each other. I want it to detect the collision (intersects true) when they touch with each other. Is there anything I might be missing ? Following is relevant segment of the code. /* Check for intersection of one object with every other. */ for(int i = 0; i (int)carlist.size(); i++) { for(int j = i+1; j (int)carlist.size(); j++) { /* Use pointer to MatrixTransform to obtain bound objects. */ const osg::BoundingSphere bs1 = carlist[i]-mt-getBound(); const osg::BoundingSphere bs2 = carlist[j]-mt-getBound(); if(bs1.intersects(bs2)) { /* Collision detection. Simply reverse direction. */ carlist[i]-dx = -carlist[i]-dx; carlist[i]-dz = -carlist[i]-dz; carlist[j]-dx = -carlist[j]-dx; carlist[j]-dz = -carlist[j]-dz; } } } Attached is complete code listing. -- Vijay Patil /* Description: Learning collision detection. * * Compile and Execute: * $ g++ -L/usr/local/lib -losg -losgDB -losgViewer shape.cpp -o collision * $ ./collision * * */ #includeosgViewer/Viewer #includeosg/ShapeDrawable #includeosg/MatrixTransform #include osg/Node #include osg/NodeCallback #include osg/Timer #include cstdlib #include string #include vector #include iostream #define W 800.0 #define H 800.0 #define MAX_SPEED 5 #define CARCOUNT 10 using namespace std; /* Car is drawn as sphere for time being. */ class Car { public: double dx, dz; double x, z; osg::MatrixTransform * mt; Car() { x = -W/2 + rand() % (int)W; z = -H/2 + rand() % (int)H; dx = (rand() % (MAX_SPEED * 2)) - MAX_SPEED; dz = (rand() % (MAX_SPEED * 2)) - MAX_SPEED; mt = NULL; } void move() { x = x + dx; z = z + dz; osg::Matrix m; m.makeTranslate(x, 0, z); this-mt-setMatrix(m); if (x -W/2.0 || x W/2.0) dx = -dx; if (z -H/2.0 || z H/2.0) dz = -dz; } }; /* Declarations. */ osg::ref_ptrosg::MatrixTransform draw_sphere(Car * pcar); /*- Entry point. Create and populate scene graph. -*/ int main() { osgViewer::Viewer viewer; osg::ref_ptrosg::Group root_group = new osg::Group; vectorCar* carlist; viewer.setUpViewInWindow(0, 0, W, H); for(int i = 0; i CARCOUNT; i++) { Car * pcar = new Car(); carlist.push_back(pcar); root_group-addChild(draw_sphere(pcar).get()); } viewer.setSceneData(root_group.get()); osg::Vec3d eye(0.0, -W/2, 0.0); osg::Vec3d target(0.0, 0.0, 0.0); osg::Vec3d up(0.0, 0.0, 1.0); viewer.getCamera()-setViewport(0, 0, W, H); //viewer.getCamera()-setProjectionMatrixAsPerspective(80., 1., 1., 140. ); viewer.getCamera()-setProjectionMatrixAsOrtho(-W/2, W/2, -H/2, H/2, -W/2, W/2); osg::Timer_t start_tick = osg::Timer::instance()-tick(); while(viewer.done() == 0) { viewer.getCamera()-setViewMatrixAsLookAt(eye, target, up); viewer.getCamera()-setClearColor(osg::Vec4(1.0, 1.0, 1.0, 1.0)); osg::Timer_t end_tick = osg::Timer::instance()-tick(); double delta_m = osg::Timer::instance()-delta_m(start_tick, end_tick); if(delta_m 10.0) { /* Check for intersection of one object with every other. */ for(int i = 0; i (int)carlist.size(); i++) { for(int j = i+1; j (int)carlist.size(); j++) { /* Use pointer to MatrixTransform to obtain bound objects. */ const osg::BoundingSphere bs1 = carlist[i]-mt-getBound(); const osg::BoundingSphere bs2 = carlist[j]-mt-getBound(); if(bs1.intersects(bs2)) { /* Collision detection. Simply reverse direction. */ carlist[i]-dx = -carlist[i]-dx; carlist[i]-dz = -carlist[i]-dz; carlist[j]-dx = -carlist[j]-dx; carlist[j]-dz = -carlist[j]-dz; } } } for(int i = 0; i (int)carlist.size(); i++) carlist[i]-move(); start_tick = osg::Timer::instance()-tick(); } viewer.frame(); } return 0; } /*- Car is drawn as sphere (rad = 20) for time being. -*/ #define RAD 20.0 osg::ref_ptrosg::MatrixTransform draw_sphere(Car * pcar) { /* Geode containing a shape. */ osg::ref_ptrosg::Geode geode = new osg::Geode; osg::ref_ptrosg::ShapeDrawable sd;
Re: [osg-users] Collision of Spheres
Hello Vijay, I expect the bounding sphere to coincide with actual spherical object, I haven't looked at the code specifically, but I think this is the assumption which turns out to be false. The Drawables have bounding boxes, and then the Geodes containing them have bounding spheres which are built to encompass the Drawables' bounding boxes. Hence, the Geode's bounding sphere will be larger than the original sphere because it has to encompass the sphere's bounding box, which has to encompass the sphere itself. I hope this makes sense. If not, draw it on a piece of paper: draw a circle (which is your graphical object), then draw the smallest box that encompasses this circle, and then draw the smallest circle that encompasses that box. The second circle will inevitably be larger than the first one. It's also pretty easy to make a visitor that will add a graphical representation of all bounding volumes of a scene. Hope this helps, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Fwd: SKYBOX ?
Hello Nao, Would you have some advice about this, please? Please don't send e-mail to someone directly when you post questions on a mailing list. If I didn't reply, there are a couple possible reasons, which may be that I didn't get to it yet, or that I don't have anything to add (which is the case here). In any case, it's kind of like assuming that your question takes precedence over whatever else I may be doing, which is a bit rude. Like most people on the mailing list, I have paid work to do, and answering messages on the list is done on the off-time (while something compiles, or whatever). Now, when I try to use a 2048x2048 jpeg image for the texture, I get this message (after viewer.run()): Scaling image 'skybox-1.jpg' from (2048,2048) to (512,512) And indeed the image seems rescaled to 512x512. It does not have the quality of 2048x2048 image. Is there a way to use the 2048x2048 image without rescaing? What component is enforcing this 512x512 restriction? I have no idea why OSG would scale an image from 2048x2048 to 512x512. As far as I know, OSG should only auto-resize an image if its dimensions are not powers of two, and 2048 is a power of two... You could place a breakpoint where the message originates (search for Scaling image in the OSG sources, and place a breakpoint there) and then run your application, and when the breakpoint is reached, examine the call stack to see where the resize originates from. Sorry I can't help more. J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Collision of Spheres
I haven't looked at the code specifically, but I think this is the assumption which turns out to be false. The Drawables have bounding boxes, and then the Geodes containing them have bounding spheres which are built to encompass the Drawables' bounding boxes. Hence, the Geode's bounding sphere will be larger than the original sphere because it has to encompass the sphere's bounding box, which has to encompass the sphere itself. J-S is right here. But, there is a ShapeVisitor class and a ConstShapeVisitor class that you can use to create a more accurate bounding sphere, as in the code below... (Coding this off the top of my head, so forgive typos, thanks.) -Paul class SphereBoundVisitor : public osg::ConstShapeVisitor { public: SphereBoundVisitor() {} virtual ~SphereBoundVisitor() {} virtual void apply( const osg::Shape s ) { osg::notify( osg::WARN ) Unknown shape. std::endl; } virtual void apply( const osg::Sphere s ) { osg::notify( osg::INFO ) Found Sphere. std::endl; osg::Vec3 c = s.getCenter(); float radius = s.getRadius(); _bs = osg::BoundingSphere( c, r ); } osg::BoundingSphere _bs; }; ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Correction of wikipage Support/Maths/MatrixTransformations
Hello, on the page http://www.openscenegraph.org/projects/osg/wiki/Support/Maths/MatrixTransformations is stated that one should pass this matrix GLfloat ZrotateMatrix[][4] = { { cosA, -sinA, 0, 0 }, { sinA, cosA, 0, 0 }, {0, 0,1, 0 }, {0, 0,0, 1 } }; to glLoadMatrixf(): and see what happens (g'ahead try it, don't take my word for it). Your rotations will be the opposite of what you expect. Well, the correctness of the result depends on what you expect: OpenGL's glLoadMatrixf() and its variants expect a column-major-matrix as parameter (see http://www.opengl.org/sdk/docs/man/xhtml/glLoadMatrix.xml); passing a row-major-matrix (like done in this example) to glLoadMatrixf() results in a transformation described by the transposed matrix-argument. Same holds true for the translation described later on the wiki page. So the results of the allegedly erroneous examples are actually correct, regarding the OpenGL documentation and standard maths. Another point I want to mention here is my surprise about the argumentation of the matrix-vector-product in OSG: Almost every book or website I've read about computer graphics in general and some DSL's in particular uses V' = M * V on a broad basis, where V' is the transformed vector, V is the original vector and M descibes the trafo. One could - like the documentation did - replace this commonly used matrix product with W' = W * N, but (at least in my opinion) _must_ mention that: 1. W' and W are transposed vectors (that is, they are row vectors, instead of widely used column vectors) 2. N must not be a common transformation matrix (like the ones mentioned on wikipedia or mathworld.wolfram.com), but the transpose of such a matrix. IMHO, the documentation found on that wiki page does need some slight corrections, but also a lot of additions to clearly state when to use original or transposed transformation matrices. Regards, Matthias Bindernagel ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Fwd: SKYBOX ?
On Wed, 2008-09-03 at 13:17 -0400, Jean-Sébastien Guay wrote: Hello Nao, Would you have some advice about this, please? Please don't send e-mail to someone directly when you post questions on a mailing list. If I didn't reply, there are a couple possible reasons, which may be that I didn't get to it yet, or that I don't have anything to add (which is the case here). In any case, it's kind of like assuming that your question takes precedence over whatever else I may be doing, which is a bit rude. Like most people on the mailing list, I have paid work to do, and answering messages on the list is done on the off-time (while something compiles, or whatever). Now, when I try to use a 2048x2048 jpeg image for the texture, I get this message (after viewer.run()): Scaling image 'skybox-1.jpg' from (2048,2048) to (512,512) And indeed the image seems rescaled to 512x512. It does not have the quality of 2048x2048 image. Is there a way to use the 2048x2048 image without rescaing? What component is enforcing this 512x512 restriction? These values are determined by your OpenGL driver. The osg::Image class queries these values and ensures that all images adhere to this (see osg::Texture::getExtensions(...)) and the method ::maxTextureSize. In your defense, however, I'm not able to actually get any test code for Extensions working at all. Some of the examples create Extensions objects (osgvertexprogram, osgmultitexture), but they never return a valid pointer--at least for me. I have no idea why OSG would scale an image from 2048x2048 to 512x512. As far as I know, OSG should only auto-resize an image if its dimensions are not powers of two, and 2048 is a power of two... You could place a breakpoint where the message originates (search for Scaling image in the OSG sources, and place a breakpoint there) and then run your application, and when the breakpoint is reached, examine the call stack to see where the resize originates from. Sorry I can't help more. J-S ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OT: Any Route Following ( best way to get from A to b)
Hi All Off topic to OSG a little Note how to follow a route that's straight forward, but how to calculate a route , I was wondering if any one had come across or were a ware of any open source projects on Routing best path calculations, give a terrain and 3d database of some from what would the best route for travelling from A to B going through several way points, for walking, driving , in winter , in summer etcetc.. Bit like ya Tom Tom SatNav but without the road data and logic that goes with it ;) I have had some inquiries if we could do something like this in our OSG apps and I have no idea not having been involved in any thing like this before other than using my Tom Tom ;), Thanks Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OT: Any Route Following ( best way to get from A to b)
http://pgrouting.postlbs.org/ -- Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : +1.703.652.4791 On Wed, Sep 3, 2008 at 4:50 PM, Tomlinson, Gordon [EMAIL PROTECTED] wrote: Hi All Off topic to OSG a little Note how to follow a route that's straight forward, but how to calculate a route , I was wondering if any one had come across or were a ware of any open source projects on Routing best path calculations, give a terrain and 3d database of some from what would the best route for travelling from A to B going through several way points, for walking, driving , in winter , in summer etcetc.. Bit like ya Tom Tom SatNav but without the road data and logic that goes with it ;) I have had some inquiries if we could do something like this in our OSG apps and I have no idea not having been involved in any thing like this before other than using my Tom Tom ;), Thanks *Gordon* __ *Gordon Tomlinson* *Product Manager 3D **Email * : gtomlinson @ overwatch.textron.com* * __ *(C): (+1) 571-265-2612 (W)**: (+1) 703-437-7651* Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - *Master Tambo Tetsura* ___ 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
Re: [osg-users] OT: Any Route Following ( best way to get from A to b)
Thanks Glenn __ Gordon Tomlinson mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] IM: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] http://www.vis-sim.com/ www.vis-sim.com http://www.gordontomlinson.com/ www.gordontomlinson.com __ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Glenn Waldron Sent: Wednesday, September 03, 2008 9:51 PM To: OpenSceneGraph Users Subject: Re: [osg-users] OT: Any Route Following ( best way to get from A to b) http://pgrouting.postlbs.org/ -- Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : +1.703.652.4791 On Wed, Sep 3, 2008 at 4:50 PM, Tomlinson, Gordon [EMAIL PROTECTED] wrote: Hi All Off topic to OSG a little Not how to follow a route that's straight forward, but how to calculate a route , I was wondering if any one had come across or were a ware of any open source projects on Routing best path calculations, give a terrain and 3d database of some from what would the best route for travelling from A to B going through several way points, for walking, driving , in winter , in summer etcetc.. Bit like ya Tom Tom SatNav but without the road data and logic that goes with it ;) I have had some enquiries if we could do something like this in our OSG apps and I have no idea not having been involved in any thing like this before other than using my Tom Tom ;), Thanks Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura ___ 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
Re: [osg-users] OT: Any Route Following ( best way to get from A to b)
Thanks Brian __ Gordon Tomlinson mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] IM: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] http://www.vis-sim.com/ www.vis-sim.com http://www.gordontomlinson.com/ www.gordontomlinson.com __ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian ... Sent: Wednesday, September 03, 2008 4:57 PM To: OpenSceneGraph Users Subject: Re: [osg-users] OT: Any Route Following ( best way to get from A to b) Here's a link: http://theory.stanford.edu/~amitp/GameProgramming/ Lot's of stuff out there for A * (star) and derivatives. Brian _ Date: Wed, 3 Sep 2008 16:50:41 -0400 From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: [osg-users] OT: Any Route Following ( best way to get from A to b) Hi All Off topic to OSG a little Not how to follow a route that's straight forward, but how to calculate a route , I was wondering if any one had come across or were a ware of any open source projects on Routing best path calculations, give a terrain and 3d database of some from what would the best route for travelling from A to B going through several way points, for walking, driving , in winter , in summer etcetc.. Bit like ya Tom Tom SatNav but without the road data and logic that goes with it ;) I have had some enquiries if we could do something like this in our OSG apps and I have no idea not having been involved in any thing like this before other than using my Tom Tom ;), Thanks Gordon __ Gordon Tomlinson Product Manager 3D Email : gtomlinson @ overwatch.textron.com __ (C): (+1) 571-265-2612 (W): (+1) 703-437-7651 Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival - Master Tambo Tetsura _ Want to do more with Windows Live? Learn 10 hidden secrets from Jamie. Learn Now http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!5 50F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] VPB error
Has there been a new release of VPB? I built it, but when I try to run it I get the following: osgdem: error while loading shared libraries: libvpb.so.8: cannot open shared object file: No such file or directory Looks as thought something did not install. Just wondering if someone may have some idea. I got the version of VPB from SVN and it appears to build with the OSG that I have, 2.6 RC1. Thanks, Michael ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VPB error
You should copy the dll and lib to the path of osgdem.exe,or set the environment path.I think is the problem. 在2008-09-04,Michael W. Hall [EMAIL PROTECTED] 写道: Has there been a new release of VPB? I built it, but when I try to run it I get the following: osgdem: error while loading shared libraries: libvpb.so.8: cannot open shared object file: No such file or directory Looks as thought something did not install. Just wondering if someone may have some idea. I got the version of VPB from SVN and it appears to build with the OSG that I have, 2.6 RC1. Thanks, Michael ___ 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