We've implemented jitter based anti-aliasing using the SceneView.

Here's how we did it:
// Save original projection matrix.
OsgTools::ScopedProjection sp ( _sceneView.get() );

// Clear the accumulation buffer.
::glClearAccum ( 0.0f, 0.0f, 0.0f, 0.0f );
::glClear ( GL_ACCUM_BUFFER_BIT );

// Needed in the loop.
osg::Matrixd matrix;
osg::ref_ptr<osg::Viewport> vp ( this->viewport() );
const osg::Matrixd &proj = _sceneView->getProjectionMatrix();

// Loop through the passes...
for ( unsigned i = 0; i < this->numRenderPasses(); ++i )
{
// Set the proper projection matrix.
OsgTools::Jitter::instance().perspective ( _numPasses, i, *vp, proj, matrix );
_sceneView->setProjectionMatrix ( matrix );

// Render a single pass.
this->_singlePassRender();

// Accumulate the pixels from the frame buffer.
float value ( 1.0f / static_cast < float > ( this->numRenderPasses() ) );
::glAccum ( GL_ACCUM, value );

}

// Transfer the accumulation buffer into the frame buffer.
::glAccum ( GL_RETURN, 1.0f );

See:
http://cadkit.cvs.sourceforge.net/cadkit/OsgTools/Jitter.h?revision=1.2&view=markup
http://cadkit.cvs.sourceforge.net/cadkit/OsgTools/Jitter.cpp?revision=1.2&view=markup
and _multiPassRender function in http://cadkit.cvs.sourceforge.net/cadkit/OsgTools/Render/Viewer.cpp?revision=1.22&view=markup

On 5/13/06, Adrian Egli <[EMAIL PROTECTED]> wrote:
hi

i like to implement "jittering" with using osg::SceneView. how should i it implement, in a new renderstage
or ... ? or is there still an other example than osgmotionblur. because the motionblur make us of producer,
and i like implementing this feature in the osg core. on older hardware, the multisample arb is not
supported, and so i like to implement full screen antialising myself. or other sugestions ?


adegli



_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to