[osg-users] [osgPlugins] missing textures of collada model in a ShadowedScene using ShadowMap
Dear osg-users, a basic description of the problem: Setting up a ShadowedScene using ShadowMap and loading a collada model results in shadows working but the model missing its texture (completely white). Loading the same model as .obj is fine (both texturing and shadowing). what has been found so far: - loading the collada file in an unshadowed scene works (showing textures) - guessing that the problem lies with the collada plugin assigning up to 3 textures on unit 0-2 (with the main texture usually on 1) and ShadowMap working with 1 base texture on unit 0 and using texture unit 1 for shadowing ? - taking a look at the collada model converted to .osg shows an empty “textureUnit 0 {}” followed by “ textureUnit 1 {...}” with the actual texture. Deleting the empty texture at 0 and switching the actual one to 0 results again in a model without textures (this time black, shadows again working). versions being used: - OSG 3.2.0 together with collada-dom-2.3.1 library Is there a solution to fix this without extending shadowmap/shaders? The fact that that changing the texture unit inside the .osg file is not working at all confuses me a bit. Cheers, Sandro -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60418#60418 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Hole in extrusion
This seems like the age-old "you can't draw a flat-shaded cube with 8 vertices" dilemma. Don't you need to repeat the same xyz vertex possibly multiple times? So that you can have a different normal at the same vertex, depending on which face you're rendering. -Paul On Wed, Jul 23, 2014 at 8:25 AM, Yu Zhang wrote: > Hi everyone, > > Could anyone share some experience on handle 3D hole drawing? > My implementation seems not good, the details are: > > Suppose a small rect is a hole inside a big rect: > [img]http://www.youpic.tk/view.php?filename=706Hole.png[/img] > > The vertices are 0, 1, 2, 3, 4, 5, 6, 7. I'll do: > 1) for extrusion direction, add some vertices in top plane. vertex 8, 9, > 10, 11, 12, 13, 14, 15. Each vertex is offset from a bottom vertex. eg: 0 > ->8, > 1 -> 9... > 2) Use tessellator to process the bottom plane, get some prim sets with > triangles. > 3) For each triangles in bottom, add a side face prim set from top plane > triangle. eg, for triangle 236, use 10, 11, 14. The side face's triangle > strip is 2, 10, 3, 11, 6, 14, 2, 10. > 4) Add all side faces for each triangles, add bottom, top planes. > > The result looks correct, but it have unnecessary side faces inside model. > It sounds do no harm, but if it enable lighting, the look feel is not good: > [img]http://www.youpic.tk/view.php?filename=474NotgoodLighting.png[/img] > > Turn off lighting seems ok, but it lacks lighting. Maybe this is more like > a modeling question, could you please share your experience, thanks! > Attached the picture also. > > Thank you! > > Cheers, > Yu[/img] > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=60411#60411 > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] Linking Errors with OSG-3.3.0 and MSYS
Hi Paul, Could you please try svn/trunk or OSG-3.3.2 rather than 3.3.0 as there a range of build fixes in them. Robert On 23 Jul 2014 21:17, "Paul" wrote: > I can build OSG with MinGW/MSys. > I get link errors when trying to compile an app against it though. > Any ideas? > > C:\Apps\Test\win32\mingw>make > Linking CXX executable ..\bin\Test.exe > C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj > ):Registry.cpp:(.text+0x186e): undefined reference to `osgGetVersion' > C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj > ):Registry.cpp:(.text+0x7f32): undefined reference to > `osg::KdTreeBuilder::KdTre > eBuilder()' > c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: > C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj): bad > rel > oc address 0x1 in section > `.text$_ZNK5osgDB7Options11libraryNameEv[__ZNK5osgDB7O > ptions11libraryNameEv]' > collect2.exe: error: ld returned 1 exit status > make[2]: *** [../bin/Test.exe] Error 1 > make[1]: *** [CMakeFiles/Test.dir/all] Error 2 > make: *** [all] Error 2 > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=60419#60419 > > > > > > ___ > 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] Use of ref_ptr
Hi Judson, That is an important distinction to understand. Thank you! Cheers, Norm -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60422#60422 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Use of ref_ptr
Hi Norm, root->addDrawable (shape1); and root->addDrawable(shape1.get ()); are equivalent. The bare shape1 argument will be implicitly converted to Drawable *. http://trac.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00319.html The osg::Referenced objects store their own reference count (intrusive reference counting), unlike std::shared_ptr where the reference counts are stored with the smart pointer. i.e., root->addDrawable (new ShapeDrawable ()); will not result in a memory leak either. Regards, Judson On 7/23/2014 2:44 PM, Norm Goldstein wrote: Hi, In the excellent Beginners Guide, there is this code snippet (page 64): Code: osg::ref_ptr < osg::ShapeDrawable > shape1 = new osg::ShapeDrawable; osg::ref_ptr < osg::Geode > root = new osg::Geode; root->addDrawable( shape1.get() ); However, I would think the last line should be Code: root->addDrawable( shape1 ); to properly manage the memory. ?? Thank you! Cheers, Norm PS I had to put spaces around the angle brackets. Otherwise, they would not appear in the post. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60417#60417 ___ 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] [build] Linking Errors with OSG-3.3.0 and MSYS
24 июля 2014 г., в 0:19, Paul написал(а): > I can build OSG with MinGW/MSys. > I get link errors when trying to compile an app against it though. > Any ideas? > > C:\Apps\Test\win32\mingw>make > Linking CXX executable ..\bin\Test.exe > C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj > ):Registry.cpp:(.text+0x186e): undefined reference to `osgGetVersion' > C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj > ):Registry.cpp:(.text+0x7f32): undefined reference to > `osg::KdTreeBuilder::KdTre > eBuilder()' > c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: > C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj): bad rel > oc address 0x1 in section > `.text$_ZNK5osgDB7Options11libraryNameEv[__ZNK5osgDB7O > ptions11libraryNameEv]' > collect2.exe: error: ld returned 1 exit status > make[2]: *** [../bin/Test.exe] Error 1 > make[1]: *** [CMakeFiles/Test.dir/all] Error 2 > make: *** [all] Error 2 > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=60419#60419 > > Paul, try MSYS2: http://msys2.github.io https://sourceforge.net/p/msys2/wiki/MSYS2%20installation/ It based on recent cygwin sources and have package manager ported from Arch Linux. We use mingw-w64 toolchains as it is more completeness then mingw.org toolchains. We have large repository with mingw-w64 packages including OpenSceneGraph. Regards, Alexey. > > > > ___ > 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] [build] Linking Errors with OSG-3.3.0 and MSYS
I can build OSG with MinGW/MSys. I get link errors when trying to compile an app against it though. Any ideas? C:\Apps\Test\win32\mingw>make Linking CXX executable ..\bin\Test.exe C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj ):Registry.cpp:(.text+0x186e): undefined reference to `osgGetVersion' C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj ):Registry.cpp:(.text+0x7f32): undefined reference to `osg::KdTreeBuilder::KdTre eBuilder()' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Libs\OpenSceneGraph-3.3.0\win32\mingw\lib\libosgDB.a(Registry.obj): bad rel oc address 0x1 in section `.text$_ZNK5osgDB7Options11libraryNameEv[__ZNK5osgDB7O ptions11libraryNameEv]' collect2.exe: error: ld returned 1 exit status make[2]: *** [../bin/Test.exe] Error 1 make[1]: *** [CMakeFiles/Test.dir/all] Error 2 make: *** [all] Error 2 -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60419#60419 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Use of ref_ptr
Hi, In the excellent Beginners Guide, there is this code snippet (page 64): Code: osg::ref_ptr < osg::ShapeDrawable > shape1 = new osg::ShapeDrawable; osg::ref_ptr < osg::Geode > root = new osg::Geode; root->addDrawable( shape1.get() ); However, I would think the last line should be Code: root->addDrawable( shape1 ); to properly manage the memory. ?? Thank you! Cheers, Norm PS I had to put spaces around the angle brackets. Otherwise, they would not appear in the post. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60417#60417 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Scribe for Quad type Wireframing
Hi All, I have 2 question related to scribing in OSG. #1)What is the technical differencies, pros/cons using wireframing created with the osgFX:scribe and the one created with decorator type (osgScribe example). It seems that osgFX::Scribe is much more compact and convenient way for programmers but I'd like to know is there any performance penalties? #2)When using scribing and loaded object face types are quad, OSG somehow tesselates them as triangles and subdivides quad surfaces as 2 triangles split by diagonal. Is there any way to change that in osgFX:scribeproperties to render the wireframing as quads ? Regards, ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] geometry and normals
Thank you Robert for explanation and clarification. Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60415#60415 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] "Step" animation
Hi, Me again ;). This time i would like to ask about animations, particular kind of it. I've made animation using channels and Vec3LinearChannel type. It works fine, without any problems, e.g. i've used three Vec3Keyframes to animate sample translation (or rotation), object position is nice calculated between each keyframe and animated. I wanted to create on the same way "step" animation - so object is moved in keyframe one, then moved at keyframe 2 without any interpolation between and then again moved in keyframe3 without interpolation - so it "jumps" in keyframes to appropriate positions. There is Vec3StepChannel - but have some problems with it (my object jumps one time and then stops). Is it right type to such kind of animation? If i have such example: keyframe 1 - move object to (0, 0, 0) keyframe 2 - move object to (1, 0, 0) // until here sems to work fine keyframe 3 - want to back to (0, 0, 0) <- this doesn't work (tried also (-1, 0, 0) as translation to back to (0,0,0) If Vec3StepChannel is not for this purpose, how can i achieve such animation? Thank you! Cheers, Robert -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60414#60414 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] geometry and normals
HI Gianni, On 23 July 2014 16:25, Gianni Ambrosio wrote: > Hi Robert, > just because I had in mind a thread in this forum where it seems, on the > contrary, that was NOT recommended for GL efficiency. What isn't recommend is using the deprecated osg::Geometry::setVertex/Color/Normal/etc./Indices(..) functionality, sharing vertices via vertex indices isn't supported by OpenGL and has to be simulated by caching vertex data on the CPU and then send this as a buffer. In OSG-3.2 these methods are deprecated and will be removed completely from OSG-3.4 onwards. > Do you mean something like the code inside "createBackground()" of > osggeometry.cpp example? > > polyGeom->setVertexArray(new osg::Vec3Array(numCoords,myCoords)); > ... > polyGeom->addPrimitiveSet(new > osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,numIndices,myIndices)); > Using DrawElementsUShort is the correct way to provide indices and is fully supported by OpenGL and is the recommend way to provide primitive data where vertices can be shared. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] geometry and normals
Hi Robert, just because I had in mind a thread in this forum where it seems, on the contrary, that was NOT recommended for GL efficiency. Do you mean something like the code inside "createBackground()" of osggeometry.cpp example? polyGeom->setVertexArray(new osg::Vec3Array(numCoords,myCoords)); ... polyGeom->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,numIndices,myIndices)); so, basically the same content of a obj/wavefront file? Regards, Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60412#60412 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [forum] osgText with very large size
Hi, Thanks! that works great. Cheers, Don -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60410#60410 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] geometry and normals
Hi Gianni, The SmoothingVisititor is really just a fallback for when no normals are provided with a model, the best way to get the precisely the result you want is to provider per vertex normals. As for memory/GL efficiency, the most efficient way to the geometry to the GPU is to use index primitives via the osg::DrawElements* primitive set, this allows you to share vertex, normal, texture coordinate data etc. Robert. On 23 July 2014 13:59, Gianni Ambrosio wrote: > Hi All, > I need to draw a surface. Looking at OSG examples I implemented it this > way: > > > Code: > >osg::Geometry* geometry = getGeometry(); >osg::Vec3Array* vertices = new osg::Vec3Array; >GraphicVectorPtr graphicVector = road->graphicVector(); >size_t count = graphicVector->count(); >size_t addedPoints = 0; >vertices->reserve(count * 3); >for (size_t i = 0; i const GraphicItem& item = (*graphicVector)[i]; > if (item.points.size() == 9) { > vertices->push_back(osg::Vec3(item.points[0], item.points[1], > item.points[2])); > vertices->push_back(osg::Vec3(item.points[3], item.points[4], > item.points[5])); > vertices->push_back(osg::Vec3(item.points[6], item.points[7], > item.points[8])); > addedPoints+=3; > } >} >geometry->setVertexArray(vertices); >geometry->addPrimitiveSet(new > osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, addedPoints)); > > > > > Now, first of all I would like to know if this is correct. I mean I want > to draw triangles and I don't want to waste memory. > > The problem is that I see a basically flat surface. I tried then with a > SmoothingVisitor on the geometry and the flat surface problem is solved. So > I guess it was related to normals not set, right? > > Now, since I don't like so much how the surface is rendered with the > SmoothingVisitor, is there a way of render the surface as it is drawn? > > Regards, > Gianni > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=60407#60407 > > > > > > ___ > 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] geometry and normals
Hi All, I need to draw a surface. Looking at OSG examples I implemented it this way: Code: osg::Geometry* geometry = getGeometry(); osg::Vec3Array* vertices = new osg::Vec3Array; GraphicVectorPtr graphicVector = road->graphicVector(); size_t count = graphicVector->count(); size_t addedPoints = 0; vertices->reserve(count * 3); for (size_t i = 0; ipush_back(osg::Vec3(item.points[0], item.points[1], item.points[2])); vertices->push_back(osg::Vec3(item.points[3], item.points[4], item.points[5])); vertices->push_back(osg::Vec3(item.points[6], item.points[7], item.points[8])); addedPoints+=3; } } geometry->setVertexArray(vertices); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, addedPoints)); Now, first of all I would like to know if this is correct. I mean I want to draw triangles and I don't want to waste memory. The problem is that I see a basically flat surface. I tried then with a SmoothingVisitor on the geometry and the flat surface problem is solved. So I guess it was related to normals not set, right? Now, since I don't like so much how the surface is rendered with the SmoothingVisitor, is there a way of render the surface as it is drawn? Regards, Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=60407#60407 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org