[osg-users] Multiple view auto rescale resulting image
Hi, I have a scene with 3 differents views. One global 600*600px, one following one node 600*600px and one following an other node 1200*600px the lase one rendering screen is rescale (2;1). How i can change it to have a larger view but without rescale objects? Thank you! Cheers, Anthony (http://www.hordes.fr?ref=litllechicken) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31925#31925 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Lighting an HeighField.
Hello, I am creating a scene composed of two objects : - A (yellow) submarine, and a osg::ShapeDrawable created from an osg::HeightField : The Seabed. I use a spot light to illuminate this scene. The spot light is positinoned 1 meter above the submarine, the submarine is 10 meters above the seabed. My Submarine is a 3ds file correctly imported. My light is defined as : Code: osg::ref_ptr osg::LightSource m_spotAvant; osg::ref_ptr osg::Light m_lumSpotAvant; m_spotAvant = new LightSource; m_lumSpotAvant = m_spotAvant-getLight(); m_lumSpotAvant-setLightNum(0); m_lumSpotAvant-setPosition(Vec4f(0,0,-89,1)); m_lumSpotAvant-setDirection(Vec3f(0,0,-1)); m_lumSpotAvant-setSpotCutoff(90.); m_lumSpotAvant-setSpotExponent(50); m_lumSpotAvant-setConstantAttenuation(0.1); m_lumSpotAvant-setDiffuse(osg::Vec4(1.0f,0.0f,1.0f,1.0f)); m_spotAvant-setLocalStateSetModes(osg::StateAttribute::ON); I suppose to have a part of my submarine illuminated (because of the spotCutOff and the Spot exponent), and part of the seabed illuminated to. My Submarine is illuminated, but not the sea bed... It is completly black ! I decide to positione a cylinder created in this way : Code: osg::ref_ptr osg::Cylinder m_testCylindre = new osg::Cylinder(osg::Vec3f(0,0,-95), 5, 2); osg::ref_ptr osg::Geode m_gCylindre = new Geode; m_gCylindre-addDrawable(new osg::ShapeDrawable(m_testCylindre)); scene-addChild(m_gCylindre); So this cylinder is 5 meter below the submarine, and 5 meter above the seabed. The cylinder is well illuminated ! So why my cylinder is well illuminated, and not my seabed ? Both objects are osg::ShapeDrawable... Of course I try to find answer to this question looking in the OSG Examples. I try to run the osgspotlight example, and this sample seems to have the same behaviour. The HeightMaps is black, I can't see the spot light ! Best regards, A. BARRAL. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31926#31926 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CompositeViewer issues
Hi Brad, Could you see if you can reproduce this problem with the one of the OSG examples, or a small tweak of one to reproduce this problem. If I can reproduce it reliably then there is a much better chance of spotting the culprit and finding a solution. Cheers, Robert. On Tue, Sep 21, 2010 at 10:27 PM, Brad Huber br...@procerusuav.com wrote: Hello, I recently converted our osg based application over to use Composite Viewer because we need multiple Views on the same scene graph. I’m running in to a little snag which appears to be a bug in CompositeViewer. Simple way of explaining the manifestation of the issue is that I have two Windows and two Views (one view per window) and they both have event handlers attached to the views which react to the osgGA::GUIEventAdapter::RESIZE event. Resizing works hunky dory for view 0 but it does not work correctly for view 1. I believe the culprit is related to these lines of code found in CompositeViewer::eventTraversal(). osgViewer::View* masterView = getViewWithFocus() ? getViewWithFocus() : _views[0].get(); . . . viewEventsMap[masterView].insert( viewEventsMap[masterView].end(), gw_events.begin(), gw_events.end() ); The problem is that when resizing, apparently getViewWithFocus() returns NULL (I guess because the mouse is over the window frame and not the view within the window. Therefore a resize event is taken out of the graphics window queue for the 2nd window and stuck into the event queue for the 0 view (a mismatch). The effect for me is that the when I resize one window the HUD I have set up in the other window receives the resize event and changes which obviously isn’t what I want J. This does seem to be somewhat intermittent and may be related to whether your mouse tends to fall off the window frame towards the view or away from the view… PS I don’t have a solution in hand yet. I thought I would throw this out there in case it’s a known issue or something. Thanks -Brad ___ 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] osg::Particle in shader get/set geometry [SEC=UNCLASSIFIED]
Hi Paul, In the OpenSceneGraph-2.9.9 dev release, and svn/trunk there is work by Wang Rui on osgParticle this provides support for using shaders with particles systems, there is also an example osgparticleshader that will illustrate how to use it. Robert. On Wed, Sep 22, 2010 at 5:49 AM, Paul Pocock paul.poc...@dsto.defence.gov.au wrote: Hi -just a quick one - Im delving into osg::Particle at the moment and I wish to do some glsl processing on the geometry or whatever particle template is used. Is this trivial ? and is there a way to set/get the drawables in an osg Particle system? Regards IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email. ___ 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] (no subject)
Hi Vivek, On Wed, Sep 22, 2010 at 6:44 AM, Vivek Kumar Dwivedi vivekcsjm...@gmail.com wrote: Hi,do not send mail. I am very busy. Too busy to be polite or to take control of your own subscription? At the bottom of all emails there is the link to the mailing list admin pages, simple log in and disable your receipt of mailing lists posts or simply subscribe. http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multiple view auto rescale resulting image
HI Anthony, There a several ways one could interpret your post. What do you mean by a larger view? What do you mean by rescale (2,1)? Robert. On Wed, Sep 22, 2010 at 8:25 AM, Anthony Face litllechic...@hotmail.com wrote: Hi, I have a scene with 3 differents views. One global 600*600px, one following one node 600*600px and one following an other node 1200*600px the lase one rendering screen is rescale (2;1). How i can change it to have a larger view but without rescale objects? Thank you! Cheers, Anthony (http://www.hordes.fr?ref=litllechicken) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31925#31925 ___ 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] Lighting an HeighField.
Hi Adrian, The osgspotlight example that illustrates the use of multi-texturing to do a spot light, rather than just using OpenGL lighting to do the spot light. From your explanation I can't work out whether the osgspotlight example is working correctly on your system. When I run the example what I see is a cessna moving through a circle with a region of the terrain in front and below it light up, but the rest of the terrain is darkened by not completely black. If you aren't seeing the light up area then it sounds like very basic features of OpenGL are not working on your system and you need to look at the driver/hardware. As for the height field not being illuminated, there is no reason for this not to work if you've set up everything correctly. Personally I wouldn't use ShapeDrawable's for this type of work as they are just very primitive convenience classes, they don't scale well to handle complete rendering requirements or provide best performance. Robert. On Wed, Sep 22, 2010 at 9:18 AM, BARRAL Adrien a...@robopec.com wrote: Hello, I am creating a scene composed of two objects : - A (yellow) submarine, and a osg::ShapeDrawable created from an osg::HeightField : The Seabed. I use a spot light to illuminate this scene. The spot light is positinoned 1 meter above the submarine, the submarine is 10 meters above the seabed. My Submarine is a 3ds file correctly imported. My light is defined as : Code: osg::ref_ptr osg::LightSource m_spotAvant; osg::ref_ptr osg::Light m_lumSpotAvant; m_spotAvant = new LightSource; m_lumSpotAvant = m_spotAvant-getLight(); m_lumSpotAvant-setLightNum(0); m_lumSpotAvant-setPosition(Vec4f(0,0,-89,1)); m_lumSpotAvant-setDirection(Vec3f(0,0,-1)); m_lumSpotAvant-setSpotCutoff(90.); m_lumSpotAvant-setSpotExponent(50); m_lumSpotAvant-setConstantAttenuation(0.1); m_lumSpotAvant-setDiffuse(osg::Vec4(1.0f,0.0f,1.0f,1.0f)); m_spotAvant-setLocalStateSetModes(osg::StateAttribute::ON); I suppose to have a part of my submarine illuminated (because of the spotCutOff and the Spot exponent), and part of the seabed illuminated to. My Submarine is illuminated, but not the sea bed... It is completly black ! I decide to positione a cylinder created in this way : Code: osg::ref_ptr osg::Cylinder m_testCylindre = new osg::Cylinder(osg::Vec3f(0,0,-95), 5, 2); osg::ref_ptr osg::Geode m_gCylindre = new Geode; m_gCylindre-addDrawable(new osg::ShapeDrawable(m_testCylindre)); scene-addChild(m_gCylindre); So this cylinder is 5 meter below the submarine, and 5 meter above the seabed. The cylinder is well illuminated ! So why my cylinder is well illuminated, and not my seabed ? Both objects are osg::ShapeDrawable... Of course I try to find answer to this question looking in the OSG Examples. I try to run the osgspotlight example, and this sample seems to have the same behaviour. The HeightMaps is black, I can't see the spot light ! Best regards, A. BARRAL. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31926#31926 ___ 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] Lighting an HeighField.
Thanks for your answer... Now, osgspotlight example is working on my computer... (I didn't download the ressources file, shame on me). I will try to do exactly like in this sample, and I hope all wil be right ! So in this sample, they use a HeighMap and a osg::ShapeDrawable. You said that's not a good idea to use these classes : Personally I wouldn't use ShapeDrawable's for this type of work as they are just very primitive convenience classes, they don't scale well to handle complete rendering requirements or provide best performance What kine of OSG object do you use for that ? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31932#31932 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Lighting an HeighField.
Hi Adrian, On Wed, Sep 22, 2010 at 10:32 AM, BARRAL Adrien a...@robopec.com wrote: Personally I wouldn't use ShapeDrawable's for this type of work as they are just very primitive convenience classes, they don't scale well to handle complete rendering requirements or provide best performance What kine of OSG object do you use for that ? It depends upon how much you want things to scale. For very large terrains, you'll want to use a paged databases, either using VirtualPlanetBuilder to build it off line, or using the 3rd party osgEarth NodeKit to do it runtime. For smaller terrain, such as under a million vertices, you can just use one or more osgTerrain::TerrainTile, or just create your own osg::Geometry directly. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Instanced geometry using a (non power of two)texture1D like a vertex buffer.
Hi all, I am trying to show instanced geometry using a texture1D like a vertex buffer. In fact I have it working more or less... but if my Texture 1D is non power of two then my shader does not render some of the instances. Attached is the code and two images, one with a non power of two texture(9 elements) that fails to draw last element, and other with 256 elements that is drawn correctly. I am using TransferFunction1D to pass my geometry array to a texture1D. Anybody knows what I'm doing wrong? Of course I have set texture-setResizeNonPowerOfTwoHint(false); Thank you in advance! Jordi. -- Jordi Torres Fabra gvSIG 3D blog http://gvsig3d.blogspot.com Instituto de Automática e Informática Industrial http://www.ai2.upv.es attachment: 9instances.pngattachment: 256instances.png#include osg/Texture1D #include osg/TransferFunction #include osg/Geometry #include osg/Geode #include osg/Uniform #include osgViewer/Viewer #include osgViewer/ViewerEventHandlers #include osgGA/StateSetManipulator #include osgGA/TrackballManipulator #include osg/ShapeDrawable #include iostream osg::Texture1D* geometryArrayToTexture(osg::Vec3dArray* geometryArray) { osg::Texture1D* texture= new osg::Texture1D(); osg::Image* im= new osg::Image(); int size = geometryArray-size(); osg::TransferFunction1D::ColorMap geometryMap; int value =0; for (osg::Vec3dArray::iterator it= geometryArray-begin(); it!= geometryArray-end();++it) { geometryMap[(float)value/(float)geometryArray-size()] = osg::Vec4((float)it-x(),(float)it-y(),(float)it-z(),0.); ++value; } if (geometryMap.empty()) { std::coutError: No values read from geometry: std::endl; return 0; } osg::TransferFunction1D* transferFunction = new osg::TransferFunction1D; transferFunction-allocate(geometryArray-size()); transferFunction-assign(geometryMap); texture-setFilter(osg::Texture::MIN_FILTER,osg::Texture::NEAREST); texture-setFilter(osg::Texture::MAG_FILTER,osg::Texture::NEAREST); texture-setResizeNonPowerOfTwoHint(false); im = transferFunction-getImage(); im-setInternalTextureFormat(GL_RGBA32F_ARB); im-setPixelFormat(GL_RGBA); im-setDataType(GL_FLOAT); texture-setImage(im); return texture; } int main (int argc, char *argv[]) { const float halfDimX( .5 ); const float halfDimZ( .5 ); osg::Geometry *geom = new osg::Geometry(); osg::Geometry *auxgeom = new osg::Geometry(); osg::Vec3Array* instaceArray = new osg::Vec3Array; osg::Geode* g= new osg::Geode(); //Create a geometry for use as instance //** Borrowed from osgdrawinstaced example** instaceArray-resize( 4 ); geom-setVertexArray( instaceArray ); geom-setUseDisplayList( false ); geom-setUseVertexBufferObjects( true ); // Geometry for a single quad. (*instaceArray)[ 0 ] = osg::Vec3( -halfDimX, 0., -halfDimZ ); (*instaceArray)[ 1 ] = osg::Vec3( halfDimX, 0., -halfDimZ ); (*instaceArray)[ 2 ] = osg::Vec3( halfDimX, 0., halfDimZ ); (*instaceArray)[ 3 ] = osg::Vec3( -halfDimX, 0., halfDimZ ); //SET number of instances float ninstances=9; // Use the DrawArraysInstanced PrimitiveSet and tell it to draw ninstances. geom-addPrimitiveSet( new osg::DrawArrays( GL_QUADS, 0, 4, ninstances ) ); osg::BoundingBox bb( -1, -1, -1, 10., 10., 10. ); geom-setInitialBound( bb ); osg::Vec3dArray* geometryArray = new osg::Vec3dArray; // Fill geometry array for(int i=0;ininstances/sqrt(ninstances);++i) for(int j =0 ;jninstances/sqrt(ninstances);++j) geometryArray-push_back( osg::Vec3( i*2., 0., j*2.)); //Uniform stuff osg::ref_ptrosg::Texture1D tex = geometryArrayToTexture(geometryArray); osg::ref_ptrosg::StateSetss= g-getOrCreateStateSet(); ss-setTextureAttribute(0, tex); osg::Uniform* guniform= new osg::Uniform(texturePos, tex ); guniform-set(0); ss-addUniform(guniform); ss-addUniform( new osg::Uniform( color, osg::Vec4(1.,1.,0.,0.) )); ss-addUniform( new osg::Uniform( nInstances, ninstances)); //shader std::string vertexSource = #extension GL_EXT_gpu_shader4 : enable\n uniform sampler1D texturePos;\n uniform float nInstances;\n void main() \n { \n vec4 pos= gl_Vertex+ vec4(texture1D(texturePos,(float(gl_InstanceID)/nInstances)).xyz,0.);\n gl_Position= gl_ModelViewProjectionMatrix*pos;\n } \n; std::string fragSource = uniform vec4 color;\n void main() \n { \n gl_FragColor = color; \n } \n; //shader activation stuff osg::ref_ptr osg::Shader vertexShader = new osg::Shader(); vertexShader-setType( osg::Shader::VERTEX ); vertexShader-setShaderSource( vertexSource ); osg::ref_ptr osg::Shader fragmentShader = new osg::Shader(); fragmentShader-setType(
Re: [osg-users] [3rdparty] Qt, Collada OSG
Yeah, trying that now. I had already recompiled the Collada DOM and OSG under MSYS/MinGW. Recompiling QT there now too... We'll see how it goes! Thank you! Cheers, Samuel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31935#31935 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [osgOcean] Light effect in osgOcean
Hello, I am writting an application wich use osgOcean Plugin. I add to an ocean scene a submarine (imported from a 3DS file), and I would like to activate spot lights of this submarine. So I attach to the submarine a light : Code: Vec4f lightPose(0,-1270,0,1); // le kster mesurant1.26mètres (d'après blender et le fichier 3ds), on met la lampe juste devant. m_lumSpotAvant = new Light; m_lumSpotAvant-setLightNum(1); m_lumSpotAvant-setPosition(lightPose); // look downard (pointed on the seabed) m_lumSpotAvant-setDirection(Vec3f(0,0,-1)); m_lumSpotAvant-setSpotCutoff(90.0); m_lumSpotAvant-setSpotExponent(50); m_lumSpotAvant-setConstantAttenuation(0.1); m_lumSpotAvant-setDiffuse(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); m_spotAvant = new LightSource; m_spotAvant-setLight(m_lumSpotAvant); m_spotAvant-setLocalStateSetModes(osg::StateAttribute::ON); m_spotAvant-setStateSetModes(*_rootStateSet,osg::StateAttribute::ON); this-addChild(m_spotAvant); Where _rootStateSet is the StateSet of the OceanScene. There is another light in my scene, created like in the oceanExemple : Code: StateSet* rootStateSet = m_oceanScene-getOrCreateStateSet(); osg::LightSource* lightSource = new osg::LightSource; osg::ref_ptrosg::Light light = lightSource-getLight(); light-setLightNum(0); light-setAmbient( osg::Vec4d(0.3f, 0.3f, 0.3f, 1.0f )); light-setDiffuse( intColor( 191, 191, 191 ,255) ); light-setSpecular(osg::Vec4d( 0.1f, 0.1f, 0.1f, 1.0f ) ); light-setPosition( osg::Vec4f(osg::Vec3f(326.573, 1212.99 ,1275.19), 1.f) ); // point light lightSource-setLocalStateSetModes(osg::StateAttribute::ON); lightSource-setStateSetModes(*rootStateSet,StateAttribute::ON); m_oceanScene-addChild( lightSource ); When I did it, I can't see my spotlight. I tried to do the same thing in a non osgOcean Scene, with the same lights, and that's work... I can see my seabed illuminated by an ambiant light, an area above the spot, illuminated by the spot... So why using an OceanScene disable my lighting effects ?? Best Regards, A. BARRAL -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31936#31936 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] error loading an ive file with OSG 2.8.3
Hi Jean-Sébastien, I tried that but looking at the debug information seems the correct dll is found but it cannot be loaded successfully. FindFileInPath() : USING X:\blablabla\osgplugins-2.8.3\osgdb_ived.dll DynamicLibrary::failed loading osgPlugins-2.8.3\osgdb_ived.dll Any idea? Regards Gianni -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31937#31937 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgOcean] Light effect in osgOcean
Hello Adrien, So why using an OceanScene disable my lighting effects ?? osgOcean uses shaders for most of its effects, and these shaders assume directional lights. You will have to customize the shaders to do the right calculations for all types of light source. This is not a trivial topic and will require you to get acquainted with writing GLSL shaders and also to modify the code of osgOcean and recompile it. To make osgOcean use your customized shaders you have two options. 1. Modify the shaders embedded in the osgOcean source code and recompile osgOcean. 2. Modify the shaders in osgOcean's resource directory and disable the USE_LOCAL_SHADERS define in the osgOcean source code and recompile osgOcean. I've been thinking of removing the USE_LOCAL_SHADERS define in osgOcean. Currently osgOcean will use shaders embedded in its source code if USE_LOCAL_SHADERS==1, and will load shaders from files if it's ==0. I think a more useful way would be to just make it try to load shaders from files (from the current directory, then OSG's data file path list, as is OSG standard) and if they're not found, use the shaders embedded in the source. This will allow apps to easily customize shaders without recompiling by just distributing the shaders with the app, and if they just need the default shaders they can not distribute them and the default ones from the source code will be used, all without recompiling. I'll try to get around to doing this soon. Also I haven't heard from Kim Bale in a very long time, so I may try to make a release of osgOcean soon with the modifications I've made since the last release. It's been a while now. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com 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] [osgPlugins] error loading an ive file with OSG 2.8.3
Hi Gianni, FindFileInPath() : USING X:\blablabla\osgplugins-2.8.3\osgdb_ived.dll DynamicLibrary::failed loading osgPlugins-2.8.3\osgdb_ived.dll Yeah, when it gets to that point OSG doesn't give you much information as to WHY it failed loading the plugin... Did you try doing a profile run in Dependency Walker? It might be able to give you more information as to why that plugin cannot be loaded correctly. Perhaps it's a manifest problem, or something obscure like that... J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com 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] [osgOcean] Light effect in osgOcean
Hi ! Thank for your reply, but that is exacly what I would'nt want to read ! I am affraid about learning gl Shading Language. Do you know some cool resources to learn it ? I have got the OpenGL Super Bible 4th edition, is it enough ? Thanks ! A. BARRAL -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31940#31940 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgOcean] Light effect in osgOcean
Hello Adrien, Thank for your reply, but that is exacly what I would'nt want to read ! I am affraid about learning gl Shading Language. Hehe, sorry about that! But you'll see you can do lots of great things pretty easily once you've learned GLSL. It opens up a great new world. :-) Do you know some cool resources to learn it ? I have got the OpenGL Super Bible 4th edition, is it enough ? I would recommend the OpenGL Shading Language (orange book) by Randi Rost, it has a chapter about replicating OpenGL fixed pipeline in shaders which will be useful to you. Also this site is well done, though some parts are obsolete. http://www.lighthouse3d.com/opengl/glsl/ And you can get ShaderGen (which was made by 3DLabs but is not distributed anymore, but can be downloaded from http://www.mew.cx/glsl/) which can generate shaders that replicate the fixed pipeline. It has a GUI where you select which features you need and then it gives you the corresponding GLSL shader. Though you'll have to be careful to keep the parts that are specific to osgOcean in place when you edit its shaders. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com 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] [osgPlugins] osgdb_ive.dll problem when loading an ive globe in osg app
Hi, I got a (sporadic) MS VC Runtime Error (MS VS 2008, Config RelWithDebugInfo) in OSG 2.9.9 as follows. The file was created with: Code: osgconv abc.dae abc.ive -O compressed Code: osgdb_iverd.dll!ive::DataInputStream::DataInputStream(std::basic_istreamchar,std::char_traitschar * istream=0x0030da6c, const osgDB::Options * options=0x35106238) Line 196 C++ osgdb_iverd.dll!ReaderWriterIVE::readNode(std::basic_istreamchar,std::char_traitschar fin={...}, const osgDB::Options * options=0x35106238) Line 97 C++ osgdb_iverd.dll!ReaderWriterIVE::readNode(const std::basic_stringchar,std::char_traitschar,std::allocatorchar file=abc.ive, const osgDB::Options * options=0x) Line 74 + 0x18 bytes C++ osg66-osgDBrd.dll!osgDB::Registry::ReadNodeFunctor::doRead(osgDB::ReaderWriter rw={...}) Line 791 + 0x24 bytes C++ osg66-osgDBrd.dll!osgDB::Registry::read(const osgDB::Registry::ReadFunctor readFunctor={...}) Line 964 C++ osg66-osgDBrd.dll!osgDB::Registry::readImplementation(const osgDB::Registry::ReadFunctor readFunctor={...}, osgDB::Options::CacheHintOptions cacheHint=CACHE_NODES) Line 1128C++ The line in question is: Code: if (!uncompress(*istream, data)) Hope this helps! Cheers, Florian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31942#31942 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] osgdb_ive.dll problem when loading an ive globe in osg app
Hi, sorry, my reply was probably OT and should be separate topic. Cheers, Florian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31943#31943 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] tessellation shaders supported?
Hi, my want to use the new tessellation control and tessellation evaluation shaders that are new in OpenGL 4. Is there support for them in OSG trunk? I only found VertexProgramm (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osg/VertexProgram.cpp ) and FragmentProgramm ( http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osg/FragmentProgram.cpp ) Also I understand there is another way to create shaders, shown in the geometry shader example (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osggeometryshaders/osggeometryshaders.cpp#L116) . I noted that *new* osg::Shader( osg::Shader::GEOMETRY, geomSource ) actually uses open GL constants (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/include/osg/Shader#L87). Since osg::Shader seams pretty generic is it a good idea to just use the matching GL constant ( something like GL_TESSELLATION_CONTROL_SHADER or so)? I guess my question is: How do I use tessellation shaders with OSG? Best regards Waldemar ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OpenFlight: Reading the Extension Record
Hello all, We would like to store some extra meta-data along with (embedded) in our OpenFlight models. Looking at the OpenFlight spec, there appears to be this thing called an Extension Record that can contain many things, even XML which is what we are interested in. To cut-to-the-chase, does the OpenFlight loader in OSG read in any way these Extension Records or, worse, preclude the reading of the record? I know this is a pretty open question but I'm just starting to dig into this. Any information will be more than I have now, thanks! -B --- Brad Colbert Renaissance Sciences Corporation W: 480 374-5073 x:5073 F: 425 675-8044 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] BIND_PER_PRIMITIVE broken?
Hi Robert, I am now able to set an overall color for otherwise uncolored geometries with your suggested fix. I still don't understand why this is correct. I thought that the setStateSet would set a current color from it's material which is now OSG seemed to behave until 2.9.3. osg::Group *primary = gg.getPrimarySurface(); // This used to specify an overall color for otherwise uncolored geometries. primary-setStateSet( _state.get() ); // Now required to set the overall color directly in the Geode. // Uses the material associated with the state. osg::Geode *gg = dynamic_castosg::Geode*(primary-getChild(0)); if ( gg ) _applyColor( gg, _material-getDiffuse(osg::Material::FRONT_AND_BACK)); ... void Material::_applyColor( osg::Geode *gg, osg::Vec4 color ) { osg::ref_ptrosg::Geode geode = gg; osg::ref_ptrosg::Vec4Array colors = new osg::Vec4Array( 1 ); (*colors)[ 0 ] = color; for ( unsigned int ii=0; iigeode-getNumDrawables(); ii++ ) { osg::Geometry *geom = dynamic_castosg::Geometry*(geode-getDrawable( ii )); geom-setColorArray( colors.get() ); geom-setColorBinding( osg::Geometry::BIND_OVERALL ); } } -Don Robert Osfield wrote: Hi Don, On Tue, Sep 21, 2010 at 12:13 AM, Don Leich d...@ilight.com wrote: I confirmed that the bug persists in today's SVN trunk. In the example already supplied the overall color is not applied when normals are given as BIND_PER_PRIMITIVE. I've just tested svn/trunk and 2.9.3 and can confirm that there is different behaviour. I've also isolated the two geometries that use BIND_PER_PRIMITIVE and they just use this binding for normals, but have no colour array assigned at all. So... they will be inheriting their colour from other geometries in a completely undefined way. This to me doesn't look like a bug at all, but an issue with a under-defined scene graph, and just by luck it's worked before. Please assign colours to all the geometries that need it and then re-test. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] BIND_PER_PRIMITIVE broken?
On Wed, Sep 22, 2010 at 7:13 PM, Don Leich d...@ilight.com wrote: Hi Robert, I am now able to set an overall color for otherwise uncolored geometries with your suggested fix. I still don't understand why this is correct. I thought that the setStateSet would set a current color from it's material which is now OSG seemed to behave until 2.9.3. osg::Group *primary = gg.getPrimarySurface(); // This used to specify an overall color for otherwise uncolored geometries. primary-setStateSet( _state.get() ); That only sets a color if the color mode of the material is OFF. That is the default for Material; perhaps you've set it to something different in the material that's in _state? // Now required to set the overall color directly in the Geode. // Uses the material associated with the state. osg::Geode *gg = dynamic_castosg::Geode*(primary-getChild(0)); if ( gg ) _applyColor( gg, _material-getDiffuse(osg::Material::FRONT_AND_BACK)); ... void Material::_applyColor( osg::Geode *gg, osg::Vec4 color ) { osg::ref_ptrosg::Geode geode = gg; osg::ref_ptrosg::Vec4Array colors = new osg::Vec4Array( 1 ); (*colors)[ 0 ] = color; for ( unsigned int ii=0; iigeode-getNumDrawables(); ii++ ) { osg::Geometry *geom = dynamic_castosg::Geometry*(geode-getDrawable( ii )); geom-setColorArray( colors.get() ); geom-setColorBinding( osg::Geometry::BIND_OVERALL ); } } It's always a good idea to set a color for a geometry unless you're sure that your materials' color modes are OFF. Tim -Don Robert Osfield wrote: Hi Don, On Tue, Sep 21, 2010 at 12:13 AM, Don Leich d...@ilight.com wrote: I confirmed that the bug persists in today's SVN trunk. In the example already supplied the overall color is not applied when normals are given as BIND_PER_PRIMITIVE. I've just tested svn/trunk and 2.9.3 and can confirm that there is different behaviour. I've also isolated the two geometries that use BIND_PER_PRIMITIVE and they just use this binding for normals, but have no colour array assigned at all. So... they will be inheriting their colour from other geometries in a completely undefined way. This to me doesn't look like a bug at all, but an issue with a under-defined scene graph, and just by luck it's worked before. Please assign colours to all the geometries that need it and then re-test. Robert. ___ 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] OpenFlight: Reading the Extension Record
Check the source code. If I recall correctly, the loader reads in comment records and stores them as UserData in the scene graph, but I'm not sure about extension records. The only way to know for certain is to check the source. -Paul Brad Colbert wrote: Hello all, We would like to store some extra meta-data along with (embedded) in our OpenFlight models. Looking at the OpenFlight spec, there appears to be this thing called an Extension Record that can contain many things, even XML which is what we are interested in. To cut-to-the-chase, does the OpenFlight loader in OSG read in any way these Extension Records or, worse, preclude the reading of the record? I know this is a pretty open question but I'm just starting to dig into this. Any information will be more than I have now, thanks! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Efficient representation of triangulation.
Hi, in my application I have a numerical module that create 3d objects and their meshing (triangulation). What I would like to do is to render these objects in the fastest possible way. Something like: - write in a raw array the list of the vertex of the triangles - tell to OSG to read (and render) that memory area Is this possible? Where could I find documentation about this? (I searched in the forum, but I didn't find anything useful). Thank you! Cheers, Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31944#31944 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] tessellation shaders supported?
Hi, VertexProgram/FragmentProgram are for the older assembly-level programmability with ARB VP/FP. osg::Shader is for the newer GLSL programming interface. osg::Shader would be the place to add support for new GLSL shader stages such as tessellation. cheers -- mew -- Mike Weiblen -- Black Hawk, Colorado USA -- http://mew.cx/ On Wed, Sep 22, 2010 at 11:05 AM, Waldemar Schwan waldemar.sch...@iais.fraunhofer.de wrote: Hi, my want to use the new tessellation control and tessellation evaluation shaders that are new in OpenGL 4. Is there support for them in OSG trunk? I only found VertexProgramm (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osg/VertexProgram.cpp ) and FragmentProgramm ( http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osg/FragmentProgram.cpp ) Also I understand there is another way to create shaders, shown in the geometry shader example (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osggeometryshaders/osggeometryshaders.cpp#L116) . I noted that *new* osg::Shader( osg::Shader::GEOMETRY, geomSource ) actually uses open GL constants (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/include/osg/Shader#L87). Since osg::Shader seams pretty generic is it a good idea to just use the matching GL constant ( something like GL_TESSELLATION_CONTROL_SHADER or so)? I guess my question is: How do I use tessellation shaders with OSG? Best regards Waldemar ___ 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] OpenFlight: Reading the Extension Record
Paul, Thanks for the quick reply. I've looked through the source and find a lot of references to Extension but doubt that is what it's for. I was hoping to catch the eye of the author here. -B P.S. One example, I think may or may not be close: Document.cpp:void Document::pushExtension() Document.cpp:OSG_WARN No current primary in Document::pushExtension(). std::endl; Document.cpp:void Document::popExtension() Document.cpp:OSG_WARN Can't decide primary in Document::popExtension(). std::endl; Document.h:// Extension stack Document.h:void pushExtension(); Document.h:void popExtension(); -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users- boun...@lists.openscenegraph.org] On Behalf Of Paul Martz Sent: Wednesday, September 22, 2010 10:35 AM To: OpenSceneGraph Users Subject: Re: [osg-users] OpenFlight: Reading the Extension Record Check the source code. If I recall correctly, the loader reads in comment records and stores them as UserData in the scene graph, but I'm not sure about extension records. The only way to know for certain is to check the source. -Paul Brad Colbert wrote: Hello all, We would like to store some extra meta-data along with (embedded) in our OpenFlight models. Looking at the OpenFlight spec, there appears to be this thing called an Extension Record that can contain many things, even XML which is what we are interested in. To cut-to-the-chase, does the OpenFlight loader in OSG read in any way these Extension Records or, worse, preclude the reading of the record? I know this is a pretty open question but I'm just starting to dig into this. Any information will be more than I have now, thanks! ___ 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] OpenFlight: Reading the Extension Record
Hi Brad -- The original author of the importer isn't around these days, though he does make an occasional rare appearance. I wrote the exporter half of the plugin. Looks like PrimaryRecords.cpp has a class, Extension, for processing an Extension record, but it doesn't appear to parse/save any of the data. Looks like it just creates a Group node and assigns it the name from the extension record, then returns. You would probably want to add some code here to handle the extension record contents the way that you require. The code you quoted below pertains to handling the PushExtension and PopExtension control records, which is only tangentially related to Extension records themselves. -Paul Brad Colbert wrote: Paul, Thanks for the quick reply. I've looked through the source and find a lot of references to Extension but doubt that is what it's for. I was hoping to catch the eye of the author here. -B P.S. One example, I think may or may not be close: Document.cpp:void Document::pushExtension() Document.cpp:OSG_WARN No current primary in Document::pushExtension(). std::endl; Document.cpp:void Document::popExtension() Document.cpp:OSG_WARN Can't decide primary in Document::popExtension(). std::endl; Document.h:// Extension stack Document.h:void pushExtension(); Document.h:void popExtension(); -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users- boun...@lists.openscenegraph.org] On Behalf Of Paul Martz Sent: Wednesday, September 22, 2010 10:35 AM To: OpenSceneGraph Users Subject: Re: [osg-users] OpenFlight: Reading the Extension Record Check the source code. If I recall correctly, the loader reads in comment records and stores them as UserData in the scene graph, but I'm not sure about extension records. The only way to know for certain is to check the source. -Paul Brad Colbert wrote: Hello all, We would like to store some extra meta-data along with (embedded) in our OpenFlight models. Looking at the OpenFlight spec, there appears to be this thing called an Extension Record that can contain many things, even XML which is what we are interested in. To cut-to-the-chase, does the OpenFlight loader in OSG read in any way these Extension Records or, worse, preclude the reading of the record? I know this is a pretty open question but I'm just starting to dig into this. Any information will be more than I have now, thanks! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Load texture in *.obj
Hi, I'm loading a sphere with texture that was created in Maya. In osg only a black sphere. Why? Code for laoding texture: Code: osg::Image* image = osgDB::readImageFile( neptune2.jpg ); if ( image ) { osg::Texture2D* tex2d = new osg::Texture2D;//( image ); tex2d-setImage(image); tex2d-setDataVariance(osg::Object::DYNAMIC); ballNode-getOrCreateStateSet()-setTextureAttributeAndModes( 0, tex2d, osg::StateAttribute::ON); } if (!image) { std::cout Couldn't load texture. std::endl; return NULL; } Thank you! Cheers, John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31953#31953 attachment: 2010-09-23_020655.png___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Particle in shader get/set geometry [SEC=UNCLASSIFIED]
Cool, thanks Robert. May have to keep an eye on the latest dev release page from now on. Regards. On 09/22/2010 06:26 PM, Robert Osfield wrote: Hi Paul, In the OpenSceneGraph-2.9.9 dev release, and svn/trunk there is work by Wang Rui on osgParticle this provides support for using shaders with particles systems, there is also an example osgparticleshader that will illustrate how to use it. Robert. On Wed, Sep 22, 2010 at 5:49 AM, Paul Pocock paul.poc...@dsto.defence.gov.au wrote: Hi -just a quick one - Im delving into osg::Particle at the moment and I wish to do some glsl processing on the geometry or whatever particle template is used. Is this trivial ? and is there a way to set/get the drawables in an osg Particle system? Regards IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email. ___ 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
Re: [osg-users] Load texture in *.obj
On 23/09/10 8:10 , John Kush wrote: I'm loading a sphere with texture that was created in Maya. In osg only a black sphere. Why? Based on the absence of more information I'd suspect that the model doesn't have proper texture coordinates assigned. Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org