Multiple Pass w/Diffuse

I’m trying to create a shader that uses a rim light pass on top of a diffuse pass, but the rim light pass seems to keep overwriting the diffuse pass. Is there a way to prevent this?

Is this what you’re after?
http://www.unifycommunity.com/wiki/index.php?title=Velvet

Might be 1.6 though…
/Patrik

This is what I need, but unfortunately, this shader doesn’t work without pixel lights in the scene. I turned off all pixel lights in order to boost frame rates.

This is the shader in question. The shader right now only shows the rim light effect and the rest of the material is black. The diffuse pass doesn’t even show up. If I switch the passes, then the diffuse shows up and the rim light does not.

Shader "DiffuseOutline"
{
    Properties{
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB) Trans. (Alpha)", 2D) = "white" { }
   		_RampTex ("Outline Ramp (RGB)", 2D) = "white" {}
        _Shininess ("Shininess", Range (0.01, 1)) = 0.7
        _OutlineColor ("Outline Color", Color) = (1,1,1,1)

        _SpecColor ("Spec Color", Color) = (1,1,1,1)
	}
 
    Category{
        ZWrite On
        SubShader{
        	Pass {
				Material {
					Ambient (1,1,1,1)
					Diffuse [_Color]
					Shininess [_Shininess]
					Specular [_SpecColor]
				}
				Lighting On
				SetTexture [_MainTex] { constantColor [_Color] Combine texture * primary DOUBLE, texture * constant}
			
			}
			
 		    Pass{ 
				CGPROGRAM 
				#pragma vertex vert
				
				#include "UnityCG.cginc" 
				
				struct v2f{
				    V2F_POS_FOG;
				    float4 uv : TEXCOORD0;
				};
				
				v2f vert (appdata_base v){
				    v2f o;
				    PositionFog( v.vertex, o.pos, o.fog );
				
				    float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
				
				    o.uv.x = dot(viewDir,v.normal);
				    o.uv.y = 0.5;
				    o.uv.z = 0.0;
				    o.uv.w = 1.0;
				
				    return o;
				}
				
				ENDCG 
				
				SetTexture [_RampTex] {constantColor[_OutlineColor] } 
			}
        } 
    }
}

Have you tried setting the blend mode on your second pass?

Try inserting “Blend SrcAlpha One” on the line before you start the CGPROGRAM.

Thanks, man. That worked like a charm.