Re: [osg-users] Setting the transform matrices
Fair enough.. I do understand the frustration of supporting unfamiliar devs in an FOSS project. I already understand and agree with your post, but I think you took me wrong I'm not making a big deal out of anything and value OSG highly. Based on your post I'll move on to something more concrete: Attached is a example OSG program in OSG 3.4.1 demonstrating vertex attribute aliasing causing issues. There are 8 option permutations to try viewing cow.osg and a osgParticle system with vertex attribute aliasing, uniforms, and shader based particles either on or off. A number provided as a command line arg decides the case. The results are: Code: // 8 pemutations of 3 options, 0-7 // Case 4 : Black cow (vertex attrib aliasing) // Case 5 : Black cow, purple particle smoke (vertex attrib aliasing, shaders) // Case 6 : Black cow (vertex attrib aliasing, modelviewandprojectionuniforms) // Other cases: Shiny cow, white particles And I can't seem to turn it on only for the required programs and off otherwise. Since I can't use legacy gl_* uniforms/attribs in modern shaders you need OSG to set them or to set them yourself. And if you can't enable vertex attrib aliasing or modelviewandprojectionuniforms because they break other things as above you can end up trying unusual things and causing grief on the support mailing list. http://www.hrwallingford.com/facilities/ship-simulation-centre (http://www.hrwallingford.com/facilities/ship-simulation-centre) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=71568#71568 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield * * This application is open source and may be redistributed and/or modified * freely and without restriction, both in commercial and non commercial applications, * as long as this copyright notice is maintained. * * This application is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void createFountainEffect(osgParticle::ModularEmitter* emitter, osgParticle::ModularProgram* program) { // Emit specific number of particles every frame osg::ref_ptr rrc = new osgParticle::RandomRateCounter; rrc->setRateRange(500, 2000); // Accelerate particles in the given gravity direction. osg::ref_ptr accel = new osgParticle::AccelOperator; accel->setToGravity(); // Multiply each particle's velocity by a damping constant. osg::ref_ptr damping = new osgParticle::DampingOperator; damping->setDamping(0.9f); // Bounce particles off objects defined by one or more domains. // Supported domains include triangle, rectangle, plane, disk and sphere. // Since a bounce always happens instantaneously, it will not work correctly with unstable delta-time. // At present, even the floating error of dt (which are applied to ParticleSystem and Operator separately) // causes wrong bounce results. Some one else may have better solutions for this. osg::ref_ptr bounce = new osgParticle::BounceOperator; bounce->setFriction(-0.05); bounce->setResilience(0.35); bounce->addDiskDomain(osg::Vec3(0.0f, 0.0f, -2.0f), osg::Z_AXIS, 8.0f); bounce->addPlaneDomain(osg::Plane(osg::Z_AXIS, 5.0f)); // Kill particles going inside/outside of specified domains. osg::ref_ptr sink = new osgParticle::SinkOperator; sink->setSinkStrategy(osgParticle::SinkOperator::SINK_OUTSIDE); sink->addSphereDomain(osg::Vec3(), 20.0f); emitter->setCounter(rrc.get()); program->addOperator(accel.get()); program->addOperator(damping.get()); program->addOperator(bounce.get()); program->addOperator(sink.get()); } const std::string OSG_DATA_FOLDER("C:/Users/User/Desktop/OpenSceneGraph/OpenSceneGraph-Data/"); int main(int argc, char** argv) { auto useVertexAttributeAliasing = false; auto useModelViewAndProjectionUniforms = true; bool useShaders = false; if (argc > 1) { auto caseNo = atoi(argv[1]); // 8 pemutations of 3 options, 0-7 // Case 4 : Black cow // Case 5 : Black cow, purple particle smoke // Case 6 : Black cow useVertexAttributeAliasing = (0x4 & caseNo)!=0; useModelViewAndProjectionUniforms = (0x2 & caseNo) != 0;
[osg-users] CullVisitor::apply(Geode&) detected NaN,
Hi, I have the following message when I run my OSG application: Code: CullVisitor::apply(Geode&) detected NaN, depth=nan, center=(1.79588 1.50488 1.42179), matrix={ nan nan -nan -nan nan nan -nan -nan nan nan -nan -nan nan nan -nan -nan } What this kind of warning/error means? ... Thank you! Cheers, Rômulo[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=71567#71567 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [ANN] 3rdParty package precompiled with Visual Studio 2017 released
Hi Robert, Good to know and I will probably prune the GLUT library from my supported libraries in time. In the mean time, I have managed to work around the issue. There was a change to the glut.h file in the official github repo last year that introduced some preprocessor variables which changes the ways the library gets linked. Now you need to specify that you are linking with a static library in the parent project. Previously this was handled silently. Visual Studio users now need to set their runtime library option to /MT instead of /MD to be able to link with the static version of the library. My quick workaround was to make the shared library the default option. And if someone tries to build the static library they will get a small warning of what to change in their project to be able to link correctly. Regards Björn From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield Sent: Wednesday, August 30, 2017 10:10 AM To: OpenSceneGraph UsersSubject: Re: [osg-users] [ANN] 3rdParty package precompiled with Visual Studio 2017 released On 30 August 2017 at 08:19, Björn Blissing > wrote: Hi Pete, You can try my CMake scripts: https://github.com/bjornblissing/osg-3rdparty-cmake There seems to be some problems with GLUT library, at least on my machine. But except from that I think that all of the latest third party libraries are working correctly with Visual Studio 2017 update 3. I don't know if it helps but the OSG master no longer uses GLUT as I've removed the GLUT example. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] scene snapshot
Hi Gianni, Robert, yes, this will be like map view. I am familiar with the Camera interface and the GL/GLU counterparts. The projection matrix should for sure be ortho2D, just struggling with the view matrix how to set it up to have the scene to fit exactly in ... thinking ... Thanks for any hint On Wed, Aug 30, 2017 at 11:57 AM, Gianni Ambrosiowrote: > Hi Nick, > I'm not sure my scenario is like mine but hope this code snippet may help: > > > Code: > > void setViewTowardsXMinus() > { >nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d( > nodeTrackerManipulator->getDistance(), 0.0, 0.0)), osg::Vec3d(0.0, 0.0, > 0.0), nodeTrackerManipulator->getHomeUpPosition()); > } > > void setViewTowardsXPlus() > { >nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(- > nodeTrackerManipulator->getDistance(), 0.0, 0.0)), osg::Vec3d(0.0, 0.0, > 0.0), nodeTrackerManipulator->getHomeUpPosition()); > } > > void setViewTowardsYMinus() > { >nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0, > nodeTrackerManipulator->getDistance(), 0.0)), osg::Vec3d(0.0, 0.0, 0.0), > nodeTrackerManipulator->getHomeUpPosition()); > } > > void setViewTowardsYPlus() > { >nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0, > -nodeTrackerManipulator->getDistance(), 0.0)), osg::Vec3d(0.0, 0.0, 0.0), > nodeTrackerManipulator->getHomeUpPosition()); > } > > void setViewTowardsZMinus() > { >nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0, > 0.0, nodeTrackerManipulator->getDistance())), osg::Vec3d(0.0, 0.0, 0.0), > nodeTrackerManipulator->getHomeUpPosition()); > } > > void setViewTowardsZPlus() > { >nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3(0.0f, > 0.0f, -nodeTrackerManipulator->getDistance())), osg::Vec3d(0.0, 0.0, > 0.0), nodeTrackerManipulator->getHomeUpPosition()); > } > > osg::Vec3d computeEye(const osg::Vec3d& iEye) > { >osg::Vec3d eye = iEye; >... >double psi, theta, phi; >graphicObject->getInitialRotation(psi, theta, phi); >osg::Quat initAttitude = viosg::quatFromBody313(psi, theta, phi); >eye = initAttitude * graphicObject->getTransformNode()->getAttitude() > * eye; >return eye; > } > > > > > Cheers, > Gianni > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=71564#71564 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] scene snapshot
Hi Nick, I'm not sure my scenario is like mine but hope this code snippet may help: Code: void setViewTowardsXMinus() { nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(nodeTrackerManipulator->getDistance(), 0.0, 0.0)), osg::Vec3d(0.0, 0.0, 0.0), nodeTrackerManipulator->getHomeUpPosition()); } void setViewTowardsXPlus() { nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(-nodeTrackerManipulator->getDistance(), 0.0, 0.0)), osg::Vec3d(0.0, 0.0, 0.0), nodeTrackerManipulator->getHomeUpPosition()); } void setViewTowardsYMinus() { nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0, nodeTrackerManipulator->getDistance(), 0.0)), osg::Vec3d(0.0, 0.0, 0.0), nodeTrackerManipulator->getHomeUpPosition()); } void setViewTowardsYPlus() { nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0, -nodeTrackerManipulator->getDistance(), 0.0)), osg::Vec3d(0.0, 0.0, 0.0), nodeTrackerManipulator->getHomeUpPosition()); } void setViewTowardsZMinus() { nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3d(0.0, 0.0, nodeTrackerManipulator->getDistance())), osg::Vec3d(0.0, 0.0, 0.0), nodeTrackerManipulator->getHomeUpPosition()); } void setViewTowardsZPlus() { nodeTrackerManipulator->setTransformation(computeEye(osg::Vec3(0.0f, 0.0f, -nodeTrackerManipulator->getDistance())), osg::Vec3d(0.0, 0.0, 0.0), nodeTrackerManipulator->getHomeUpPosition()); } osg::Vec3d computeEye(const osg::Vec3d& iEye) { osg::Vec3d eye = iEye; ... double psi, theta, phi; graphicObject->getInitialRotation(psi, theta, phi); osg::Quat initAttitude = viosg::quatFromBody313(psi, theta, phi); eye = initAttitude * graphicObject->getTransformNode()->getAttitude() * eye; return eye; } Cheers, Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=71564#71564 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [ANN] 3rdParty package precompiled with Visual Studio 2017 released
On 30 August 2017 at 08:19, Björn Blissingwrote: > Hi Pete, > > You can try my CMake scripts: > https://github.com/bjornblissing/osg-3rdparty-cmake > > There seems to be some problems with GLUT library, at least on my machine. > But except from that I think that all of the latest third party libraries > are working correctly with Visual Studio 2017 update 3. > I don't know if it helps but the OSG master no longer uses GLUT as I've removed the GLUT example. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Setting the transform matrices
Hi Chris, On 30 August 2017 at 07:50, Chris Kuliukaswrote: > For now it'd be too time consuming to isolate a test case. Supporting > modern OpenGL does seem like it would be more natural if you had some way > of hooking into the setting of the model matrix and vertex attributes so > that you could assign / name / alter them yourself. > Ahh, sorry but you just don't seem to grasping it, the OSG fully supports setting the view and projection matrices in GLES2 and GL3+ core profile, you don't need to add ANY more complexity than just replacing gl_ModelView* with osg_ModelView*, the OSG will even automatically remap for you. The OSG automatically accumulates all view and projection matrices for you, sets the when required, it does a shed load of work for you to make you life easy. All the osg::Camera and osg::Transform subclasses all work in coherent and robust fashion, whether you are using fixed function pipeline of shaders and they function in the same way in both. This capability is massive strength of the OSG. I can't help but feel you are making a massive deal from your own mis-understandings and see restrictions where there aren't any. Just use the OSG, while it's not perfect, the flaws it has aren't related to management of modelview and projection martrices, this has all been working well in fixed function and shaders for a decade, it's a solved problem. If all this power and convinience is not for then please go right your own scene graph as I really shouldn't have to keep replying to a pointless thread where the solutions are already provided. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] scene snapshot
Hi Nick, On 30 August 2017 at 07:38, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > I have scene (terrain tile) and I want to take a snapshot in ortho (to > make a texture out of the scene snapshot). I have RTT camera and an image > as an attachment. The scene is added as a child to this camera. What would > be the settings for the Projection and the View matrix for the RTT camera? > Just have a look at the osg::Camera header for the setViewMatrixAs*() and setProjectionMatrix*() methods, they all have GL/GLU counterparts so general OpenGL documentation on view and projection matrices apply (it's why I chose to use exactly the same naming). Exactly what the settings should be will depend upon your application needs, it's not something we know so can't can't provide specific guidance on, you'll need to work these out. As a general comment, to help debug the settings I would recommend creating a osg::Camera that renders on top of the main window, like a traditonal map view, and once you are confident that the view and projection matrix settings make sense you can then just change the Camera to be an offscreen one. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] RayTracedTechnique hangs with Intel HD Graphics
Hi, My program uses RayTracedTechnique for volume rendering, but it hangs with Intel HD graphics 520, 530 and 620. My old laptop works fine which is using Intel HD Graphic 3000. Other machines with Nvidia cards are working fine too. I believe the problem is on shaders in the sampling loop. My program is using osg 3.2.3. I also tried to upgrade to osg 3.4.1, but the same problem occurred with Intel HD Graphic 520, 530 and 620. Do anyone have similar problem and any solution to fix it? Many thanks. Regards, Clement Chu ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [ANN] 3rdParty package precompiled with Visual Studio 2017 released
Hi Pete, You can try my CMake scripts: https://github.com/bjornblissing/osg-3rdparty-cmake There seems to be some problems with GLUT library, at least on my machine. But except from that I think that all of the latest third party libraries are working correctly with Visual Studio 2017 update 3. Regards Björn >-Original Message- >From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On >Behalf Of Pete Stieber >Sent: Saturday, August 19, 2017 6:45 AM >To: osg-users@lists.openscenegraph.org >Subject: Re: [osg-users] [ANN] 3rdParty package precompiled with Visual >Studio 2017 released > >Torben, > >Thank you so much for all of your work. > >A few days ago VS 2017 was updated to version 15.3. Is the method you use >to generate the 3rd party VS packages published anywhere? I'd really like to >try it myself with the latest VS 2017. > >Best regards, >Pete > >-- >Read this topic online here: >http://forum.openscenegraph.org/viewtopic.php?p=71461#71461 > > > > > >___ >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] Setting the transform matrices
Hi Chris,> Hi Robert, For now it'd be too time consuming to isolate a test case. Supporting modern OpenGL does seem like it would be more natural if you had some way of hooking into the setting of the model matrix and vertex attributes so that you could assign / name / alter them yourself. You can use any matrix you like. Simply set it up as uniform and use it in the shader. Since there is underlying scenegraph you need to consider disabling culling for the node or set its matrix accordingly. Your hooking can be done by simply adding a transform-group over your element and set the the desired matrix from there. A minimal example explaining what you want to achieve might be very helpful. Cheers Sebastian Cheers, Chris http://www.hrwallingford.com/facilities/ship-simulation-centre (http://www.hrwallingford.com/facilities/ship-simulation-centre) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=71557#71557 ___ 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] Setting the transform matrices
Hi Robert, For now it'd be too time consuming to isolate a test case. Supporting modern OpenGL does seem like it would be more natural if you had some way of hooking into the setting of the model matrix and vertex attributes so that you could assign / name / alter them yourself. Cheers, Chris http://www.hrwallingford.com/facilities/ship-simulation-centre (http://www.hrwallingford.com/facilities/ship-simulation-centre) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=71557#71557 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [ANN] 3rdParty package precompiled with Visual Studio 2017 released
Torben, Thank you so much for all of your work. A few days ago VS 2017 was updated to version 15.3. Is the method you use to generate the 3rd party VS packages published anywhere? I'd really like to try it myself with the latest VS 2017. Best regards, Pete -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=71461#71461 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] scene snapshot
Hi community, this is easy but I am struggling with. Here is the story: I have scene (terrain tile) and I want to take a snapshot in ortho (to make a texture out of the scene snapshot). I have RTT camera and an image as an attachment. The scene is added as a child to this camera. What would be the settings for the Projection and the View matrix for the RTT camera? Thanks a bunch as always -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org