Shaders

Guidelines
This is a collection of shaders. See "Getting Started with Shaders" for an introduction to shader programming and learning material about shaders in general.

Please include a sample image or two showing off your shader goodness. If unsure how to do this, you can view a good example on the SkinShader2 page, as a reference.

Official Shaders

 * Built In Shaders - Here you can get the sourcecode for all the shaders that are built into Unity.

Unity 4.x Shaders

 * Transparent Single Color Shader - A shader that fills polygons with a single color and supports transparency. For text meshes or as a basis for other GUI-related shaders.
 * Dithering Shader - A color replacement and dithering shader.
 * Physically-inspired Shader - A shader inspired by physically-based shading techniques
 * Translucent Shader - A shader for different translucent surfaces (for example: skin, paraffin, plastic etc.)
 * Procedural Circle Mask - An alpha blended shader that creates a mask in the shape of a circle in UV space

Unity 3.x Shaders

 * Cg_Tutorial_to_Unity - Porting of Cg tutorial source code
 * Cg_Shader_Patterns - Multiple Pixel Lights
 * Vertex/Fragment Template - A basic template for writing your own vertex/fragment combination shader
 * Image Effect Template - A basic template for writing your own image effect shader, using just an exposed fragment program
 * TerrainTransparency - Enables the use of transparent textures on terrains.
 * Earth/Planet - A shader for the Earth (and other planets) with nighttime lights, elevation, subtle atmosphere, and other features.
 * MatCap - A bumped shader without lighting, for use with materials from programs like ZBrush.
 * Fur (Unity3) - A remake for Unity 3 support of a fur shader by Jonathan Czeck found in unity
 * Skin Shader 3 - The classic skin shader redone for Unity 3 by forum user bournifle
 * Planet - A shader which adds an atmosphere and shading for one pointlight source to a planet.
 * Dissolve With Texture - A simple shader which dissolves objects, using an image as guidance.
 * Glass Shader - Fully transparent, reflective shaders suitable for glass.
 * TransparentShadowCaster - Can handle transparency and takes it into account for casting shadows.
 * TransparentShadowReceiver - Can handle transparency and takes it into account for receiving shadows from both Spot/Point lights and Directional lights.
 * TerrainFourLayerToon - A terrain shader similar to TerrainFourLayer, but designed for games that use Unity's prepackaged Toon shaders for just about everything.
 * TeamFortress2Shader - A toon ramped shader with vertical rim light, similar to the shading model found in Team Fortress 2.
 * Anisotropic Highlight Shader - A shader that allows anistotropic highlights to be defined based on a directional texture. Good for brushed metal and hair.
 * Outlined Diffuse 3 - Toon outline on a normal diffuse shader, compatible with Unity 3.
 * Silhouette-Outlined Diffuse - A variant of the Outlined Diffuse 3 showing outlines only at the exteriors of the object.
 * Lighted Bumped Outline - A mix between built-in Toon Lighted Outline and Bumped Diffuse.
 * MirrorReflection3 - Makes a direct, mirror like reflection. Updated version of MirrorReflection2
 * Transparent Cutout Soft Edge Unlit Texture Blend Transparent Soft Edge Cutout Shader with blending between two textures given a blend factor. Useful for transitions.
 * Transparent_Diffuse_Two_Pass_Lit_Shadows Transparent two pass soft edge cutout shader with shadows and diffuse lighting
 * 3SideProjDiffuseSurface- Modification of 2.x vesion.
 * BumpMappedAndPointLightBasePass- A shader for computing lightmapping and a point light in a single pass (the base pass).
 * CGVertexLit - A default Vertexlit shader, rewritten in CG.

Porting Shaders

 * ShaderPortingNotes - Some guidelines for porting shaders between FX composer, RenderMonkey, Mental Mill, ShaderFX and Unity

Debugging

 * BarycentricWireframeUv1 - A wireframe shader for barycentric uvs.


 * Delta - Visualize loss of detail caused by texture compression.


 * NormalSmoothing - Visualize normal smoothing.

Fullscreen Effects (Unity Pro only)

 * ColorBlindness - Coarse simulation of what your game might look like to someone who is red/green colorblind.
 * DreamBlurEffect - Yet another bloom/glow style effect (Post Render Effect, requires Unity Pro).
 * GreenNightVision - A night vision effect (Post Render Effect, requires Unity Pro).
 * RefractionEffect - Fullscreen refraction effect. Can be used for raindrops, blood, underwater effects and others. Including color and color mask.

FX

 * Anisotropic 2.x - Updated anisotropic lighting for version 2.x
 * DepthMask - For cutting holes in objects without changing geometry.
 * DesaturatedDarks2 - Non-lit areas are desaturated; lights "saturate" the colors (updated for v2).
 * FXHyperbolicStatic - Special effect for things like force fields.
 * FXHyperbolicStaticParticle - Special effect for things like energy balls with particle systems.
 * FXTrigField - Special effect for things like force fields.
 * MirrorReflection2 - A shader and script to make reflective mirrors.
 * SurfaceReflection - For reflective windows, textured mirrors, or other reflective/transparent/textured surfaces.
 * Shield - A shader and script to make Shields spheres around your units (works with other shapes too).
 * TextureMask - A simple shader that will allow you to mask of parts of a texture.
 * Unlit - A shader that doesn't use lighting, useful for dashboard and other 3D GUI components.
 * Binary - Limits down textured models to 2 individual colors.
 * ProjectorAdditive - A shader for the projector component that does an additive/screen effect as opposed to multiply.
 * XRay - Additive X-Ray shader.
 * Planet - A shader which adds an atmosphere and per pixel lighting to your planets.
 * Fur - A basic fur shader with some minor(?) sorting problems.

General

 * BakedVertexColorBumpSpec2 - Lightmap in vertex colors, bumped specular.
 * BumpSpecRim - Bumpmapped specular with fake rim light affected by bump map.
 * BumpColorSpec - Bumpmapped specular with colored specular map.
 * ReflectiveVertexlitSimple - Simplified Reflective VertexLit shader, with a slider to control amount instead of alpha channel.
 * SkinShader2 - Shadow-supporting wrapped-diffuse+ specular + bumped + rim + fresnel shader. Good for skin shading!
 * 3SideProjDiffuse - Per pixel shaded autotexturing. No need for an UV-Map!
 * 3SideProjDiffuse1.1 - Added the option of selecting different textures for X, Y and Z coordinates.
 * ReliefDiffuse - Bumpmapped reliefmapping shader.
 * ReliefSpecular - Bumpmapped reliefmapping shader with specularity.

Interface

 * 3DText - Use this instead of the default shader when creating 3D Text, so the text doesn't always appear on top of objects.
 * TexturedFont - Use this shader in place of the built in Text Shader for multicolored fonts instead of solid colored ones.

iPhone
These shaders are targeted at the original iPhone and iPod touch.


 * Blend 2 Textures - Blends two textures based on a slider, with an option to use light from Simply Lit
 * Blend 2 Textures by Lightmap Alpha - A lightmapped shader that blends two tiling textures based on a splatmap.
 * Masked Tint - Selectively tint your models based on a mask; render multiple differently-colored objects with only one total draw call.
 * Simply Lit - Uses ambient and diffuse vertex lighting to affect a single texture.
 * Texture Only - Maps a 2D texture onto your model, in 3D!
 * VertexColorUnlit - Two shaders for using with vertex-colored meshes; allows overbrightening
 * iPhoneGems -Using the gem .unitypackage from the unity website will cause poor gem shading on the iphone, this is their code including an update to the sub-shader that makes nicer iphone gems.

Terrain

 * LayerShader - A terrain shader that mixes two tileable textures.
 * TerrainTwoLayerBumped - A terrain shader that mixes two tileable textures, plus a bumpmap.
 * TerrainFourLayerDiffuseFast - A terrain shader that mixes four tileable textures, and also works like the Diffuse Fast shader.
 * TerrainFourLayer2Pass - A terrain shader that mixes four tileable textures; should work on all modern cards and has fog.
 * FourSplatBlendWrapShader - A terrain shader that mixes and wraps 4 diffuse splats from a 4x4 texture sheet.

Toon

 * ToonShadowed - Variant of the Toon-Basic shader that receives shadows.
 * OutlinedDiffuse - Variant of the Toon-Basic shader that uses diffuse shading for surfaces

Transparent

 * AlphaClipsafe - Like Particles/Alpha Blended, but fades out before it intersects the camera's near clipping plane.
 * AlphaSelfIllum - Textures object which is unaffected by light.
 * AlphaVertexLitZ - Just like Transparent/VertexLit, but with proper depth buffering. Useful for objects that need to fade out.
 * UnlitAlphaWithFade - Unlit shader similar to AlphaSelfIllum, but with the alpha of the colour taken into account to allow fading.
 * AlphaDiffuse2sided - Transparent 2-sided rendering

Unity 1.x Shaders
Most of these will just work with Unity 2.x, except mostly for complex pixel-lit shaders. If you verified that a shader from this list works with 2.x, add it to the list above as well!

FX

 * Refraction - A fake refraction shader.
 * DepthMask - Masks areas with the depth buffer to cut holes in subsequent objects.
 * DesaturatedDarks - Non-lit areas are desaturated; lights "saturate" the colors.
 * MirrorReflection - A shader and script to make reflective mirrors.
 * MirrorReflectionLightmapped - A shader and script to make reflective mirrors with a lightmap.
 * ProjectorAdditive - A shader for the projector component that does an additive/screen effect as opposed to multiply.
 * SkyboxBlended - A skybox that blends between two sets of skybox textures.
 * Velvet - Velvet / Rim light shader
 * XRay - Additive X-Ray shader.

General

 * Anisotropic - A classical anisotropic lighting.
 * BumpSpecModulate - Bump mapped shader that modulates between original texture color and "alpha color" based on alpha of main texture.
 * Decal2UVs - Just like builtin Decal, just uses two UV sets.
 * SimpleAdditive - Colors a object with a single additive color.
 * SkinShader - A wrapped-diffuse plus specular plus rim righting shader. Good for skin shading!
 * TextureAdditive - Colors a object with a additive texture.
 * VertexColor - A vertex lit shader that takes per-vertex colors into account.
 * VertexColorParallaxBump - Like the builtin Diffuse Parallax Bump, only takes vertex color into account as well.

Interface

 * Reveal Non-Uniform Texture - A shader for revealing a texture using another texture. Useful for non-rectilinear loading / progress bars.

Lightmap

 * BakedLightingDetailTexture - A main+detail texture shader with precomputed per-vertex lighting.
 * BakedVertexColorLighting - Like lightmapping only the lighting is precomputed in the vertex colors

Terrain

 * LayerShader - A terrain shader that mixes two tileable textures.
 * TerrainFourLayer - A terrain shader that mixes four tileable textures.
 * TerrainTwoLayerBumped - A terrain shader that mixes two tileable textures, plus a bumpmap.
 * VegetationTwoPass - Great vegetation shader, renders opaque and then renders semitransparent.
 * VegetationVertexLit - Vertex-lit shader with no culling that is ideal for vegetation and other two sided polygon models.

Transparent

 * AlphaDiffuseZ - Same as Unity Alpha Diffuse but with different Z buffering. Useful for interior (reversed normal) scenes that have alpha objects.
 * AlphaSelfIllum - Textures object which is unaffected by light.
 * AlphaVertexColor - A transparent vertex lit shader that takes per-vertex colors into account.
 * BlendedDecal - Suitable for superimposing alpha-masked textured markings onto the same plane as another surface.
 * BlendedFlatColor - Colors a transparent object, good for HUD objects.
 * UnlitAlpha - A non-backface culled, unilluminated, alpha tested shader which is suitable for sprites.
 * WindowShader - Suitable for windows (the glass things in houses, not the darn Seattle company.)
 * SeeObjectsBehindOthers - Good for if you always want to be able to see an object(3D HUD instead of GUI, or seeing a player behind a wall.)