[osg-users] Real time Strobing effect for on screen animation

Robert Osfield robert.osfield at gmail.com
Thu Oct 19 10:19:45 PDT 2017


Hi Rakesh,

On 19 October 2017 at 17:56, Rakesh Prasad <rptutor2012 at gmail.com> wrote:

> Hi Robert,
> The human model is comprised of independent 3DS max models of each body
> part like head, arms pelvis, thorax. The way animation is being done is by
> moving through code the position and orientation of these body parts. The
> background is fixed to RGB(80,80,80) .
> Hope this clarifies.
>

Yes, this information is what was missing form the original post message.
The solution depends entirely on the nature of what you are doing so need
this clarification.


> I was hoping if there is a way to get the final render buffer (for read
> and write)for each frame just before it is displayed to the screen. I could
> create another buffer which will be a superposition of all past buffer.
> Only the model
> part will be superposed since I know the background color RGB(80,80,80). I
> don't expect RGB(80,80,80) to occur in the model and animation render.
> The new superposed buffer could be overwritten onto the final render
> buffer to be rendered to screen.-----------
>

In OpenGL and OSG you can either use a accumulation buffer or render to
texture.  The osgmotionblur example illustrates how to do motion blur use a
GL accumulation buffer, not all hardware&drivers support this though.  The
render to texture approach is similar to the accumulation buffer approach
but implements the functionality use render to texture.  The osgprerender
and osgdistortion examples illustrate how to render to texture, with modern
graphics cards this would be the way I'd suggest doing it.

To do render to texture you'll need to render the 3D model into a texture
by using an osg::Camera with a Texture assigned as the colour buffer to
provide the Render to Texture (RTT) , with the subgraph of the Camera being
the 3D model you want to render to it. You can accumulate successive frames
into this texture by disabling the clear of the RTT Camera using the
Camera::setClearMaks(0x0).

You then just render this texture to the whole screen as per the
osgdistortion example.

There are variations on this approach, but the above approach should be
simple enough.

Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20171019/d13f9d21/attachment.html>


More information about the osg-users mailing list