1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Blend Modes

Discussion in 'Assets and Asset Store' started by Elringus, Jan 16, 2015.

  1. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Blend Modes is an editor extension for Unity which allows you to change the blend mode of objects. Just like in Photoshop and similar image editing software, you will be able to set any of the 25 different blend modes to UI graphics or text, particle systems, 3D meshes and 2D sprites to achieve a wide range of effects.



    Links:

    If you have any questions or need support, feel free to post in this thread — I will be happy to assist.
     
    Last edited: Feb 24, 2016
  2. argosy_ops

    argosy_ops

    Joined:
    Dec 27, 2012
    Posts:
    49
    Looks nice, I was always missing this kind of flexibility with moving elements. I'm wondering if something like this could also be done for generic sprites in 2D games (so outside of the UI system)?
     
  3. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,327
    This looks like a cool plugin. However...
    Because mobile devices can read from the color buffer with no cost, all blend modes actually have the potential to be cheaper on mobile devices. I haven't made an attempt to do this cross-platform in Unity, but here's an iOS/GLSL snippet from a couple of years ago. If you figure that stuff out, I'd probably buy your source code.
     
  4. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Thank you! It could absolutely be done for generic Unity sprites. Actually, the materials in the plugin will work without any additional tuning with the default Unity sprites. You will just have to manually assign them to the sprite renderer. Here is a little demo:



    The editor will show warnings about using fixed functions with the SpriteRenderer in some shaders (because of GrabPass), but it seems that it doesn’t really affect anything.

    Thanks for the hint! Will definitely check it and try to optimize the plugin for mobiles, if that possible.
     
  5. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    I did a bit of research on the topic, and it appears, that only iOS and Android based on Tegra devices are capable to directly fetch form the framebuffer. Nevertheless, I would have implemented shaders for them, but unfortunately, I don’t have any such devices so I can’t even check the results. Anyway, thank you again for the info — I’ve got some good knowledge reading about that stuff :)

    Also, I would like to announce, that price for the plugin is now only 15$.
     
  6. Archie888

    Archie888

    Joined:
    May 17, 2014
    Posts:
    43
    Hi, does this support the so-called "multiply" blend mode on iOS and Android?
     
    Last edited: Feb 22, 2015
  7. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Yes, it supports multiply and 5 other blend modes on mobile devices. Specifically:
    • Darken
    • Multiply
    • Linear Burn
    • Lighten
    • Linear Dodge
    • Subtract
     
    ina and Archie888 like this.
  8. Archie888

    Archie888

    Joined:
    May 17, 2014
    Posts:
    43
    Thanks for the info! Also, if I buy this asset, will I be eligible for all the possible updates in the future? Will there be updates and additions?
     
  9. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Sure, you will automatically receive updates from the store.
    As for updates themselves: I’m currently planning to optimize all of the blend modes to work with iOS and Tegra devices (will happen when I’ll get one of those for testing). And if any other ideas for new features will come, I’ll implement it. So feel free to provide suggestions :)
     
    Archie888 likes this.
  10. wx3labs

    wx3labs

    Joined:
    Apr 5, 2014
    Posts:
    38
    I just purchased this asset and I'm seeing some bad jagginess/aliasing when applying the blend modes. Here is a screenshot:

    [​IMG]

    On the left is without the UIBlend Mode component, on the right is with (lighten blend mode). As you can see the edges of the blended image have serious aliasing artifacts. Any suggestions what's causing this?
     
  11. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Hello, does this problem appears with all the blend modes or only with lighten?

    UPD: I found the problem and will send you package with hotfix shortly. Sorry for the inconvenience.
     
    Last edited: Mar 4, 2015
  12. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Hello,

    Just wanted to let you know I’m currently working on a huge update for the plugin. Aside from rewriting all the shaders from scratch to make them more manageable (currently there are 84 shaders and it’s getting kinda hard to deal with them) and optimizing performance, I’m planning to add support for sprites and mesh renderers (one BlendMode component will work with GUI objects, sprites and meshes).

    However, the most vital part of the update would be new optimization option for mobile devices, which will use recently added framebuffer fetch function instead of the grab pass. This will work extremely faster and possibly allow using blend effects without limitation on supported mobile devices.
     
    argosy_ops and twobob like this.
  13. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    I’ve just done a bit of performance tests for framebuffer vs grab pass on iPad Air. The results are quite pleasing: the device was able to handle more than 450 GUI objects with Blend Mode effect applied while keeping ~15 FPS using framebuffer fetching, when grab pass mode were dropping framerate to 1-3 FPS with only 21 objects. :rolleyes:

    [​IMG]
     
    argosy_ops likes this.
  14. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    While implementing blend effect for meshes and sprites, I also thought about particles. Here is a couple of shots with a default particle system using Color Dodge blend mode:

    [​IMG]

    [​IMG]

    What do you think, could it be useful to control blend mode of the particles?
     
  15. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Currently making a demo video for the new version of Blend Modes and the scene with particles just asked of it's own :)

     
  16. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Blend Modes version 2.0 is now live on the Asset Store!



    Main changes:
    • Shaders and editor code overhauled
    • Added support for particle systems, sprite and mesh objects
    • Added Framebuffer optimization level
    • Improved shaders general performance
    • Implemented custom blend material editor
    • Implemented blend materials auto caching
    • Changed package name to "Blend Modes" and store category to Editor Extensions / Effects
     
    argosy_ops likes this.
  17. argosy_ops

    argosy_ops

    Joined:
    Dec 27, 2012
    Posts:
    49
    Nice! Very suitable for some nice ghosting effects on meshes, too :)
    Is there still a restriction on which blend modes can be used on mobile after the optimization you did?
     
  18. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Thank you! I've added framebuffer mode for mobiles. While using it, every blend mode will work smoothly, but this mode is only supported by devices running iOS and Android based on Tegra architecture.
     
  19. Beervangeer

    Beervangeer

    Joined:
    Dec 4, 2012
    Posts:
    12
    Hi there,

    I just bought your plugin, but get the following errors:
    log.jpg
    Can you help me?
     
  20. Beervangeer

    Beervangeer

    Joined:
    Dec 4, 2012
    Posts:
    12
    Ah Im sorry it probably has something to do with my unity version.
     
  21. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Yeah, I just was about to ask what version you are using :) The plugin only works with 4.6.3 or newer versions.
     
  22. Beervangeer

    Beervangeer

    Joined:
    Dec 4, 2012
    Posts:
    12
    I just updated to 4.6.4, still getting some errors, any tips ? log.jpg
     
  23. Beervangeer

    Beervangeer

    Joined:
    Dec 4, 2012
    Posts:
    12
    false alarm again. i restarted and everything works now!
     
  24. thehen2

    thehen2

    Joined:
    Apr 1, 2014
    Posts:
    33
    This looks seriously fantastic, I've been waiting for this functionality in sprites for so long.

    One question. Is it possible to blend only specific sorting layers?

    For example, these three circles use a linear burn blend mode to create a venn diagram. The background however does not get blended as well.

    [​IMG]

    This is an insta-buy for me if this is possible.

    Many thanks!
     
  25. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Hello,
    I'm afraid such selective blending is not currently achievable (every object blends with whatever is drawn “behind” it), but I will look for a ways to implement that option in the feature updates.
     
  26. argosy_ops

    argosy_ops

    Joined:
    Dec 27, 2012
    Posts:
    49
    Is there any known issue with specific project setups? I have tested this plugin with one project, which worked out absolutely fine.

    Then on another project (iOS platform) and no blend mode renders at all (tested on sprites), including the demo project. No matter what I set, I always get the default blend mode.
     
    Last edited: May 6, 2015
  27. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Actually, the effect should always be visible, in both scene and game views. Could you please specify when it’s not showing? Screenshot will also be great.
     
  28. argosy_ops

    argosy_ops

    Joined:
    Dec 27, 2012
    Posts:
    49
    Here's a screenshot of the demo scene inside our project:
    [​IMG]

    Using Unity 4.6.4, set to iOS platform. I noticed that it's not just the edit view, but the blend modes are glitching everywhere. Some, like multiply, simply appear black while others just show the normal blend mode. The only warning I get is inside the plugin inspector: "Material uses fixed function shader. It is not compatible with SpriteRenderer."
     
  29. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Thank you, I was able to reproduce the issue. It seems, that this is affecting Unity 4 only, as in the latest version everything works fine.
    I’ve already started working on this and will send you a hotfix ASAP. Sorry for the inconvenience.
     
  30. argosy_ops

    argosy_ops

    Joined:
    Dec 27, 2012
    Posts:
    49
    Thanks a lot! So in other words: Unity 5 should be safe? Any other version advantages that are favourable to your plugin in any way?
     
  31. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Oh, I’m sorry I didn’t figure this out sooner: for Unity 4 you need a pro license for every specific platform to use a grab pass. Therefore, it seems that in your case you have a general pro license, but not an iOS pro (just as I am). And in Unity 5 you don’t need a pro at all to use this feature.

    However, framebuffer render mode is not using grab pass, so it should work OK on the iOS devices even without the Unity 4 pro license, it’s just you won’t see the effect while in the editor.

    I should probably state this clearly in the manual.
     
  32. argosy_ops

    argosy_ops

    Joined:
    Dec 27, 2012
    Posts:
    49
    I see, thanks for clearing this up. I need to figure out a way to work around this, since I'm animating and it's terrible if you can't really see what you're working on :)

    May make more sense to migrate the project to 5 after all.
     
  33. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Yes, that is troublesome. For a workaround, you may consider switching the platform to the Standalone while working in the editor, so you will be able to see the effect and then switch back to iOS when building.
     
  34. thehen2

    thehen2

    Joined:
    Apr 1, 2014
    Posts:
    33
    Excellent. If you could update this thread when you push an update, I'll be happy to purchase and test the new functionality. Thanks!
     
    Elringus likes this.
  35. argosy_ops

    argosy_ops

    Joined:
    Dec 27, 2012
    Posts:
    49
    I actually tried this at first, since I wanted to figure out if this is a platform-dependent issue. However, despite my Unity 4 pro license, it didn't work there either. Maybe some caching issues within Unity, no clue.
     
  36. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Yes, it’s probably some materials caching thing, so you may need to restart the editor after switching platforms for the blend effect to appear.
     
  37. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Blend Modes version 2.1 is now live on the Asset Store!

    Main changes:
    • Optimized blend modes Cg functions
    • Added MeshBumpGlass shaders for custom blend materials, which incorporates blend mode with a glass refraction effect
    • Added a warning in the editor when trying to use Grab or Unified Grab modes without a Pro license in Unity 4
    • Updated the documentation concerning Grab and Unified Grab modes usage in Unity 4
     
  38. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
  39. LoDx

    LoDx

    Joined:
    Feb 13, 2013
    Posts:
    43
    hi @Elringus ,
    1. Encountered these errors :-
    Note
    using :- Unity 5 (5.0.1p1) - Platform : Android <DX9> ; Blend Modes Version: 2.1 (May 11, 2015)
    Have tried restart unity -> same errors


    2. Tried your Demo Scene ( that comes with the asset package ):-
    Note : Didn't change anything in your Demo Scene, errors appears the moment I opened the scene. Same errors when play the Demo Scene.

    Thanks.
     
  40. gshape

    gshape

    Joined:
    Aug 8, 2012
    Posts:
    91
    Hi @Elringus,

    Just got this asset and it seems promising. :)
    Do you have plan to support NGUI as well please?
    Thanks.
     
  41. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Hello LoDx,

    I wasn’t able to reproduce the issue you described.
    By the logs you provided I assume there could be problems with the package integrity. You may try to delete the BlendModes directory from your project and reimport the package. In case that won’t help, please contact me via the support email and I will try to help you solve the issue.
     
  42. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Hello gshape,

    It is possible to use the package with any 3rd party GUI solution by using custom blend materials. You may find more about this in the “Using custom blend materials” section of the docs: https://goo.gl/tSAmB7
     
  43. LoDx

    LoDx

    Joined:
    Feb 13, 2013
    Posts:
    43
    Hi @Elringus ,
    Thanks for your speedy response !
    1. Thanks for your advise : Solved those errors by re-download + re-import .

    2. Have another headache : I place the BlendModeEffect.cs in my SpriteRenderer, it shows this warning message ( in the Sprite Renderer inspector ) :-
    - does it means error ? or just ignore it ? or ?

    Thanks
     
  44. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Yeah, it’s a known bug in Unity and you may just ignore it.
     
  45. PavelShchelkun

    PavelShchelkun

    Joined:
    Feb 16, 2014
    Posts:
    6
    Hi there. Have you tried using command buffers instead of grab pass? If that is even possible at all. As it was noticed that on some Android devices we had a huge impact on fps when using grab pass in shaders.
     
  46. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Hi Pavel,

    As far as I understand, command buffers is just a way to send shader commands from high level scripting. Under the hood, they will still use all the same shader functions (like GrabPass for accessing the contents of the screen where the object is about to be drawn). Therefore, I can’t really see how they could be useful in terms of improving performance.
     
  47. gamesbyangelina

    gamesbyangelina

    Joined:
    Jun 23, 2013
    Posts:
    15
    Hey Elringus!

    I really loved your blog posts about the 2D Shaders, and I just picked this up in the Asset Store! It's really good - I have had problems however applying it to a Sprite Renderer. You posted a video a while back about applying materials to the sprites, but I can't see those materials in the downloaded assets. The Blend Mode Effect component, however, does work - but only some of the effects! I'm trying to get Multiply working but the sprite disappears and I get a message about Fixed Function shaders not being supported for Sprites. Any suggestions? Thanks!

    EDIT - Ok, best ignore me - I was using the wrong image. This asset is wonderful! :)
     
    Last edited: Jun 16, 2015
  48. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    I’ve made the video quite a time ago and the asset wasn’t supporting sprites natively at that time. Now you just add the Blend Effect component to any supported object and choose a mode.

    I should probably put some message to the video about that matter. Sorry for the confusion :)
     
  49. BenQi

    BenQi

    Joined:
    Mar 18, 2013
    Posts:
    10
    I have just check the new version on Unity5.0.3 and I got a bad result ,blendmod is multiply。
    and the rawimage is not support by BlendModeEffect control. result.PNG t2.PNG
     
  50. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    137
    Hello,
    If I’ve got you correctly, BlendModeEffect component can’t recognize RawImage. I’ve been able to reproduce the issue and will make a hotfix ASAP. Please contact me via the support email with the invoice number and I will send you new version with the fix.
     
    Last edited: Oct 3, 2016