[osg-users] Offscreen rendering with multisampling

Wojciech Lewandowski w.p.lewandowski at gmail.com
Fri Dec 9 03:21:29 PST 2016


Well...If you don't need too big resolution, you may try to simply
oversample. Set PBUFFER at 2x or 4x of your desired res. Render and then
downsample to your image res. Multisampling does not differ much from it
(it just more effective with lower number of samples and its randomized
sample positions).

Cheers,
Wojtek


2016-12-09 11:46 GMT+01:00 Krzysztof Rahn <
Krzysztof.Rahn+OpenSceneGraph at gmail.com>:

>
> Wojtek wrote:
> > Hi Krzysztof,
> >
> > Not sure about PBO but FBO support in OSG works with multisampling.
> > See
> >
> >
> >
> > Camera::attach(
> >   BufferComponent buffer,
> >   osg::Texture* texture,
> >   unsigned int level,
> >   unsigned int face,
> >   bool mipMapGeneration,  unsigned int multisampleSamples,
> >   unsigned int multisampleColorSamples)
> >
> >
> > method.
> >
> >
> > Cheers,
> >
> > Wojtek Lewandowski
> >
> >
> > 2016-12-09 11:01 GMT+01:00 Krzysztof Rahn <Krzysztof.Rahn+
> (Krzysztof.Rahn+)>:
> >
> > > Hello everyone,
> > >
> > > I'm working on a company project that displays navigation maps for
> ships with OpenSceneGraph.
> > > The product we develop is a library that generates map images, so a
> customer (developer)
> > > can use our library to develop its own navigation system.
> > >
> > > This requires to generate a offscreen image and if possible an
> antialiased one.
> > > Unfortunately we can not generate a antialiased offscreen image.
> > >
> > > I already tried
> > >
> > > > osg::DisplaySettings::instance()->setNumMultiSamples(4);
> > > >
> > >
> > > and
> > >
> > > > traits->samples = 4;
> > > >
> > >  to create a osg::GraphicsContext
> > > but this only works with a window generated from OpenSceneGraph or
> > > with a embedded context (osgViewer::GraphicsWindowEmbedded()).
> > >
> > > I know we can enable "GL_LINE_SMOOTH". This is what we use at this
> moment and it is
> > > working with offscreen rendering but we really need multisampling for
> better results (or any other form of anitaliasing).
> > >
> > > I created a small peace of C++ sourcecode on a Linux system that does
> offscreen rendering (with a pbuffer)
> > > into a tga image file (I think you also need OpenSceneGraph plugins
> for that to work),
> > > so you can roughly see how we use it at this moment (without
> GL_LINE_SMOOTH to keep it simple).
> > >
> > > Of course I looked into the examples and this peace of code is based
> of one of them.
> > > But I could not spot anything in the examples that could help me.
> > > I also searched in the forum on this topic but most threads about
> offscreen rendering don't consider if multisampling is enabled.
> > >
> > > I would really appreciate if someone could help us with this small
> code in the right direction
> > > or make any suggestion if there is any other way to solve this if
> OpenSceneGraph is not able to do this.
> > >
> > > A main.cpp and a CMakeLists.txt should be attached to this post.
> > >
> > > Thank you very much,
> > >   Kris
> > >
> > > ------------------
> > > Read this topic online here:
> > > http://forum.openscenegraph.org/viewtopic.php?p=69644#69644 (
> http://forum.openscenegraph.org/viewtopic.php?p=69644#69644)
> > >
> > >
> > >
> > >
> > > Attachments:
> > > http://forum.openscenegraph.org//files/cmakelists_664.txt (
> http://forum.openscenegraph.org//files/cmakelists_664.txt)
> > > http://forum.openscenegraph.org//files/main_667.cpp (
> http://forum.openscenegraph.org//files/main_667.cpp)
> > >
> > >
> > > _______________________________________________
> > > osg-users mailing list
> > >  ()
> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-
> openscenegraph.org (http://lists.openscenegraph.
> org/listinfo.cgi/osg-users-openscenegraph.org)
> > >
> >
> >
> >  ------------------
> > Post generated by Mail2Forum
>
>
> I guess I will need to test how FBO work. I though that pbuffer and FBO
> will not make a big difference.
> Thank you.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=69649#69649
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161209/fd605eab/attachment-0003.htm>


More information about the osg-users mailing list