Applying the same effect to both the layer and the object, increased or decreased performance?

0 favourites
  • 7 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Hi,

    Let's say that you use a specific effect, "brightness" for example. If you have conditions that affect the effect level of all instances equally it makes sense to control the effect by applying it to the layer the instances are placed in (if you can set a layer of their own for all these instances). It's supposed to increase performance. But if you have conditions that affect individual instances' "brightness" you have to add the effect directly to the object as well.

    But how should you set things if you have a combination of both situations mentioned above, meaning some conditions affect the effect levels of all the instances while some conditions only affect individual instances? If you in that case apply the effect to both the object and the layer, does that cause double rendering work that could be avoided by only having the effect added to the object? Or does it still increase performance if you can control the effect as much as possible through a layer, even though you in some conditions are still forced to also individually control the instance effect levels.

  • If you need to control instances individually, then you don't really have a choice, you have to add the effect to individual objects and not use a layer effect. If you have an effect on both the object and the layer the object is on, it will process the effect twice, which is wasteful so probably makes it worse.

    It's also not guaranteed that a layer effect will be faster. It depends. There is quite a high CPU performance cost for each effect, so one layer effect has a lower CPU overhead than lots of objects with their own effects. But a layer effect must process all the pixels on the entire layer, which can be a larger area than just the objects on the layer, resulting in more GPU work. So whether or not it's faster depends on the precise balance of number of objects, rendering area, CPU work and GPU work. It's not easy to say conclusively that it helps either way, it's just an option to try - and as usual the only way to know for sure is measure it.

  • If you need to control instances individually, then you don't really have a choice, you have to add the effect to individual objects and not use a layer effect. If you have an effect on both the object and the layer the object is on, it will process the effect twice, which is wasteful so probably makes it worse.

    It's also not guaranteed that a layer effect will be faster. It depends. There is quite a high CPU performance cost for each effect, so one layer effect has a lower CPU overhead than lots of objects with their own effects. But a layer effect must process all the pixels on the entire layer, which can be a larger area than just the objects on the layer, resulting in more GPU work. So whether or not it's faster depends on the precise balance of number of objects, rendering area, CPU work and GPU work. It's not easy to say conclusively that it helps either way, it's just an option to try - and as usual the only way to know for sure is measure it.

    Ashley, I have a question:

    It would be possible to apply the effect to a group of layer? or exclude an effect to a specific layer/sprite in the layout effect?

    In my game, I applied the effect to the whole layout (the layout has like 14 layers). The effects are used to make different lighting options. The problem here is that I have 2 layer that are the HUD of the game, and I would like to exclude these from the layout effect. If I apply every single effect to each layer, I notice that the GPU % increases a lot, while if I apply the layout effect, the GPU % is much less increasing the total performance.

    I don't know hot it works in the back-end, but a sort of disable effect to specific object and layer under the layout effect would be great if possible.

    Thanks

  • It's been suggested in the past. It means making layers into a tree structure. It would be great, but would also be a complex and time consuming feature to implement. As with all feature requests, we're a small team with limited resources, so we have to carefully prioritise what we do. There's several years of feature requests already filed on the suggestions platform.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's been suggested in the past. It means making layers into a tree structure. It would be great, but would also be a complex and time consuming feature to implement. As with all feature requests, we're a small team with limited resources, so we have to carefully prioritise what we do. There's several years of feature requests already filed on the suggestions platform.

    I understand. If we do not take in consideration the grouping layer, it would be possible just to disable any effect applied to a specific object or layer? This would solve the problem anyway. Like a toggle options or a behavior that says "do not apply any effect".

    For instance, I have a sprite that makes all the hud graphics.In the layout effect, I use the effect to make the level looks like really dark changing the contrast, brightest and the colors. I could achieve the same effect by changing the textures of the game (and then apply the effect to sprites I need), and that actually would work saving some GPU (maybe). However, I use a dynamic light, meaning that depending on where the player goes, the light change according (like if the player goes into the cavern in real time, all the lighting and color changes smoothly). As you would imagine, if I apply the layout effect, the HUD will get affected by it. If I have an option to disable the effect to a specific layer or sprite, then we wouldn't need the grouping layer. Also, changing the texture in this case would be really hard to do it (adding more layers, changing opacity...etc. So effect would be the best and easy solution I guess.

    PS: I see that you are working on the scene graphs and that is great (it is also sound really complicated), however I think that the grouping layer is something more helpful for a vast majority of people and should be a core options on construct 3. But I understand how difficult would be implement this feature.

    PS2: is there any JS script that would allow to disable the effects to the specific instance even if the effect is applied to the layout?

    Thanks again

  • Thanks, this actually helps a lot when designing how to use effects. I did notice a slowdown when I moved the effects as much as possible to layers, and this certainly explains why.

  • In Construct's rendering architecture, by the time it's processing a layer or layout effect, everything has already been rendered to a single surface (essentially a single image). So the entire thing will be altered by effects. The only way to have partial effects is to add them to an object.

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