Blend mode: subtract darkness effect.

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hey there clickers!

    Does anyone know of a good way to do darkness, different from mine?

    I have a day-and-night cycle, with a fading darkness layer. The darkness object covers the entire screen and is set to not follow frame.
    I use subtract, and then inside the layer I have another object that subtracts from the darkness object, which works as a flashlight.
    To avoid any jagged edges, the flashlight is huge and it is not possible for the flashlight object to NOT cover the screen.

    The problem is, I recently started fantasizing about having other light sources as well.
    The only way I can think of doing this is making a massive darkness layer that is entirely black and covers the entire frame, which is then subtracted from.
    The problem with this is, even though it's more efficient than covering the screen with frame sized light sources it still uses too much ram.
    My frame is 12000x12000px so even adding just a stretched black pixel, instantly uses 500Mb of ram.

    If anyone has another method of doing this, I'd love to hear. Thanks!

  • It appears, that without official support for the multiply blend effect there's no good enough alternative for what I wanted to do.
    Meaning, no blend mode shader that I have found is without it's bugs.
    Here is however, what I ended up doing in case someone else is interested in this topic.

    After trying for several days straight, I have decided to drop skewable AI light sources from my project.
    Meaning the only light source in the game that can change shape with scale tweening is the players flashlight.

    However, in case someone is interested in this topic. Here is what I did:

    I downloaded photoshop blend modes (FOR FREE!) from the clickstore.
    Make a layer of darkness and set the layer blend mode to the built-in subtract mode.
    Position darkness objects in that layer with no blend mode.
    Subtract from darkness objects with Clickteams built in subtract effect, since it allows for real time scaling.
    Use photoshop multiply_as for the rest of the lightsources in the game.

    With this setup, multiply-blend objects use black for darkness deletion, and the subtract effect I used for the player uses white.

    Hope this helps someone!

  • Check these, it adds support to alpha channel to the Photoshop effects from Looki: Please login to see this link.
    I did the DX11 port for these and a few extra shaders for the pack.

    These are the ones I used. Thank you so much! It's nice to know that they will work with DX11, I'm going as far as I can with dx9, and will switch to 11 when there are no other options left, or possibly ANYWAY at final release, since my estimated development time is minimum 3 years.

  • It's nice to know that they will work with DX11, I'm going as far as I can with dx9, and will switch to 11 when there are no other options left, or possibly ANYWAY at final release, since my estimated development time is minimum 3 years.

    Hmm, IMHO if you plan to switch do DX11 at some point, then do it now rather than at the end of the project where you might discover some compatibility issues between the DX9 and DX11 modes. Nowadays all machines support DX11.


  • The only way I can think of doing this is making a massive darkness layer that is entirely black and covers the entire frame, which is then subtracted from.
    The problem with this is, even though it's more efficient than covering the screen with frame sized light sources it still uses too much ram.
    My frame is 12000x12000px so even adding just a stretched black pixel, instantly uses 500Mb of ram.

    Have you tried stretching it by code? It shouldn't use more ram.
    (ie. Make a 12x12 black object and then scale it up at runtime using "Set scale to 1000")

  • It doesn't sound like you need a 12000x12000 object to cover the entire frame though. You should be fine with just covering the area visible through the camera/window.
    But if it's required for some reason then like contra said you can scale an object which doesn't modify the original image and so the ram stays the same.

    - BartekB

    Join the Click Converse Discord! - Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!