[osg-users] Real time Strobing effect for on screen animation
Rakesh Prasad
rptutor2012 at gmail.com
Thu Oct 19 10:47:09 PDT 2017
Hi Robert,
I did go through the osgmotionblurr example. But I guess I need to look at the problem from the render to texture view point. I looked at it from blur point of view and was trying to figure out a way to selectively read and write pixels in the GL accumulator.
Will go in detail through the osgprerender and osgdistortion.
Thanks for referring to these relevant examples and the steps for render to texture.
Will revert back with my findings and test results.
Regards,
Rakesh
robertosfield wrote:
> Hi Rakesh,
>
> On 19 October 2017 at 17:56, Rakesh Prasad < ()> 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.
>
>
>
>
>
> ------------------
> Post generated by Mail2Forum
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72207#72207
More information about the osg-users
mailing list