Re: [osg-users] Scale-invarient lighting
Hi Dave, Sorry for the slow response, I've worked it out. I had to: - Add normals to all points - Add directional lighting from multiple directions (6 in fact), so that the lighting is fairly omnidirectional ...and the points are now showing correctly. Thanks for the help! That seems a bit overkill. If you simply want the points to be uniformly lit, you can disable lighting for them and assign the color you need. Cheers Sebastian Dave -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68676#68676 ___ 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] different materials for a geometry and highlight
Hi Gianni, I am having the same results as in the video and I thought that is what is expected - I thought your main problem was updating the selection area with colors. Let me see if I can spot something else in your code ... I am doing this in breaks :-) On Wed, Sep 21, 2016 at 8:48 AM, Gianni Ambrosio wrote: > Sorry the avi extension is not allowed. Here is the movie. > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=68678#68678 > > > > > ___ > 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] different materials for a geometry and highlight
Hi Nick, the problem I have is that I change the content of primitive sets but the color does not change in the 3D view. Regards, Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68681#68681 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Lazy Disabling without VertexFuncsAvailable
Hi, I have converted my fixed function OSG program to a shader pipeline (using setVertexAttribArray and shaders instead of the setVertexPointer et al) and did run into some issues when disabling "UseVertexAttributeAliasing", and OSG is compiled with OPENGL_PROFILE=GLCORE (So OSG_GL_VERTEX_FUNCS_AVAILABLE is unset). I tested the same code on a linux with OSG compiled for a FFP. And there, the code works as expected. A simple test program is here: https://github.com/fwiesel/vertexarrayfunctest An API trace of the failing case shows the following interesting part: ... glEnableVertexAttribArray(0) glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL) # NULL is okay, the Array has been bound before glDisableVertexAttribArray(0) glDisableVertexAttribArray(1) glDisableVertexAttribArray(2) glDisableVertexAttribArray(11) glDisableVertexAttribArray(12) glDrawArrays(GL_POINTS, 0, 500) ... No prior call to enable the array 1,2, 11, or 12 are issued. The glDisableVertexAttribArray calls are coming from osg::State::applyDisablingOfVertexAttributes() https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osg/State.cpp#L1296-L1304 as _useVertexAttributeAliasing is false, and each "._lazy_disable" is true. The state of "._enabled" is never checked, as "disablePointer" is unconditionally mapped to the aliased "disableVertexAttribArray" I think, the bug lies in the assumption of the lazy disabling, that if we do not use the aliasing, that there is a fixed function pipeline. But if OSG_GL_VERTEX_FUNCS_AVAILABLE the functions are unconditionally mapped to aliased vertex attributes. I think, the whole lazy disabling of aliased attributes is superfluous in that context, as each vertex attribute tracks its own state already, and have proposed a patch accordingly: https://github.com/openscenegraph/OpenSceneGraph/pull/125 With the patch applied, the code runs as expected. Does anyone have a different explanation or a better proposal for solving the issue? It doesn't seem to be the acceptable solution. Cheers, Fabian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] different materials for a geometry and highlight
Hi Gianni, the color for the selection is white in your code (at the beginning const osg::Vec4 selectedColor(1.0f, 1.0f, 1.0f, 0.5f); ) and you have blending ON, so all is working well as you coded it . If you want red selection, turn off the blending and change the color ... this is the snippet: const osg::Vec4 selectedColor(1.0f, 0.0f, 0.0f, 0.5f); const osg::Vec4 color1(1.0f, 0.0f, 0.0f, 1.0f); const osg::Vec4 color2(0.0f, 1.0f, 0.0f, 1.0f); const osg::Vec4 color3(0.0f, 0.0f, 1.0f, 1.0f); const osg::Vec4 color4(1.0f, 0.0f, 1.0f, 1.0f); class SelectModelHandler : public osgGA::GUIEventHandler { public: SelectModelHandler() : _selector(0), currentPrimitiveIndex(0) {} osg::Geode* createFaceSelector() { osg::ref_ptr colors = new osg::Vec4Array(1); (*colors)[0] = selectedColor; _selector = new osg::Geometry; _selector->setDataVariance( osg::Object::DYNAMIC ); _selector->setUseDisplayList( false ); _selector->setUseVertexBufferObjects( true ); _selector->setVertexArray( new osg::Vec3Array(3) ); _selector->setColorArray( colors.get() ); _selector->setColorBinding( osg::Geometry::BIND_OVERALL ); _selector->addPrimitiveSet( new osg::DrawArrays(GL_TRIANGLES, 0, 3) ); osg::ref_ptr geode = new osg::Geode; geode->addDrawable( _selector.get() ); geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); //geode->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON ); //geode->getOrCreateStateSet()->setRenderingHint( osg::StateSet::TRANSPARENT_BIN ); On Wed, Sep 21, 2016 at 1:39 PM, Gianni Ambrosio wrote: > Hi Nick, > the problem I have is that I change the content of primitive sets but the > color does not change in the 3D view. > > Regards, > Gianni > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=68681#68681 > > > > > > ___ > 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] Attaching children to the prerender camera
Hi Nick, Thank you for your answer. I have a callback now, which prints every time the texture image to file, when the framebuffer is rendered. I also added a debug line to the fragment shader, so I can see, that my shader is able to render. But it still can not see the objects in the scene graph, although I am sure, that the view and projection matrix is set properly. May you have any idea, where I am doing a mistake? Thanks for your help! Mary-Ann -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68684#68684 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Attaching children to the prerender camera
Hi Mary-Ann, hard to tell without seeing the code.. Can you isolate a sample code so I can run it at my end? On Wed, Sep 21, 2016 at 3:51 PM, Mary-Ann Zorra wrote: > Hi Nick, > > Thank you for your answer. I have a callback now, which prints every time > the texture image to file, when the framebuffer is rendered. I also added a > debug line to the fragment shader, so I can see, that my shader is able to > render. But it still can not see the objects in the scene graph, although I > am sure, that the view and projection matrix is set properly. May you have > any idea, where I am doing a mistake? > > Thanks for your help! > Mary-Ann > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=68684#68684 > > > > > > ___ > 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] Issue with shadow
Its becase OSG's default shadowMap code isn't very good for large scenes - the shadow camera frustum is sized to fit the entire scene, so an individual shadow map pixel may cover a large number of rendered fragments, making the shadows very pixellated, and the 'shadow acne' - caused by a similar aliasing issue is severe. the 'Soft shadow map' technique does some filtering which improves things a fair bit, and there are other algos like LISPSM which try to use shadowmap pixels more efficiently. The 'standard' approach to this in other engines is to use cascaded shadow maps, which render multiple passes and combines them to make close-up and distance shadows work nicely, but this approach is not implemented in osgShadow AFAIK. heres some info on shadow mapping details: http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/ -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68689#68689 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Issue with shadow
Hi marchingcubes, Thanks a lot for your reply. Being unaware of the shortcoming of the 'shadowmap' of OSG for large terrain, I was struggling with shadow. the link u shared is really useful one and exactly addresses my problem. However, i am yet to include these few-found techniques of the link in my OSG code. I will get back to u and update. Any help on how to include the 'Soft shadow map' and cascaded shadow methods in OSG? ... Thank you! Cheers, Suraj -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68690#68690 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Issue with shadow
When you set up the technique on your ShadowedScene, you can use any of the various techniques from osgShadow. on this page: http://trac.openscenegraph.org/projects/osg//wiki/Support/ProgrammingGuide/osgShadow There is example code for setting up shadows, and, as an example, to use soft shadow map shadows instead of standard shadow map shadows, you would change the example as below: osg::ref_ptr sm = new osgShadow::SoftShadowMap; shadowedScene->setShadowTechnique(sm.get()); Note you may have to include the relevant osgShadow classes, and you may need to pass additional parameters as the defaults may not suit your scene e.g for soft shadows, you have parameters like: setSoftnessWidth(); setBias(); setJitteringScale(); which will adjust the appearance of the shadows. The other more advanced shadowing techniques like PSSM, LISPSM and VDSM will have different params so you may need to consult the docs and/or source for details. Note that there doesnt seem to be a great one-size-fits-all solution for high-quality shadows in OpenSceneGraph, and I have read a number of posts where people are struggling to acheive good results, or have artifacts depending on the scene setup. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=68691#68691 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org