Re: [osg-users] [osgPlugins] png plugin - problem loading images
Hi, You are saying that you built OSG from sources. Are you completely sure that you set up PNG_LIBRARY and PNG_PNG_INCLUDE_DIR ? Because if you don't, osg_png plugin won't compile. Cheers, Filip -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44180#44180 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Color in ShapeDrawable
Hi, in OpenGL if GL_LIGHTING is disabled, the final color of polygon is determined by glColor. If you see ShapeDrawable::drawImplemenation(), there is glColor call. Code: osg::State state = *renderInfo.getState(); GLBeginEndAdapter gl = state.getGLBeginEndAdapter(); if (_shape.valid()) { gl.Color4fv(_color.ptr()); / - DrawShapeVisitor dsv(state,_tessellationHints.get()); _shape-accept(dsv); } Cheers, Filip[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44181#44181 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Antialiasing Text
Hi, How I can implement text without anti-aliasing. If I zoom too close, it looks horrible. Than you, Cheers, Filip -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44182#44182 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Color in ShapeDrawable
Yes, which is what I wrote: What is the idea behind having a color in ShapeDrawable? I cant see any reason why there would be a color associated to a shape? Create a triangle, and by the way, its red. That was my question. So if you WOULD like to control the color by disabling light and use diffuse, it will not work. It will be white (due to the call in ShapeDrawable). Anyway, there are ways around this. I just thought it was very inconsistent to associate a color to a ShapeDrawable. /Anders On Fri, Dec 2, 2011 at 9:53 AM, Filip Arlet fili...@seznam.cz wrote: Hi, in OpenGL if GL_LIGHTING is disabled, the final color of polygon is determined by glColor. If you see ShapeDrawable::drawImplemenation(), there is glColor call. Code: osg::State state = *renderInfo.getState(); GLBeginEndAdapter gl = state.getGLBeginEndAdapter(); if (_shape.valid()) { gl.Color4fv(_color.ptr()); / - DrawShapeVisitor dsv(state,_tessellationHints.get()); _shape-accept(dsv); } Cheers, Filip[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44181#44181 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- __ Anders Backman, HPC2N 90187 Umeå University, Sweden and...@cs.umu.se http://www.hpc2n.umu.se Cell: +46-70-392 64 67 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Opaque black shadows since moving to OSG V3.0.1
Hi, Guys, I think I see the reason why Robert commented it. For spotlights ambient factor should be attenuated with distance from light. It would be hard to compute attenuation in frag shader without assistance of vertex shader. I would bet it would be possible but very tricky, though. Anyway, IMHO when that line is commented its worse because such ambient factor is both wrong for directional and spot lights. That issue again proves that there is no silver bullet for shadow technique shaders. Depending on what your app does you may need different set of shaders, if not whole technique. So maybe you guys should consider passing in your own shaders (copied from 2.8 version) to make that look right again... Cheers, Wojtek Lewandowski 2011/12/1 Wojciech Lewandowski w.p.lewandow...@gmail.com Hi, Michael, Well, then I guess addition of gl_FrontLightProduct[0] should be uncomented. And thats a missing piece of the puzzle... SVN Blame shows that Robert commented it in 12737 rev on 29th of July. I guess its time to ask Robert what to do with this. Cheers, WL 2011/12/1 Michael Guerrero mjgue...@nps.edu Hi Wojtek, It certainly did seem as though I completely missed the addition with gl_FrontLightProduct[0].ambient. Unfortunately what happened was that after I copy/pasted it in the message I removed the quotes around it and more importantly the comment characters //. Here is a link to the file in question: http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/tags/OpenSceneGraph-3.0.1/src/osgShadow/StandardShadowMap.cpp FYI, that piece of code looks the same on the trunk: http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osgShadow/StandardShadowMap.cpp -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44170#44170 ___ 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] Change for need to redraw scene
Hello OSG-Users, (I'm writing a display application, using osgviewerQt) I'm looking for a way to check, whether I need to redraw the scene to skip a redraw, if would be the same as the previous (fixed image). Or is this already done by osg-library? I figured, I only need a redraw, if a) Camera changes (position, field of view) b) scene changes (geometry changes, color changes) Unfortunately my first guesses and web searches were not successful, e.g. I saved the cameras ViewMatrix ( getCamera()-getViewMatrix() ) after a call of frame() to compare it to the current before the next call of frame(). Oddly the seem to change every time, even though the Viewer showed a fixed image. Can anyone point me to a direction and offer hints, to how I can achieve this? Am I carrying coals to Newcastle, since OSG would already be doing this and/or I only forgot to set a flag? Thanks in advance and sunny greetings Hartmut -- frag nicht - du könntest eine antwort erhalten NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] starting with stencil buffer to achieve ray tracing
thank you filip! this might just be what i was looking for :) but i'm getting OpenGL errors here ... Code: Warning: detected OpenGL error 'invalid operation' at end of SceneView::draw() Warning: detected OpenGL error 'invalid operation' at start of State::apply() the letter one keeps piling up as the app runs. i wrote this code into the main function just before calling the optimizer and viewer.run(); Code: osg::ref_ptrosg::Group rootNode = new osg::Group; { osg::Stencil* stencil = new osg::Stencil; stencil-setFunction(osg::Stencil::ALWAYS, 1, ~0u); stencil-setOperation(osg::Stencil::ZERO, osg::Stencil::ZERO, osg::Stencil::REPLACE); osg::StateSet* ssb1 = new osg::StateSet(); ssb1-setMode(GL_CULL_FACE, osg::StateAttribute::OFF); ssb1-setAttributeAndModes(stencil, osg::StateAttribute::ON); rootNode-setStateSet(ssb1); } rootNode-addChild(loadedModel.get()); viewer.getCamera()-setPostDrawCallback(new PostDrawCallback()); and then the callback Code: class PostDrawCallback : public osg::Camera::DrawCallback { virtual void operator () (osg::RenderInfo renderInfo) const { osg::ref_ptrosg::Image img = new osg::Image; osg::View *view = renderInfo.getView(); int width = view-getCamera()-getViewport()-width(); int height = view-getCamera()-getViewport()-height(); img-readPixels(0, 0, width, height, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE); } }; if i comment out the readpixels method, the errors do not apear. what am i missing [Question] [Arrow] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44186#44186 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Change for need to redraw scene
Hi, for redrawing, call function requestRedraw() on View(er) you want to redraw. I suppose you are changing the scene by yourself. If you want redraw on demand, other than calling frame by yourself use osgViewer::Viewerbase::setRunFrameScheme(ON_DEMAND); In QtViewer example there's QTimer for redrawing, but it calls frame() every tick. If you want redraw on demand, see fuction osgQt::setViewer() or use this: Code: if( viewer-checkNeedToDoFrame() ) { viewer-frame(); } Btw. comparing two matrices of doubles has to be done with epsilon delta, because of precision problems. Cheers, Filip -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44187#44187 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] starting with stencil buffer to achieve ray tracing
Hi, The most simple thing that could it be is this: did you set up stencil buffer by calling osg::DisplaySettings::instance()-setMinimumNumStencilBits(); or creating context with stencil buffer? Cheers, Filip -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44188#44188 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] starting with stencil buffer to achieve ray tracing
filip, that line of code solved the problem! thank you so much! now i have to bend the code i have a bit for my purpose. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44189#44189 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transformation matrix explanation
Hi, I would like to thank you for your answers. Especially for the website Skylark , it really got me started on the subject. I will definitely search more info on the 4x4 matrix. Now about the distances I admit that I wasn't clear :). I need the distance from the camera to the center of a given 3d model(OSG Node). For the position of the 3D model I would like to use the function getTransformationMatrix() of the node. Is it possible to use getTransformationMatrix on the camera node? Then I would use the method that Skylark suggested and my problem will be solved. As for scale, as far as I know my models are not scaled in runtime. Thank you for your time!! Stefanos Cheers, Stefanos -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44190#44190 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Draw line in 3D screen
Hi, I am loading a large number of 3D points (X, Y, Z) on OSG. I want to draw line on screen not necessarily passing through loaded points. I am using osgUtil::PolytopeIntersector but it draws lines which essentially pass through loaded points. What can be done to draw line by movement of mouse dynamically anywhere in screen, i.e. could have its nodes on the loaded points and as well on the area where there are no loaded points. Thank you! Cheers, Lalit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44191#44191 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transformation matrix explanation
On 12/2/2011 6:09 AM, Stefanos Kougiou wrote: Hi, I would like to thank you for your answers. Especially for the website Skylark , it really got me started on the subject. I will definitely search more info on the 4x4 matrix. Now about the distances I admit that I wasn't clear :). I need the distance from the camera to the center of a given 3d model(OSG Node). For the position of the 3D model I would like to use the function getTransformationMatrix() of the node. Is it possible to use getTransformationMatrix on the camera node? Then I would use the method that Skylark suggested and my problem will be solved. As for scale, as far as I know my models are not scaled in runtime. If you multiply the object center by the camera's modelview matrix, the length of the resulting eye space vector is the distance. I strongly encourage you to learn OpenGL. Get the OpenGL Programming Guide. Older copies are available online for free, and they cover topics such as these. -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ffmpeg memory leak
Nevermind... I decided to get a second opinion and installed Visual Leak Detector for VS2010 and it tells me there are no leaks. Cheers, Sean -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44192#44192 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Color in ShapeDrawable
Hi Jason, On Fri, Dec 2, 2011 at 11:30 AM, Jason Daly jd...@ist.ucf.edu wrote: I don't understand what you mean here. If you disable lighting, material colors are irrelevant. The ShapeDrawable's colors are the ONLY way to set the color. That's actually not the case with OSG. If you look at the source for osg::Material, you will notice it calls glColor with one of the material colors (depending on the color mode). This means you can use osg::Material to control the color of geometry even when lighting is disabled. If ShapeDrawable did not call glColor, it would be possible to use osg::Material to control the color with lighting disabled. At the very least, I think there should be an option to have ShapeDrawable inherit the color. I don't see anything wrong with having such an option and I'm sure Robert would accept a patch for it. Cheers, Farshid I'm not sure what's inconsistent about it. It behaves like any other OpenGL geometry. As Filip indicated, the color only applies if lighting is disabled. When you disable lighting, no lighting calculations are done, and material colors become irrelevant, just as they do with any OpenGL rendering when lighting is disabled. Only the geometry color is used. If you want an unlit red cube, this is how you'd do it. When lighting is enabled, the material can be set to either ignore the geometry colors: material-setColorMode(osg::Material::OFF); or to use the geometry colors as one of the material colors: material-setColorMode(osg::Material::DIFFUSE); (for example) It's your choice how you want to apply the material. --J ___ 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] Color in ShapeDrawable
On 12/02/2011 03:18 PM, Farshid Lashkari wrote: Hi Jason, On Fri, Dec 2, 2011 at 11:30 AM, Jason Daly jd...@ist.ucf.edu mailto:jd...@ist.ucf.edu wrote: I don't understand what you mean here. If you disable lighting, material colors are irrelevant. The ShapeDrawable's colors are the ONLY way to set the color. That's actually not the case with OSG. If you look at the source for osg::Material, you will notice it calls glColor with one of the material colors (depending on the color mode). This means you can use osg::Material to control the color of geometry even when lighting is disabled. My mistake, I didn't realize that. I guess I've never hit that use case before. --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport script can't be enabled
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, use the zip file inside https://github.com/cedricpinson/osgexport/tree/master/blender-2.5/build/ And install it on blender 2.6 with the function install addons in the user preference. Cedric On 12/02/2011 10:50 PM, Nate Hopkins wrote: Hi Cedric, I cannot enable your osgexport script for blender. The enable box can't be checked. To install, I placed the the contents of the exporter folder (osg folder and osgExport.py) in C:\Users\hopkins\AppData\Roaming\Blender Foundation\Blender\.blender\scripts. I tried Blender 2.60 and 2.59, both 64 bit. I am running Windows 7 64bit. Any help would be appreciated. -Nate - -- Cedric Pinson Provide OpenGL, WebGL and OpenSceneGraph services +33 659 598 614 - cedric.pin...@plopbyte.com http://plopbyte.com - http://osgjs.org - http://showwebgl.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7ZawEACgkQs6ZHzVQN0IgfXACgjN2ysMDCpdlu0o46ulE5LAQt VVEAnjWD3tSwsdgk3UdiUtT9kqVbhdw4 =SNBw -END PGP SIGNATURE- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport script can't be enabled
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Using 'install addons' should install it in the good place. Anyway if you run blender from command line it should write on it what's wrong, can you send the log please ? Cedric On 12/03/2011 02:34 AM, Nate Hopkins wrote: It still dosn't work. The new osgExport.py is identical to the old one. -Nate On Fri, Dec 2, 2011 at 4:19 PM, Cedric Pinson cedric.pin...@plopbyte.com mailto:cedric.pin...@plopbyte.com wrote: Hi, use the zip file inside https://github.com/cedricpinson/osgexport/tree/master/blender-2.5/build/ And install it on blender 2.6 with the function install addons in the user preference. Cedric On 12/02/2011 10:50 PM, Nate Hopkins wrote: Hi Cedric, I cannot enable your osgexport script for blender. The enable box can't be checked. To install, I placed the the contents of the exporter folder (osg folder and osgExport.py) in C:\Users\hopkins\AppData\Roaming\Blender Foundation\Blender\.blender\scripts. I tried Blender 2.60 and 2.59, both 64 bit. I am running Windows 7 64bit. Any help would be appreciated. -Nate - -- Cedric Pinson Provide OpenGL, WebGL and OpenSceneGraph services +33 659 598 614 - cedric.pin...@plopbyte.com http://plopbyte.com - http://osgjs.org - http://showwebgl.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7ZhLcACgkQs6ZHzVQN0Ihm9ACgm3mbzLYyFNNGK5oGZa1fKdPE 99YAoI/R/0H1jOgTQrcMN4xq5im3TXXm =0H2l -END PGP SIGNATURE- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgexport script can't be enabled
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 To install last version of the exporter go in user preference, then 'install addons' with the zip file inside blender-2.5/build/ (https://github.com/cedricpinson/osgexport/blob/master/blender-2.5/build/osgexport-0.9.0.zip) user the zip with 'install addon' install addons works only with zip or single file. In our case it's the zip. Cedric On 12/03/2011 03:39 AM, Nate Hopkins wrote: I first copy the osg folder and osgExport.py to: C:\Users\hopkins\AppData\Roaming\BlenderFoundation\Blender\.blender\scripts Next, I use install addons buttons in preferences, navigate to the path above, select osgExport.py and click install Addon. The addon shows up but I am unable to check the enable box for it. How do you run blender from the command line? Thank you. -Nate On Fri, Dec 2, 2011 at 6:08 PM, Cedric Pinson cedric.pin...@plopbyte.com mailto:cedric.pin...@plopbyte.com wrote: Using 'install addons' should install it in the good place. Anyway if you run blender from command line it should write on it what's wrong, can you send the log please ? Cedric On 12/03/2011 02:34 AM, Nate Hopkins wrote: It still dosn't work. The new osgExport.py is identical to the old one. -Nate On Fri, Dec 2, 2011 at 4:19 PM, Cedric Pinson cedric.pin...@plopbyte.com mailto:cedric.pin...@plopbyte.com mailto:cedric.pin...@plopbyte.com mailto:cedric.pin...@plopbyte.com wrote: Hi, use the zip file inside https://github.com/cedricpinson/osgexport/tree/master/blender-2.5/build/ And install it on blender 2.6 with the function install addons in the user preference. Cedric On 12/02/2011 10:50 PM, Nate Hopkins wrote: Hi Cedric, I cannot enable your osgexport script for blender. The enable box can't be checked. To install, I placed the the contents of the exporter folder (osg folder and osgExport.py) in C:\Users\hopkins\AppData\Roaming\Blender Foundation\Blender\.blender\scripts. I tried Blender 2.60 and 2.59, both 64 bit. I am running Windows 7 64bit. Any help would be appreciated. -Nate - -- Cedric Pinson Provide OpenGL, WebGL and OpenSceneGraph services +33 659 598 614 - cedric.pin...@plopbyte.com http://plopbyte.com - http://osgjs.org - http://showwebgl.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7ZjKsACgkQs6ZHzVQN0IimKwCfdtVjC6yPi4gxfmsbJaD7Gr3s KV8AnAox7/TV8to4nz4VWUgaX247UVis =2d75 -END PGP SIGNATURE- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] (no subject)
Hi Everyone, I'm trying to implement a fairly dense forested area and simply adding in a bunch of osg::MatrixTransform nodes predictably causes the cull to crash. I could try reorganizing the scene around an oct-tree as was suggested by a previous discussion on this topic, but for draw performance reasons, since each tree is the same model, I would like to use the new draw instanced arb. I see that osgdrawinstanced has been referenced in many similar threads, but osgdrawinstanced creates its geometry on the fly, and in doing so can quite easily use the command syntax for instancing. I am trying to apply the technique to a loaded model and there is no obvious easy method. My question is this, if I load a file using osgDB::readNodeFile(somefile.osg); How would I set it up for instanced drawing? My guess is that I would need to write a node-visitor that collects all of the geometry - drawables and sets them up to use the instanced call overload instead of the default. I have tried doing this, but my implementation has gotten pretty complex, and I want to make sure there isn't a more simple way I have overlooked. Thank you very much for your time. Michael A Bosse' ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Draw Instanced Help
Hi Everyone, Sorry, the last copy of this went out without a subject. Please disregard, it has been a long day. I'm trying to implement a fairly dense forested area and simply adding in a bunch of osg::MatrixTransform nodes predictably causes the cull to crash. I could try reorganizing the scene around an oct-tree as was suggested by a previous discussion on this topic, but for draw performance reasons, since each tree is the same model, I would like to use the new draw instanced arb. I see that osgdrawinstanced has been referenced in many similar threads, but osgdrawinstanced creates its geometry on the fly, and in doing so can quite easily use the command syntax for instancing. I am trying to apply the technique to a loaded model and there is no obvious easy method. My question is this, if I load a file using osgDB::readNodeFile(somefile.osg); How would I set it up for instanced drawing? My guess is that I would need to write a node-visitor that collects all of the geometry - drawables and sets them up to use the instanced call overload instead of the default. I have tried doing this, but my implementation has gotten pretty complex, and I want to make sure there isn't a more simple way I have overlooked. Thank you very much for your time. Michael A Bosse' ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Draw Instanced Help
Hi Michael, How would I set it up for instanced drawing? My guess is that I would need to write a node-visitor that collects all of the geometry - drawables and sets them up to use the instanced call overload instead of the default. I have tried doing this, but my implementation has gotten pretty complex, and I want to make sure there isn't a more simple way I have overlooked. You've got the right idea for the general way to apply instanced rendering for complex objects. But you can simplify usage by making your model simpler. Draw instanced will work really well if your model consists of a single primitiveset. So ideally you'll have your modeler create the tree in a single geometry with a single primitiveset. They can make a texture atlas so that the same texture file applies to the whole geometry, and then merge all the geometry into a single one. If this is not possible, you can try using the osgUtil::Optimizer to do this for you as a pre-process. Using the artist's model as input, you would apply the SHARE_DUPLICATE_STATE, FLATTEN_STATIC_TRANSFORMS, MERGE_GEODES, MERGE_GEOMETRY, VERTEX_PRETRANSFORM, VERTEX_POSTTRANSFORM, INDEX_MESH and possibly TEXTURE_ATLAS_BUILDER optimizers on it. I use this combination on all models by the way, in combination with a few custom visitors it does wonders to cull and draw times. What these will do: TEXTURE_ATLAS_BUILDER: Will merge many small textures into a single larger one, adjusting texture coordinates, which can then be shared by all those nodes. An artist-created texture atlas is better though, I've seen cases where the texture atlas builder in OSG will create a really large texture and use less than half the space in it, and other such inefficiencies. A human will also be better equipped to judge of the qualitative criteria in making some textures smaller thus fitting more textures into a single atlas. SHARE_DUPLICATE_STATE: Make sure identical state is shared (uses the same pointer to the same object) instead of having multiple state attributes with the same value throughout your model. You might have to write a small visitor to help this optimizer a bit, essentially normalizing all state that your modeling tool might set differently from what you expect, but which has no effect on the final output. For example you could force all geometry to single sided, etc. The idea is to make sure the next steps will be able to merge as much as possible. FLATTEN_STATIC_TRANSFORMS: Remove any transforms that are marked as static data variance. You might have to make a small visitor that will change the data variance to static on any transforms that you don't really need. Modeling programs have a tendency to put lots of transforms all over the place (in Maya for example, there are no groups, everything is a transform, even graph leaves are a transform plus a geometry...). Again this will make the next steps work more efficiently, because things that are separated by a transform can't be merged together. You might want to write another simple visitor that would remove unnecessary Group nodes. Once again things that are separated by a Group can't be merged together. MERGE_GEODES, MERGE_GEOMETRY: Merge as many scene graph leaves together as possible. Again this will make the next steps work more efficiently. Note that the MERGE_GEODES optimizer in OSG has a pretty serious design flaw, it will only merge Geodes whose direct parent is a Group, and not any Group subclass. Sure, merging the children of an LOD node or Switch node is bad, but there are plenty of other subclass es of Group where it makes no difference. So I just subclassed the MergeGeodesVisitor so it checks the actual type of the parent, doesn't merge if it's certain types of Group subclasses (like LOD or Switch) but merges in all other cases. VERTEX_PRETRANSFORM, VERTEX_POSTTRANSFORM, INDEX_MESH: This is a powerful trio of optimizers that will turn DrawArrays into DrawElements optimized for the GPU's cache, and merge all primitivesets under a Geometry together. After this, you might want to run the MERGE_GEODES and MERGE_GEOMETRY optimizers again, as they will be able to merge even more things together. So anyways, I described why you would want to use the various optimizers for general models, but for your trees the goal is to end up with a single Geometry which has a single primitiveset. Then your job of doing instanced drawing of this tree becomes much easier. And again, if you can get your artist / modeler to make the model with this in mind, all the better. In general, if you can massage the data in order to make the code simpler, it's normally a win in the long run. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/