Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Utility Shaders

Discussion in 'Assets and Asset Store' started by Jesus, Nov 14, 2014.

  1. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Update - Dec 2018:

    Version 1 of the Utility Shaders Packs are depreciated while I move from Shader Forge (Unity 5.0 - Unity 2018.2, RIP) to the Unity Shader Graph Editor (Unity 2018+).

    Don't Worry! Pre-compiled versions for those not using SRP will come in the packages. Existing owners will receive this update for free, no re-purchasing.

    I will re-enable the store page when the new versions are released! Current ETA is New Year 2019, (depending on submission process).



    Old Post:

    Volume 1 Submitted to the Asset Store!

    The first in a series of 10 utility shader packs for the Unity Asset Store. These are going to be mostly general-use shaders that can be handy in a pinch or used for a number of common or unorthodox purposes.

    Price: $10

    RECCOMENDED: Textures should use mip-maps, texture wrapping should be disabled (set to clamp) and should be no smaller than 128x128. Failure to do so may affect quality.

    An example Box Blur (High) shader is available, see the Free Preview Pack on the Asset Store!

    They have been obfuscated and gimped a little bit, and under no circumstances should you open them with Shader Forge! Apart from that, the output is similar to that available in the packs.

    If there's interest in smaller sets of textures (just the blurred ones, or the cooldown, or some more pixelation/noise), I might consider doing smaller $5 packages with just them. Any feedback, requests or support should also go in this thread.


    Future Roadmap:
    USV1 Distortion
    USV2 Bars and Dials
    USV3 Artistic Filters
    USV4 Maps
    USV5 Digital
    USV6 Tracking
    USV7 Effects
    USV8 Detail
    USV9 Unstatic Lightmapping
    USV - X Complete Package
     
    Last edited: Dec 19, 2018
    rakkarage likes this.
  2. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    They look nice, do you have a webplayer to demo these? And would they work with sprites? For example, being able to blur a 2D game when you show a menu?
     
  3. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Webplayer is coming soon! It'll be good to show off the animated cooldown and blurs.

    Just did some tests with sprites; unfortunately they don't work too well - the blurring type I use relies on mip-maps for better blur over larger distances. Sprites have no mip-maps, so unless you want to blur them by a pixel or two, I can't recommend it.

    Here's a test image of the blur (high) applied to a 128 sprite (non-atlased) version of the triangle texture. I set texture resolution to 128 inn the material and used a small amount of blur on the first one, a tiny amount on the second and the third is unblurred.
     

    Attached Files:

  4. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    The Utility Shaders Free Preview Pack is on the asset store!

    https://www.assetstore.unity3d.com/en/#!/content/25378

    It has a bunch of examples from the first pack, as well as some previews from future packs. Just plug in your textures. As this is mostly for compatibility and performance testing, I've disabled shader settings (like blur amount/direction/etc) and Shader Forge Support is gone.

    However, apart from that it's representative of what you get with the full pack/s.

    Including:

    Blur
    Directional Blur
    Pixelated Noise
    Distortion By texture
    Spherize
    Radar
    Height Map
    Segmented Bar Graph
     

    Attached Files:

  5. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    A series of smaller packs made from Volume 1 are on the Asset Store!

    These are made up of the subsets of shaders from Volume 1. If you're just after the blur, or the cooldown or distortion shaders, these are for you.

    Utility Shaders Texture Blur - $5

    Utility Shaders Distortion - $5

    Utility Shaders Cooldown - $5

    If you have Volume 1, do not buy these packs, you already have these shaders and materials.
     
  6. olivier-etienne

    olivier-etienne

    Joined:
    Feb 15, 2013
    Posts:
    13
    Hello Finally got around to use your shaders,
    they are unbelievably fast and run very well on Mobile Devices.

    I have tried the add the following to the Blur Gauss5x5

    Code (CSharp):
    1.  
    2. Shader "Utility Shaders/Blur/Blur Gauss 5x5" {
    3.  
    4. ...
    5.     SubShader {
    6. ...
    7.         }
    8.    
    9.       ZWrite Off
    10.     Blend SrcAlpha OneMinusSrcColor
    11.    
    12.         Pass {
    13. ...
    14.            }
    15.  
    To add some transparency but it does not work very well, infact I have
    tried all combinaison of the Blend but stilll not joy.

    Can you point to the right direction
    Would you mind adding transparency to the blur shaders?
     
    Last edited: Jan 5, 2015
  7. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Good idea, I'll get on it. Should be in the next update to the Blur and USV1 packs. (edit: I'll actually just add it to all of them)

    Just a heads up though - since you can't really have blurry alpha testing (blurry hard edges) it'll be only alpha blended. Is that OK?

    Good to see it's being used on mobile too!
     
  8. olivier-etienne

    olivier-etienne

    Joined:
    Feb 15, 2013
    Posts:
    13
    Yes alpha Blended would still be perfect. Thank you very much for considering my request,
    can't wait to give it a try.

    This is what I am trying to achieve:
    https://www.dropbox.com/s/3irhajwmqcm1c3r/monitor.png
    But as you see when the transparency is added the seats in the foreground
    become transparent allowing the viewer to see though them.
    Although they are no alpha in the seats.

    When you solution is ready I will give a try.
    Thanks again.
     
  9. o2deprived

    o2deprived

    Joined:
    Jun 17, 2013
    Posts:
    4
    Hello Jesus! I am searching for a mobile-compatible blur lens effect that would blur anything behind it, but allow anything in front to remain sharp. A best use scenario would be to place the effect on something like a quad and position the plane between the focus item and the background items, similar to the earlier question where a menu is active and blurs a game/app in the background. I took a peek at your sample pack, but I can't seem to create this effect. Is this scenario possible with your asset?
     
  10. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Not really, sorry. My effect blurs a texture that uses mipmaps for best results. You might be able to do it with mobile render textures, but they're performance-sucking black holes on low-end devices, and still reasonably hefty on mid and high end mobile hardware.

    If you want to try with the example pack, try giving this a go.

    Create a second camera, with a near clip plane 0.1 beyond where you want the blur/quad to be. Aim the output at a render texture (try for smaller than screen size with the RT, like half res or something). Then make the Quad, use a material with one of my blur shaders, and blur the render texture as it's input. Because RT's and mip-maps don't work, and I use mips a lot for this, you will probably only be able to do a small amount of blur before it looks like a kaleidoscope.
     
  11. o2deprived

    o2deprived

    Joined:
    Jun 17, 2013
    Posts:
    4
    Awesome, thanks for the reply. I was considering something like this using a ReadPixels texture, but it was a little slow for the desired effect. I tried this using RenderTexture and it technically works. My problem is trying to find a solution for Unity Free. I have Pro, but not for mobile and unfortunately, RenderTexture is a Pro feature. Your shaders are very cool tho! Thanks again. I really appreciate your response and suggestion.
     
  12. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Hi,
    I'm after some texture blur shaders, but I also need to control fade out of the texture to a pre-defined color as well.
    Can this be done with yours?

    I tried the demo, but the texture was rotated 90 degrees and had a fixed blur so difficult to tell.

    Is the code readable as well? I have shader forge but have not used it much yet.
     
  13. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Hi sonicviz

    Yes, you can change the blur amount from unblurred to fairly blurred. Also, most will be able to blur towards a set color. You can see the ones on the top right are more gray and less 'vibrant' than the others, because I have toggled the Blur To Color option on, and they're partway to a mid grayish color. This is done at the same rate, so you can have 30% blur, 30% fade, but not 40% blur 80% fade, if that makes sense.

    The fixed blur was just a limitaton on the free version. Basically, if it'll blur with the Free Preview, the paid version will run (this was for device and texture compatibility testing).

    The paid shaders are all Shader Forge capable. The free preview shaders should open with Shader Forge, but will have stacked up graphs (deliberately obfuscated and hard to read/understand). Once SF and Unity 5 stabilize a bit better (some problems with U5 and it's early versions of SF) I'll be moving everything over to a new stable version. So no more U4 or SF-Beta support.
     
  14. HitsuSan

    HitsuSan

    Joined:
    Sep 28, 2014
    Posts:
    158
    I'm very interested in this pack but i'm wondering if these shaders are sprite capable cause i'm looking for a solution for a 2D game and i definitely need my alpha channel and atlasing. I've tried some of them in the free pack very quickly and it doesn't seem to be the case but i understand the store version is more powerful so i'm asking :)
     
  15. coolstorybro

    coolstorybro

    Joined:
    Jun 21, 2015
    Posts:
    3
    I just bought this but I have no idea how to use it because I am a unity noob. Can you please make a step by step tutorial on how to use it.

    the readme explains what it is but doesnt tell me exactly how to use it.
     
  16. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    Use it like any other material/shader.

    Every mesh you want to render will have a material. Think of a material as basically just a list of references to texture/s, a shader, and some variables. For example, if you have a model of a tree, you will need a material for it. The tree material (you can rename them, so TreeMat from here on out) you can choose a shader for, like Diffuse, Standard Shader, Mobile Diffuse, etc. This basically controls lighting and any extra effects, and is the drop-down at the top of the material. Any textures you apply then get processed by the shader (if applicable) and rendered out on-screen. You can often adjust some variables of the material in the normal inspector window.

    For the blur shaders, the use is basically the same. You will have a model with a texture, and you want to blur the texture for (insert your reason here). You create a new material (and place it where you want it, maybe you have a Materials Folder in your project), and you click the material, and select one of the blur shaders. Then you assign the texture you want to blur (I used a triangle, but you can use whatever you want, like a playing card or something). The next step is to assign it to a mesh like a quad or plane (or insert your mesh here). If we're doing a playing card a quad should be fine; you do this by clicking on the quad and in it's mesh renderer, change the material to the one we just created. You can now play with that material in the inspector for the playing card quad. You can blur it, unblur it, whatever. The final step is to create a new script that adjusts the blur amount when in Play mode. I won't go too far into this here, but there's a lot of ways to do this online if you search for "Unity change material value through script".

    The easy way is to create a new CS script called BlurTest, and then do something like this:

    using UnityEngine;
    using System.Collections;

    public class BlurTest : MonoBehaviour {

    public mat : material;
    publix float blur : 0.0;

    void Update() {
    float blur = Mathf.PingPong(Time.time, 1.0F);
    rend.material.SetFloat("_Blur", blur);
    }
    }

    This will blur and unblur the texture when you hit play. You have to drag the script onto whatever you want to blur, and then assign the material the (playing card, etc) is using to the script.

    Alpha is still being worked on, I'm trying to figure out how people are going to use it because otherwise we end up with 99 redundant versions with the wrong type of opacity/clipping/dithering/depth-writing/etc which all cause their own bugs. If you've got any preferences (just try with the default Unity transparent, cutout and particle shaders and see which one works best, I can work out the required settings from there) please let me know.

    I'm not sure about atlasing. I think it would probably break and blend in some colors from outside the part of the atlas you're using on that mash; if that's the case with the free preview pack, the full pack won't change it.

    Now that Unity 5 is stable-ish I think it'll be moving to that.
     
  17. olivier-etienne

    olivier-etienne

    Joined:
    Feb 15, 2013
    Posts:
    13
  18. a-t-hellboy

    a-t-hellboy

    Joined:
    Dec 6, 2013
    Posts:
    180
    Hey, Is it optimized on mobile devices ? Both Android and iOS
    I've tested some blur shaders but non of them are fast and drop many FPS.
    Is there any .apk file that I can test it on my phone ?
     
  19. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    There is available on the asset store a free sample pack. I'm currently re-compiling everything for Unity 5.6.3 and 2017, but performance should be almost identical in most cases. Note that a lot of the effects have high/low/medium versions which affect performance and quality.
     
  20. a-t-hellboy

    a-t-hellboy

    Joined:
    Dec 6, 2013
    Posts:
    180
    Can you check City of Love : Paris game ? There is a blur shader on backgrounds that I think it is awesome. What do you think about blur performance in this game ?
     
  21. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    any chance of getting these to work with textures with alpha channels and have an alpha slider for the texture colour.a?

    Kinda useless right now, just shows up white with any texture with alpha
     
  22. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    83
    Hi there, i just bought your cooldown shader asset and i in need of some help. The button graphics that i want to use it on has rounded corners, which have looked fine before but now this shader colours the transparent bits of the texture. I cannot use it as i planed. Could you please help me with that?
     
  23. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    501
    I helped Zoltan here with adding transparency and adding UI-masking stencil support a few weeks ago, and I'm folding those into the next version. Honestly I haven't found any use case scenario for a lit version so far anyway.

    Note that this will be Unlit-only, for compatibility reasons. That means Unity 2018, Render Pipelines (since unlit/emissive isn't affected) and default render pipeline (fw/def). Should work in 2019 as well.

    The new versions are using the Unity SGE for editing, with pre-compiled versions for other uses (the shader is unlit, so pretty-much renderer-independent). ETA New Year, depending on the submission process!

    EDIT: Corrected spelling.
     
    Last edited: Dec 19, 2018