You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wlt233 c49477a927
init (v0.7)
2 years ago
..
CGIncludes init (v0.7) 2 years ago
Editor init (v0.7) 2 years ago
CGIncludes.meta init (v0.7) 2 years ago
CameraDepthNormalsTexture.shader init (v0.7) 2 years ago
CameraDepthNormalsTexture.shader.meta init (v0.7) 2 years ago
CameraDepthTexture.shader init (v0.7) 2 years ago
CameraDepthTexture.shader.meta init (v0.7) 2 years ago
CameraNormalsTexture.shader init (v0.7) 2 years ago
CameraNormalsTexture.shader.meta init (v0.7) 2 years ago
Editor.meta init (v0.7) 2 years ago
README.md init (v0.7) 2 years ago
README.md.meta init (v0.7) 2 years ago
ShaderShared.cginc init (v0.7) 2 years ago
ShaderShared.cginc.meta init (v0.7) 2 years ago
SpriteDepthNormalsTexture.shader init (v0.7) 2 years ago
SpriteDepthNormalsTexture.shader.meta init (v0.7) 2 years ago
SpriteLighting.cginc init (v0.7) 2 years ago
SpriteLighting.cginc.meta init (v0.7) 2 years ago
SpritePixelLighting.cginc init (v0.7) 2 years ago
SpritePixelLighting.cginc.meta init (v0.7) 2 years ago
SpriteShadows.cginc init (v0.7) 2 years ago
SpriteShadows.cginc.meta init (v0.7) 2 years ago
SpriteUnlit.cginc init (v0.7) 2 years ago
SpriteUnlit.cginc.meta init (v0.7) 2 years ago
SpriteVertexLighting.cginc init (v0.7) 2 years ago
SpriteVertexLighting.cginc.meta init (v0.7) 2 years ago
SpritesPixelLit.shader init (v0.7) 2 years ago
SpritesPixelLit.shader.meta init (v0.7) 2 years ago
SpritesUnlit.shader init (v0.7) 2 years ago
SpritesUnlit.shader.meta init (v0.7) 2 years ago
SpritesVertexLit.shader init (v0.7) 2 years ago
SpritesVertexLit.shader.meta init (v0.7) 2 years ago

README.md

Contributed by ToddRivers

Unity Sprite Shaders

An Uber Shader specialised for rendering Sprites in Unity. Even though it's designed for Sprites it can be used for a whole range of uses. It supports a wide range of optional shader features that won't effect performance unless they are used. It also supports per-pixel effects such as normal maps and diffuse ramping whilst using Vertex Lit rendering.

Lighting

The shaders support lighting using both Forward Rendering and Vertex Lit Rendering. Forward rendering is more accurate but is slower and crucially means the sprite has to write to depth using alpha clipping to avoid overdraw. Vertex lit means all lighting can be done in one pass meaning full alpha can be used.

Normal Mapping

Normals maps are supported in both lighting modes (in Vertex Lit rendering data for normal mapping is packed into texture channels and then processed per pixel).

Blend Modes

Easily switch between blend modes including pre-multiplied alpha, additive, multiply etc.

Rim Lighting

Camera-space rim lighting is supported in both lighting modes.

Diffuse Ramp

A ramp texture is optionally supported for toon shading effects.

Shadows

Shadows are supported using alpha clipping.

Gradient based Ambient lighting

Both lighting modes support using a gradient for ambient light. In Vertex Lit mode the Spherical Harmonics is approximated from the ground, equator and sky colors.

Emission Map

An optional emission map is supported.

Camera Space Normals

As sprites are 2d their normals will always be constant. The shaders allow you to define a fixed normal in camera space rather than pass through mesh normals. This not only saves vertex throughput but means lighting looks less 'flat' for rendering sprites with a perspective camera.

Color Adjustment

The shaders allow optional adjustment of hue / saturation and brightness as well as applying a solid color overlay effect for flashing a sprite to a solid color (eg. for damage effects).

Fog

Fog is optionally supported

To Use

On your object's material click the drop down for shader and select Spine\Sprite\Pixel Lit, Vertex Lit or Unlit.