Loving the amplify motion effect so far, however I was wondering if it's possible to disable the blur effect in the following case. I'm using a custom silhouette shader (similar to the one here, but... simplier) and unfortunately when the silhouette is visible, it becomes blurred and the movement is quite jittery. I have the player ignored on the Culling Mask which I have confirmed is working, but not for the silhouette. My knowledge of the motion blur algorithm is limited, so I'm not really sure what, if anything can be done. Perhaps there is another way to achieve this silhouette effect?
Video Here: http://imgur.com/66YRl1Q
Thanks! Paul
I'm running an older Unity 4.3 on Windows 8 with an NVidia GTX 770 w/ Amplify Motion for Unity 4.
- Code: Select all
Shader "Custom/Silhouette" {
// https://docs.unity3d.com/Documentation/Components/SL-BuiltinValues.html
Properties {
_MainTex("Main Texture", 2D) = "white" {}
_SilhouetteColor("Silhouette Color", Color) = (1.0, 0.0, 0.0, 1.0)
_SilhouetteWidth("Silhouette Width", Range(0.0, 0.1)) = 0.0
}
SubShader {
Tags { "Queue" = "Geometry+1" "RenderType"="Opaque" } // Geo+1 to render after all other geometry
Pass {
Cull Back
ZWrite Off // Do not write depth values during the silhouette pass
ZTest Always
Blend SrcAlpha OneMinusSrcAlpha
BlendOp Add
Fog { Mode Off }
LOD 200
// First Pass: Render the silhouette on top of everything else
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
uniform float4 _SilhouetteColor;
uniform int _EnableSilhouette;
uniform float _SilhouetteWidth;
struct vertInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tex0 : TEXCOORD0;
};
struct fragInput {
float4 pos : SV_POSITION;
};
fragInput vert(vertInput i) {
fragInput o;
// Adjust silhouette size by extruding normals in model space
float3 silhouetteOffset = _SilhouetteWidth * i.normal;
i.vertex.xyz += silhouetteOffset.xyz;
o.pos = mul(UNITY_MATRIX_MVP, i.vertex);
return o;
}
float4 frag(fragInput i) : COLOR {
return _SilhouetteColor * _EnableSilhouette;
}
ENDCG
}
// Second Pass: Render the model (occluding parts of the silhouette) normally with lighting
CGPROGRAM
#pragma surface surf Lambert
#include "UnityCG.cginc"
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
void surf(Input IN, inout SurfaceOutput o) {
float4 col = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = col.rgb;
}
ENDCG
}
FallBack "Diffuse"
}