How do I apply a shader on multiple layouts? [RESOLVED]

0 favourites
  • 10 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hello,

    Here is my issue : I have several shaders for my game.

    My game works with a lot of different layouts (one for each room).

    If I want to have the same visual result, I have to add the shaders needed in EACH layout.

    If I have 100 rooms, and I need to replace a shader by a better one or just adding a cool fullscreen effect for the entire game, I will have to do it 100 times.

    Am I wrong?

    Tell me there's a easier way please!

  • Can't you call the shader from an event sheet that you include in each room?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If a shader is not in the effects list of the layout, I can do nothing.

    And I don't see any action to 'call' or 'create' dynamically a shader.

  • Perhaps you could take advantage of global layers? You'll need to add an empty layer named "Shader" or something to every layout. Then in one layout, (maybe a test room if you have one,) set that layer to global and add all the effects you need. Then it should be automatically mirrored to every layer with that name throughout the entire project. That way you only need to set it up once and any changes you make later won't need to be repeated.

  • ahr Ech Well it won't work as my fx are applied on the layout, not just one layer.

    If I put, for example, a deformation shader on a layer, only that layer will be affected, not the other ones.

    Or I mainly use full screen shaders that need to affect all the screen.

  • In some cases you can get around that. Like if the effects you want to use don't work as masks but you need them to, you can sort of piggyback them on an effect that that does so it applies to everything underneath it.

    So here I have a single empty layer on top. It has a noise mask with it's intensity set to 0 because all I want is it's mask property, and the other two effects ordered under it so they process last on top of the mask. As you can see, the warp effect gets applied to everything.

    It's not the most efficient solution but I hope you can adapt that to your needs. If it'll work you also have the added benefit of being able to apply your shader underneath any UI elements if you want so they remain un-obscured.

  • ahr Ech Wow!!!! Thank you for the trick! It works.

    That will save me a lot of time!!!

    (I'm wondering if setting 0 to the NoiseMask is equal to no CPU use for that 'empty' shader?)

  • Happy to help!

    (I'm wondering if setting 0 to the NoiseMask is equal to no CPU use for that 'empty' shader?)

    On that I have no idea, but I suspect the CPU use doesn't change. That's why I use Noise for this, because I assume it doesn't take much to begin with.

  • Damn, since R187 (same in R188 but I never tried the R186), my shaders using this trick don't work anymore.

    I have to work on the R185 to keep it working.

    Anyone else have noticed changes?

  • Ok I've found where it comes from :

    R187 :" The renderer now experimentally skips rendering layers with zero instances on them,.."

    So we just need to add a sprite (or anything else) somewhere outside the layout and it works again!

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