background preloader

Shader tutorials

Facebook Twitter

Holographic Shader by Aubergine. "Mobile Bloom" Shader from Angry Bots results in splash screen freeze in Xcode. Resources for the Lowpoly Artist. Surface Shader Examples. Here are some examples of Surface Shaders. The examples below focus on using built-in lighting models; examples on how to implement custom lighting models are in Surface Shader Lighting Examples. Simple We'll start with a very simple shader and build up on that. Here's a shader that just sets surface color to "white". It uses built-in Lambert (diffuse) lighting model. Here's how it looks like on a model with two lights set up: Texture An all-white object is quite boring, so let's add a texture.

Shader "Example/Diffuse Texture" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType" = "Opaque" } CGPROGRAM #pragma surface surf Lambert struct Input { float2 uv_MainTex; }; sampler2D _MainTex; void surf (Input IN, inout SurfaceOutput o) { o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb; } ENDCG } Fallback "Diffuse" } Normal mapping Let's add some normal mapping: Rim Lighting Now, try to add some Rim Lighting to highlight the edges of an object. Detail Texture Linear Fog. Team Fortress 2 & Anisotropic Highlight Unity Shaders. Just a note that I’ve put up a couple of Unity Surface Shaders onto the Unify Community Wiki.

Team Fortress 2 This replicates the toon ramp shader that Valve’s Team Fortress 2 uses. With a toon ramp and rim lighting. Code and usage instructions here. Anisotropic Highlights This replicates the anisotropic highlights you find on surfaces like brushed metal and long hair. Code and usage instructions here. About Farfarer Author of this blog. Deforming Vertex causes weird jumps [images attached] Hello, I am attempting to create a vertex deforming shader which causes a kind of rotating-world effect (used in e.g. more recent Animal Crossing games). Here is my shader (modified from the mesh deformation example provided on Unity's website): Code: Properties { Cyclindrical world. James O'Hare, Game Character Artist, Blog. DICE Presentation I’ve worked up a translucency shader for Unity3D based on DICE’s “Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look” presentation. In Action. Basics-of-the-strumpy-shader-editor.

Smoke trail shader tutorial. This is a tutorial on getting bones that are part of an animated skeleton to be controlled by Unity’s physics system rather than animation, i.e. ragdoll or jiggle bones. It took me a while to figure out the specifics of getting it working. This method will also work with 3DS Max Bipeds Twist bones, which rely on the animation being fully baked. Click on any of the images for a larger version. Setting Up In 3DS Max Set up and skin your rig as you usually would. In my case, I have some dangling belt attachments and my characters ponytail intended to be jiggle bones. The Key to Jiggle Bones The important thing to note is that, while all of my regular bones are keyframed into the T-Pose, the jiggle bones do not have keyframes. It is imperative that the jiggle bones remain unkeyframed throughout your T-Pose and all of your animations.

Exporting the T-Pose Go to Export > Export Selected and choose FBX as the format. Exporting Animations What do we do? Setting Up in Unity The Parent Bone The Jiggle Bone.