Home » Gradient Shader Pack

Gradient Shader Pack

by [email protected]

This is a paid asset, but now you can download the “Gradient Shader Pack” for FREE, Please keep in mind this package is provided only for learning purposes or to be able to test before buying the product, NOT FOR COMMERCIAL PURPOSES.

For more detail this asset from the Unity Asset Store: Click Here

Gradient Shader Pack v3.0

Download Now

Introduction

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.

Visit the Unity Forum Page

What’s New in 4.0

Shader-Graph support for “Graph Settings” target, now defaults to “Universal Pipeline” for the sprite shaders. This is required since around Shader Graph v10 or so when the graph settings target was added. 2020.3LTS is now the oldest supported unity version (previously 2019.2).

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.

Palletized Shaders

Palletized versions of shaders pull from a “palette texture”. The texture can be any size but will be smoother if it’s larger. For a one-dimensional palette, e.g. a 2048×1 texture is ideal. If you need more color control, use a larger texture. If you need less color control, you can use a smaller texture with bilinear filtering to automatically interpolate the colors.

You can also use a two-dimensional palette texture. This is a texture (any size/shape) which has multiple “rows” of palettes. Palette rows can be selected in the material properties using the “Palette Offset Y” texture coordinate. And since this value is exposed, it can also be animated/modified by animation clips or scripts. This allows an entire texture-based gradient to shift towards an entirely different palette or palettes over time. It also allows you to select between multiple palettes stored in a single texture. All palletized shaders allow you to adjust the horizontal UV coordinate and the vertical UV coordinate.

For shaders with two palette textures, you can either use the same texture twice (with or without different UV coords) or you can use two separate textures. Gradients will be generated interpolating “between” the two palettes.

Colors from the palette can include an alpha channel, if your palette texture is imported in an alpha-channel-supporting format e.g. RGBA.

The noise shaders will first generate the noise and then reinterpret the noise values as horizontal offsets in the palette texture. Brighter samples will convert to higher UV coordinates (later palette colors) and darker samples to lower UV coordinates (earlier palette colors).

Note that the Blob shader cannot use color inputs while also trying to apply a palette, because of the way meta-balls are calculated and combined. Instead, colors will be converted to grayscale in the shader before being converted to a palletized version.

Requirements

Minimum version of the Unity Editor for all shaders is 2019.2. This means the shaders no longer support any prior versions of Unity.

All shaders require and are built with the Unity Shader Graph editor (which is therefore a required package). The shader graph editor in earlier versions (e.g. 2019.1) does not support the Sprite shaders.

All gradients are generated based on input UV coordinates. Non-sprite textures use UV0 channel to generate the texture shape. Sprite (textured) gradients use UV0 for the sprite texture itself, so UV1 is used for the gradient. Sprites and other Unity geometry objects usually include UV0 and UV1 configured in a 0..1 range as normal. Geometry must contain UV coordinates!

Shader Graph shaders only work with the Unity Scriptable Render Pipelines such as the Universal/Lightweight Render Pipeline. If you use the Lit Sprite shaders, you’ll need to set up a 2D lighting environment including 2D lights and appropriate render-pipeline settings.

A folder of sub-graphs must be included with any project (it’s included with the asset). It includes shared shader-graph segments which are used by the shaders. So you’ll include the a shader, a material, and the sub graphs. These can be pruned down if you are more technically inclined and familiar with shader editing.

Color Space has an influence on the generated gradients because it affects the renderer’s interpretation of color. Gamma space may generally produce better blends of gradients on some shaders, but all shaders work in Linear or Gamma space. The output may look visually a little different on each.

See the screenshots for real examples of shader output! All images are generated in linear color space.

Related Videos