effects - feed result as input?

This forum is currently in read-only mode.
  • Is it possible to apply a pixel shader to the foreground texture, and then update that result into the foreground texture of the next rendered frame?

    Something like the diagram below:

    <img src="http://www.prr-art.com/things/diagram.jpg">

    I want to obtain an iterative shader, but I don't know if that is really possible.

  • Try using a Canvas object with a 'grab layout before/after drawing' setting. If you change the opacity and/or apply a shader, you can get a frame feedback effect, where the previously drawn frames are fed back in to the canvas.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, that worked.

    *edit:( but unfortunately it doesn't grab the transparency of the layer, something I need.)

    Also it's a little annoying have to setup a canvas object every time you want the effect to work, since the shader only gives you any useful result when it's iterative.

    isn't possible to obtain this result just through shader code?

  • No, the previous frame's final render is not available to shaders I'm afraid - that's what the Canvas does, it acts as the surface that stores the previous frame's texture. What do you mean by it doesn't grab the transparency of the layer?

  • let me explain first:

    the shader I'm working was designed to be applied to a layer, not individual objects. In the shader's code i have an IF that checks the alpha of the layer's pixel.

    If I use a canvas, it seems to grab the entire layout as an image, that means that I can't check for alpha anymore.

  • Try checking 'Force own texture' on the layer the canvas is on, and make sure the canvas is on top of everything on that layer. Does that help?

  • helps partially. I can now compare the alpha but I cannot set a pixel's alpha.

    Actually I made some tests and it seems that with a canvas object I cannot set the pixel's alpha value anymore. If I set it's alpha to 0 it always stays opaque instead of turn transparent.

    But if I apply the effect to a layer it turn the pixel transparent as expected.

    here the example (construct version 0.99.84):

    http://www.prr-art.com/things/shader_test-01.cap

    http://www.prr-art.com/things/sand.fx

  • did you try using it as a layer effect on the foreground layer?

    NVM: i just looked at your cap

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)