Issue with Silhouette Shader [video]

Full-scene Motion Blur for Unity Pro

Issue with Silhouette Shader [video]

Postby Paul » Sun May 03, 2015 6:52 pm

Hello Amplify Team,

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"
}
Paul
 
Posts: 1
Joined: Sun May 03, 2015 6:32 pm

Re: Issue with Silhouette Shader [video]

Postby Ricardo Teixeira » Thu May 07, 2015 2:03 pm

Hello Paul,

Thank you for trying out Amplify Motion, we really appreciate it.

This is a tricky one indeed, we will get back to you as soon as possible. Our apologies for the delayed reply, we are currently preparing a new AM update but you will have our full attention very soon.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Motion

Who is online

Users browsing this forum: No registered users and 0 guests