0 Favourites

Sprites, simple request (result = allow amazing pro effects)

  • Hello,

    I know there have been a number of people who have asked are the following possible...

    retro palette cycling?

    palette swaps?

    dirty lens / camera + dynamic bloom?

    ...And the answer is no, not in the way it would be best to do so, at any rate. I have been working on some shaders that would enable retro palette effects, and mutiple texture shaders like dirty lens plus bloom. I have a few other ideas. These can be implemented in Unity for example without problem, but not construct because...

    ...There is just one technical problem: In a construct 2 effects file you can only reference 2 textures. The one being drawn and where it is being drawn to. Thats it: front and back.

    A huge part of making cool filters and effects (especially non process intensive ones - which is key for construct 2 performance) is to reference other premade textures. Old school film effects, complex film grain, and other camera effects can be found using no additional textures, but they have to compute the noise and patterns they create. some effects just can't be done without additional textures (like palette cycling, and image based filters) without some form of compromise that usually affects performance. Some can't be done period.

    The solution is simple. Stupid simple as a matter of fact.

    All that is needed is for the effects portion of a plugin (where you add effects to a plugin or layer) to include another field where you can load an image (the ability to add more than one would be nice, but not needed as you could combine multiple into one ) and attach it specifically to the effect. Within the effect file you could then reference the image as....

    uniform lowp sampler2D samplerCustom1;

    uniform lowp sampler2d samplerCustom2;

    ...in addition to samplerfront and samplerback.

    This means you could have the ability to make super awesome palette swapping filters, dynamic scratched lens filters with hdr bloom, professional color Luts with dynamic blending between different lighting schemes, and much much more all at a reasonable performance cost.

    As I said, this should be easy to add, but it needs to be officially supported. Ashley likes to give priority to things that are a.) actually needed and b.) desired by the community. I think I have given a good case for why it is needed, and I believe it should take little time to implement (easy to solve with high value).

    What about Ashley? I would love to be able to develop some of these shaders but I need to be able to reference at least 1 additional texture in an effects file (samplercustom). Just a few lines of code here and there and presto! It would be totally worth it. o.o

    On a side note, it would be possible, though highly complicated, impractical, and downright silly, to include the texture needed combined with the sprite being effected, you could then vtex to correctly look at the actual sprite vs the texture packaged with it. The problem is that animated sprites would become massive as each frame would have to include the texture (some of which would likely be at least 256,256. Then each effect would have stringent use case possibilities which sucks for modularity... I think you get the point.

  • I don't know how simple it would be to add. To me it looks not so simple with my imperfect understanding of how C2's renderer works.

    However that's not my my point. My point is it is this could be done in a plugin currently, if you're willing to use webgl directly. Most plugins just use C2's provided drawing functions within the drawgl() function, but you can use any webgl in there as long as you:

    A. finish C2's current render batches at the start of the function.

    B. At the end set any webgl states you changed back to what they were at the start. There are some that don't need to restore, it just depends on what the renderer expects to stay the same.

    As a cursory exploration into this I did some custom webgl in this plugin:

    Basically it draws one large 2d mesh instead of multiple quads. In a similar way you can use your own fragment and pixel shaders and give them any parameters you'd like. This is where you'll need a good webgl tutorial as C2's way of using effects wouldn't be used.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • This is definitely a good idea, but is far from simple to implement. This is a classic case of something which looks easy to a user but in reality involves a great deal of architecting.

    C2's effect compositor is one of the most complicated parts of the engine. It has to take an arbitrary chain of effects - each with their own parameters and each with a varying ability to be drawn with different optimisations - and process all of them in sequence correctly eventually ending up on the screen without bloating memory proportional to the number of effects used. Adding custom texture to each stage is possible, but this is one of the most difficult aspects of the engine.

    Then on top of that you have to add all the UI. Right now there's no mechanism to edit an image which doesn't belong to an object (or a project icon file, a special case). So all of this would have to be invented and hooked in to the effects system too.

    As you say, it's a good idea and makes a lot more visual effects possible. However I think it would be most plausible to consider this for C3, and probably some time after its release at that.

  • ... This is a classic case of something which looks easy to a user but in reality involves a great deal of architecting...

    Well... that figures... I had a hunch I was talking about something I had no clue about. lol

    thanks for detailed reply If it could make it in c3 at some point that could be really cool.

    R0J0hound - well, Iv'e always skipped the parts of the tutorial that had nothing to do with the frag shader... *sigh*. Given your answer on a separate forum I think I'm getting it.

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