Shaders

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Unity 3.x Shaders)
(Unity 5.x Shaders)
 
(16 intermediate revisions by 11 users not shown)
Line 1: Line 1:
== Guidelines ==
+
This is a collection of '''shaders'''. If you are new to the topic of shaders, you should read [[Getting Started with Shaders|this introduction]] to shader programming and the general concepts about shaders in general.
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.
+
When adding shaders to this list, 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 ==
 
== Official Shaders ==
  
*[http://unity3d.com/support/resources/assets/built-in-shaders Built In Shaders] - Here you can get the sourcecode for all the shaders that are built into Unity.
+
*[http://forum.unity3d.com/threads/builtin-unity-shaders-source.2085/ Source] - Here you can get the sourcecode for all the shaders that are built into Unity.
 +
 
 +
== Unity 5.x Shaders ==
 +
*[[Lux]] - an open source shader framework
  
 
== Unity 4.x Shaders ==
 
== 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.
 
* [[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 ==
 
== Unity 3.x Shaders ==
Line 17: Line 23:
 
*[[Vertex/Fragment Template]] - A basic template for writing your own vertex/fragment combination shader
 
*[[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
 
*[[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.
 
*[[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.
 
*[[MatCap]] - A bumped shader without lighting, for use with materials from programs like ZBrush.
Line 23: Line 30:
 
*[[Planet]] - A shader which adds an atmosphere and shading for one pointlight source to a planet.
 
*[[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.
 
*[[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.
 
*[[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.
 
*[[TransparentShadowReceiver]] - Can handle transparency and takes it into account for receiving shadows from both Spot/Point lights and Directional lights.
Line 36: Line 44:
 
*[[3SideProjDiffuseSurface]]- Modification of [[3SideProjDiffuse1.1|2.x vesion]].
 
*[[3SideProjDiffuseSurface]]- Modification of [[3SideProjDiffuse1.1|2.x vesion]].
 
*[[BumpMappedAndPointLightBasePass]]- A shader for computing lightmapping and a point light in a single pass (the base pass).
 
*[[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.
  
 
== Unity 2.x Shaders ==
 
== Unity 2.x Shaders ==
Line 66: Line 75:
 
*[[FXTrigField]] - Special effect for things like force fields.
 
*[[FXTrigField]] - Special effect for things like force fields.
 
*[[MirrorReflection2]] - A shader and script to make reflective mirrors.
 
*[[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).
 
*[[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.
 
*[[TextureMask]] - A simple shader that will allow you to mask of parts of a texture.

Latest revision as of 10:08, 3 August 2016

This is a collection of shaders. If you are new to the topic of shaders, you should read this introduction to shader programming and the general concepts about shaders in general.

When adding shaders to this list, 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.

Contents

[edit] Official Shaders

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

[edit] Unity 5.x Shaders

  • Lux - an open source shader framework

[edit] Unity 4.x Shaders

[edit] Unity 3.x Shaders

[edit] Unity 2.x Shaders

[edit] Porting Shaders

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

[edit] Debugging

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


[edit] 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.

[edit] 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.

[edit] 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.

[edit] 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.

[edit] 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.

[edit] Terrain

[edit] Toon

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

[edit] 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

[edit] 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!

[edit] 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.

[edit] 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.

[edit] Interface

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

[edit] Lightmap

[edit] 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.

[edit] 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