Forums > Jitter

Shaders: Accessing screencontent of last frame

July 18, 2007 | 8:58 am

Hi all,

a short question from me. Are there any tricks how one can access the contents (maybe as a texture) of the last frame from inside a fragment shader? Perhaps grabbing the screenbuffer or something like that? I haven’t found anything about that on the net so far, so it seems there’s no way, but maybe one of you knows.

Thanks

Dave


July 18, 2007 | 9:13 am

If you use the @capture attribute of a jit.gl object, you can send
whatever is drawn to a texture.

wes

On 7/18/07, Dave wrote:
>
> Hi all,
>
> a short question from me. Are there any tricks how one can access the contents (maybe as a texture) of the last frame from inside a fragment shader? Perhaps grabbing the screenbuffer or something like that? I haven’t found anything about that on the net so far, so it seems there’s no way, but maybe one of you knows.
>
> Thanks
>
> Dave
>


July 18, 2007 | 9:18 am

Is it some kind of feedback effect u’re trying to accomplish?
What about making a shader with 2 inputs? one (the left input?) with the
current frame, one with the previous frame. That way you’ll be able to
change the delay between the two frames from outside the shader…
Or didn’t i understand you correctly?

d

On 7/18/07, Dave wrote:
>
>
> Hi all,
>
> a short question from me. Are there any tricks how one can access the
> contents (maybe as a texture) of the last frame from inside a fragment
> shader? Perhaps grabbing the screenbuffer or something like that? I haven’t
> found anything about that on the net so far, so it seems there’s no way, but
> maybe one of you knows.
>
> Thanks
>
> Dave
>


July 18, 2007 | 9:32 am

Hey Wes and Mojo,
thanks for the quick reply. I’m fiddling around right now, hopefully one of your suggestions work for me.


July 18, 2007 | 1:15 pm

Yeah, @capture of you can use render to texture to get the whole
frame to work. I think ive posted a patch or two showing GL feedback
with slab processing etc.
On Jul 18, 2007, at 5:32 AM, Dave wrote:

>
> Hey Wes and Mojo,
> thanks for the quick reply. I’m fiddling around right now,
> hopefully one of your suggestions work for me.

v a d e //

http://www.vade.info
abstrakt.vade.info


July 18, 2007 | 4:48 pm

There are several ways to do OpenGL-based texture feedback, many of
which are covered in the examples folder and the Jitter Recipes. I’ve
been kicking around the idea of doing an article on feedback, but
haven’t gotten around to it yet.

Andrew B.


July 19, 2007 | 4:46 pm

Quote: andrewb@cycling74.com wrote on Wed, 18 July 2007 18:48
—————————————————-
> There are several ways to do OpenGL-based texture feedback, many of
> which are covered in the examples folder and the Jitter Recipes. I’ve
> been kicking around the idea of doing an article on feedback, but
> haven’t gotten around to it yet.
>
> Andrew B.
>
—————————————————-
At one point I’d love to see an article highlighting the differences between the approaches, since I personally only "master" one way, that I’ve cobbled together from a user-example… Being able to get under the skin of the various methods would be killer.

Andreas.


July 19, 2007 | 9:33 pm

as far as I can tell,

approach a)

use to_texture and capture the whole scene, render to a video plane
and produce feedback by:

adjusting the alpha value of the erase_color (wont work with FSAA :( )
and adjusting the scale/position/rotation of the videoplane to
produce the regular video feedback (camera pointed towards monitor
style effects)

approach b)

use slab based feedback and use a compositing shader and use a
similar technique with xfadeshader(a) -> rotashader(or whatever) ->
xfadeshader (b). param mixamount is the amount of feedback. swap out
whatever xfade shader you want for differing blend modes etc.

—-

As far as I know, those are the two main approaches. I actually use
both in my patches, since each has a unique feel to it.

hope this helps.

On Jul 19, 2007, at 12:46 PM, Andreas Wetterberg wrote:

>
> Quote: andrewb@cycling74.com wrote on Wed, 18 July 2007 18:48
> —————————————————-
>> There are several ways to do OpenGL-based texture feedback, many of
>> which are covered in the examples folder and the Jitter Recipes.
>> I’ve
>> been kicking around the idea of doing an article on feedback, but
>> haven’t gotten around to it yet.
>>
>> Andrew B.
>>
> —————————————————-
> At one point I’d love to see an article highlighting the
> differences between the approaches, since I personally only
> "master" one way, that I’ve cobbled together from a user-example…
> Being able to get under the skin of the various methods would be
> killer.
>
> Andreas.
>

v a d e //

http://www.vade.info
abstrakt.vade.info


July 20, 2007 | 4:41 pm

Hi Vade,

I use a similar technique to your approach a) and i get it to work with fsaa turned on. I alter the texture scale and rotate it within videoplane and don’t rely on the alpha value of the erase colour to increase the feedback amount. Instead I use the alpha value of the videoplane colour.

I’ve been working on some patches to release that are on my website at the moment but haven’t publicised it yet because I want to check a few things, but hey, I’ve told you now! Check out the example patch in the tools package – i use this method there.

http://www.pelado.co.uk/category/maxmspjitter/

pelado


Viewing 9 posts - 1 through 9 (of 9 total)