Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

NEW - Gradient Shader Pack - realtime animatable gradient shaders

Discussion in 'Assets and Asset Store' started by imaginaryhuman, Nov 6, 2019.

  1. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    CoverImage.jpg

    Gradient Shader Pack - New version 3!
    Realtime rendering of dynamic adjustable gradients
    25% off - now just $15

    See the Online Documentation


    Available now at the Unity Asset Store

    This is a pack of over 200 shaders. Each shader outputs a colorful gradient. You can save memory and performance by not having to use a texture! The gradient might be combined with one or two palette textures, and/or a sprite texture, depending on the shader. All material properties can be adjusted in realtime via script or animation clip.

    Gradients are re-rendered every frame. They can be animated, re-colored, re-used and can be combined to create more complex backgrounds or fills. Now with sprite shader/UI support, lighting/shadow/PBR support, lightweight and high-definition render pipeline support, and all shaders are editable with Shader Graph.​

    REQUIRES UNITY 2019.2 or later and a scriptable render pipeline!

    Gradients.jpg

    Palettized.jpg

    What’s New in 3.0

    A COMPLETE REWRITE: Version 3 is a complete rewrite of the entire pack from scratch. The old pack, version 2.2, was built for Unity 3.0 using hand-written OpenGL shaders. This was several years ago. Newer Unity technologies, faster mobile devices and new graphics API’s called for a complete rewrite.

    MORE SHADERS: The old pack featured 85 shaders, the new pack features over 200.

    MODERN TECH: All shaders are based on the Unity Scriptable Rendering Pipeline in order to support modern platforms and Unity features. They will not work without it.

    FULLY EDITABLE: All shaders are fully editable in the Unity Shader Graph editor, and are stored as Shader Graphs. All shaders can be modified to add or remove or adjust features.

    SPRITE AND UI SUPPORT: A new set of 40 sprite shaders has been added including 20 unlit and 20 lit shaders. The lit shaders are currently experimental. Sprite shaders work as normal Unity sprites and can be also used on Unity UI elements such as buttons. Note that sprite shaders are automatically alpha-blended but UI elements may behave differently. Sprite shaders replace old “textured” versions and are now the main way to combine a texture with a gradient.

    CLASSIC GRADIENT TYPES: Standard gradients include a more useable angular gradient, diamond gradient, the vertical gradient now doubles as horizontal (set angle = 90), and radial/circular/ellipse. Existing shaders such as Box4, Box6 and Box9 are included.

    NEW NOISE GRADIENTS: Three types of noise shaders have been added - one noise field, 3 noise fields, and 3 fields independently layered. There is also a noise shader which combines with a Box4 to transition between Box4 colors and noise colors.

    NEW BLOB GRADIENT: A new meta-ball/blob-based gradient has been added featuring 4 individually controllable blobs of color which combine to produce smoothly curved gradients. These allow you to individually move the location of multiple colored blobs.

    MORE BLEND MODES: All shaders except sprite shaders (which are automatically alpha blended) are now available in solid, alpha blended, additive and multiply blend modes. This means the output from the shader can be overlaid on top of the background or other objects (even gradients on top of gradients) as multiple layers. Additive blend is useful for lighting effects, while multiply is useful for shading effects or for “colorizing” parts of the scene.

    SUPPORT FOR LIGHTING: PRB versions of the shaders now support lighting and shadows per Unity’s Scriptable Rendering Pipelines. This means the shaders can be more effectively used in 3D environments, or with new 2D lighting. These shaders support light, specular highlights, and shadows. The lit sprite shaders also support normal mapping.

    MORE FLEXIBILITY: All shaders can be adjusted. The UV coordinates can be translated, rotated, and scaled which “positions” and scales the gradient effect. Colors can of course be adjusted and any transparency in the color will mix with any transparent from a texture (if any). Palettes can be animated by adjusting their horizontal or vertical offset within the palette texture. 2D palette textures are also now supported to allow another dimension of animation. UV coordinates can also be reversed in the material properties instead of a separate shader.

    BETTER PLATFORM SUPPORT: Since the new shaders are built with Shader Graph, Unity can automatically build optimized shaders for multiple platforms and graphics APIs. They can work with various rendering pipelines. The shaders are still performant on mobile devices, especially since modern mobile devices have better hardware, but also via the Lightweight/Universal Render Pipeline. Most shaders are cheap but blob/noise are more expensive.

    SMOOTHER SKY PALETTES: A set of 40 “sky palette” palette textures are included based on samples from real photos of skies. These have been smoothed to remove banding and produce very smooth gradients for instant sky gradients.

    NEW EXAMPLES: Includes 6 new example scenes. Hit play to see animation on some of them.
     
    Last edited: Nov 6, 2019
    Mauri likes this.
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Video showing realtime animated multi-palette gradients.

     
  3. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
  4. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Currently 25% off the normal price of $20. :)

    Also re the old version, it was written with Unity 3.5 in mind using old shader technology. The legacy version is still available here.

    But note that the old version, while it'll still pretty much run on 2019.2 or later, will not work with sprite/ui, does not have any of the upgrades or improvements, does not support scriptable render pipelines or lighting/shadows or other new stuff. Previous owners of the old version can upgrade to the new version for $10 currently, which is a 50% discount on the normal price. The differences between the shaders and Unity versions needed to run them though is quite dramatic so it may or may not be suitable for older projects. You'll have to import/upgrade old projects in 2019.2 editor or later, which could interfere with how your project works (e.g. javascript no longer supported, API upgrades, etc).

    The new version requires Unity 2019.2 or later and shader graph and a rendering pipeline.

    It does currently work with the HD render pipeline but the HD pipeline is still in preview, and the sprite shaders do not work with it currently. Hopefully they will be fixing/adding that support. It works fine with the lightweight render pipeline. I don't think it works without a pipeline (e.g legacy pipeline) because the shaders require shader graph which I think depends on the scriptable pipeline tech.
     
    KingVario likes this.
  6. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,845
    Hi @imaginaryhuman

    I just upgraded to your new gradient pack and also left a 5 stars review about it.

    There are few problems i encountered however:
    1- I applied an unlit gradient on a UI Image, which appeared nice in game view, but when i play; it disappear
    2- any plans for providing 200 examples scenes for those 200 gradient as not everyone have artistic skills and can simply use those samles
    3- any plans for providing an animated gradient examples?

    Thanks
     
  7. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Hi and thanks for the review etc.

    Some people seem to be having issues with UI images... have you tried a Sprite version of the shader, which is needed to support UI/sprite rendering?

    I will not be building 200 example scenes. The shaders are super easy to use. They are just materials. Just throw the material on whatever object you want to use it with.

    There are some animated gradient examples in the example scenes already.
     
    jGate99 likes this.
  8. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,845
    I havnt as game is purely Canvas Driven, what i want to do is keep that Gradient cover whole screen, if i can achieve this with sprite + ugui then please advise.


    I can understand if you are unable to make 200 xamples, in that case can you please tell me which shaders i should be focusing on for a pure2D (Canvas UGUI) game?
     
  9. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Either a sprite with a 'sprite' version of the shaders, or a basic quad with any of the shaders on it, can easily cover the screen. I don't know about UGUI, the sprite shaders are supposed to work with unity's gui.

    Try the sprite shaders first for 2D stuff, since the other 'lit' ones etc are more for 3d or lighting/shadows.
     
    jGate99 likes this.
  10. chyen

    chyen

    Joined:
    Sep 1, 2014
    Posts:
    9
    Hi there,

    I just purchased the assets and updated some of the packages to clear the errors popped out in the editor.
    Now my editor is error free but the shader keep showing pink square. May I know what am i missing?

    Please find the packages manager which briefly shows the installed packages.

    Not really sure what am i missing as the document didnt tell setup environment for this shader to work.
     

    Attached Files:

    zspof and kk99 like this.
  11. chyen

    chyen

    Joined:
    Sep 1, 2014
    Posts:
    9
    And my Unity version is 2019.3.0f6.
     
  12. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Hi, sorry for the delay.

    There is nothing wrong with the shader pack. The issue is with your lightweight render pipeline asset. For example your first error says "pixel perfect rendering does not exist in the namespace unity engine.experimental.u2d" .... this has something to do with either the versions of the render pipeline asset you've installed and possible incompatibility between them or bugs in them, or some asset hasn't been installed. It relates to the package manager. I had another person with an issue and it basically turned out that a newer version of the render pipeline package had bugs in its and was throwing errors causing shaders to go pink etc. The "lightweightrenderpipeline.cs vex manager is inaccessible due to its protection level" is nothing to do with the gradient pack either, it's something to do with Unity's code or some error or bug in some kind of package you installed. Sometimes trying an older version of a package may work better. Yes the shaders will go pink if you don't have a properly working render pipeline setup.

    There is a folder in the gradient pack called Internal which needs to be included in the project, I don't think it matters where it is included. It contains some sub-shader graphs which other materials/shaders import and require. IT just needs to be in the project somewhere. Once it is, the shaders should work. If they are not working, it's more to do with a render pipeline not working right.
     
  13. chyen

    chyen

    Joined:
    Sep 1, 2014
    Posts:
    9
    I already reverted back to the earliest version of assets and dependencies and it is still pink. I have difficulty understanding the errors as I m not a programmer however I will try a few more times before I giving up.
     
  14. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Did you also install Shader Graph package? It is required.
     
  15. chyen

    chyen

    Joined:
    Sep 1, 2014
    Posts:
    9
    Yes I installed that. Anyway I managed to get it work by creating a "Universal Template Project". "2D Project" will not work as it will not generate the relevant RP file. I tried recreating it myself in 2D project but it just didnt work.

    And then I copied all the Universal RP .assets file under Settings folder and move it to my actual project. Within my actual project then I put in the desired RP .assets file in the Project setting > Graphic option.

    The pink box is no longer than and i will report again if i face more problem. Thank you for your help.
     
  16. kk99

    kk99

    Joined:
    Nov 5, 2013
    Posts:
    81
    NOT WORKING


    I included sub graph but still nothing is working...
    upload_2020-6-14_5-39-18.png


    upload_2020-6-14_5-40-10.png
     
  17. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Just to be clear, the shader pack is working 100% correctly. The shaders are built using shader graph. Shader graph is a Unity functionality. They are nothing more than ‘data’ really within the shader graph tool. So long as the shader graph tool is working correctly, so too will the shaders work correctly. They are not custom programmed nor do they have any bugs. If you are getting pink on your shaders, something has not been set up correctly by the user.

    Please refer to the instructions given. You must install a universal/lightweight render pipeline package and set it up correctly by creating a pipeline asset in the project and setting it in the project settings. You must also install the shader graph package. Once both are present, there is no reason why the shaders should not be working. The only reason I’ve seen them not work, is if Unity has introduced a bug in the current version of the packages. Sometimes I’ve found that going back to a previous version makes it work. This is nothing to do with the shader pack its to do with Unity’s systems. The only other requirement as you mentioned is including the ‘sub shaders’ folder in with the project so that the shader graphs work. It looks like you have shader graph installed. Do you have the render pipeline set up?
     
  18. kk99

    kk99

    Joined:
    Nov 5, 2013
    Posts:
    81


    I did install and tested everything and I did do it literally more than 10 times with different Unity Versions and with all kind of scenarios.

    I found the solution here https://answers.unity.com/questions/1535235/shader-graph-error-the-current-render-pipeline-is.html
     
  19. PatrickManalich

    PatrickManalich

    Joined:
    May 18, 2016
    Posts:
    1
    Hi!

    I first wanted to say this is a very cool asset! I really appreciate the effort you put into it and how professional of an asset it is. I've run into an issue, and unfortunately my lack of shader knowledge isn't helping. I'd like to use a material on a UI image under a canvas, since my entire project is Canvas driven. I looked at some of the comments and it seems a few people have asked about this already. Your common response is that the Sprite materials should work (if I'm understanding your answers correctly). I tried putting the materials from the Unlit/Sprite/Palettized and Unlit/Sprite/Regular and the result is a black image. If I put the Unlit/Palettized/Additive Blend materials on the image, the texture will show but I receive the warning:

    Material doesn't have a texture property '_MainTex'
    UnityEngine.Canvas:SendWillRenderCanvases()

    Is there any way to make your shaders work properly with Canvas elements? I may be missing something, because as I said before I have little-to-none shader experience.

    Much appreciated!
     
  20. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    The issue of unity saying there is no _MainTex, if I recall, was happening on an earlier version of shader graph which did not yet support sprite shader targets properly. This was later fixed in a more recent version of unity. An old hack was to edit the shader in shader graph and try to rename a texture as _MainTex, but then unity would complain that it was already defined. lol