[osg-users] Geode, Geometry, glCallList, glMultMatrix and so on :)

Robert Osfield robert.osfield at gmail.com
Sun Mar 15 09:03:49 PDT 2009


HI Benoit,

The way I'd tackle this task would be as first pass just create a
scene graph in the most straight forward way possible, just to get it
up a rendering.  This may well by composing the scene front
Matrix|Transform, Geode, simple Geometry leaves.

The next step would then be to write a custom node that is subclass
from osg::Group that provides an interface specific to the parameters
that you are playing with, and add a method into this class that
generates the scene graph to represent your object.

Then the next step would be to write an alternative rendering path
that uses custom shaders/geometry combination that replaces all the
separate MatrixTransforms/Geode/Geometry with a much smaller set of
geometries that move the transforms into a specialist vertex program.
 The OpenGL draw instanced extension could well come in useful here.
This new rendering path would perform far better than original route
of creating a large scene graph composed of fine grained elements, as
it could avoid heavy CPU overhead associated with handling scenes with
tens of thousands for transform nodes.

A final step would be to automatically generate LOD'd subgraph for
your custom Node that would allow load balancing for when you have
many thousands of objects in your scene.

The osgforest example gives a little bit of an illustration of use of
shaders to place very basic trees, and the osgdrawinstanced example
gives an example of the draw instanced example in action.  As some
point I'd like to add another path into osgforest for using draw
instanced, which would then be an even better route.

Longer term I'd love to see an OSG node kit dedicated to rendering
grass + trees, others are welcome to dive in and develop such a
library :-)

Robert.

On Sun, Mar 15, 2009 at 10:33 AM, Quanteek <osgforum at tevs.eu> wrote:
> Hey Robert,
>
> You're right.
>
> So my application is a plant generator.
>
> A plant is composed by elementary units called "metamers". A metamer is a container which has an internode (typically a cylinder for trees for making the branches) and a leaf (well, a leaf like in real life :p).
>
> In input of my software I have got a big graph (tree) of bases (so direction and origins) and also what I call a pattern file which has the basic shape for an internode or a leaf.
>
> Typically I load my pattern file into an osg::Geometry.
>
> Thanks to theses bases I compute all basic geometries into all theses bases.
>
> For example if my axe has 10 internodes I will have :
>
> 10;9;8;7;6;5;4;3;2;1
>
> and each number is a cylinder and each of them would be an osg::Geometry. Here you see that if my tree is about 200 axes it could be very heavy in term of memory.
>
> Same thing for the leaves if I have got 1000 of them into my tree I will have 1000 osg::Geometry into one geode.
>
> So my osg graph is for the moment composed by two osg::Geode one for axes and one for leaves because Material will change between them.
>
> My main problem is the export into Collada file with DAE plugin(for the moment performance is acceptable but I think VBO could be a great thing but didn't think about it now). The file is for a little tree about 15 Mo and I cannot import it into Blender or Swirl.
>
> So I am wondering where I am wrong. For the moment I have all geometry which is explicit. All entities have been calculated into its place and store into an osg::Geometry. Apparently you are not recommanding to use MatrixTransform and call an unique osg::Geometry (the pattern) ?
> Does the trick with "chunck of geometries" is dumping a whole axe into one osg::Geometry (with the example upon it would be 10;9;8;7;6;5;4;3;2;1 a single osg::Geometry) ?
> --
> Benoît Bayol
> benoit.bayol at gmail.com
>
> ------------------------
> --
> Benoît Bayol
> benoit.bayol at gmail.com
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=8496#8496
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list