Shaders

From Unify Community Wiki
Jump to: navigation, search

Contents

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

  • [1] - Here you can get the sourcecode for all the shaders that are built into Unity.

Unity 4.x Shaders

Unity 3.x Shaders

Unity 2.x Shaders

Porting Shaders

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

Debugging

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


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

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

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.)
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox