UniversalViewer/Assets/KF3/Shader/DepthShader.shader

82 lines
4.5 KiB
Plaintext
Raw Normal View History

// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "DepthShader"
{
Properties
{
_Cutoff( "Mask Clip Value", Float ) = 0.5
_Outline_Width("Outline_Width", Float) = 0
_MainTex("MainTex", 2D) = "white" {}
[HideInInspector] _texcoord( "", 2D ) = "white" {}
[HideInInspector] __dirty( "", Int ) = 1
}
SubShader
{
Tags{ "RenderType" = "Opaque" "Queue" = "AlphaTest+0" "IgnoreProjector" = "True" "IsEmissive" = "true" }
Cull Back
CGPROGRAM
#include "UnityShaderVariables.cginc"
#pragma target 3.0
#pragma surface surf Standard keepalpha noshadow vertex:vertexDataFunc
struct Input
{
float eyeDepth;
float2 uv_texcoord;
};
uniform float _Outline_Width;
uniform float Length;
uniform float Offset;
uniform sampler2D _MainTex;
SamplerState sampler_MainTex;
uniform float4 _MainTex_ST;
uniform float _Cutoff = 0.5;
void vertexDataFunc( inout appdata_full v, out Input o )
{
UNITY_INITIALIZE_OUTPUT( Input, o );
float3 ase_vertexNormal = v.normal.xyz;
v.vertex.xyz += ( ase_vertexNormal * ( _Outline_Width * 0.001 ) );
v.vertex.w = 1;
o.eyeDepth = -UnityObjectToViewPos( v.vertex.xyz ).z;
}
void surf( Input i , inout SurfaceOutputStandard o )
{
float cameraDepthFade1 = (( i.eyeDepth -_ProjectionParams.y - Offset ) / Length);
float3 temp_cast_0 = (cameraDepthFade1).xxx;
o.Emission = temp_cast_0;
o.Alpha = 1;
float2 uv_MainTex = i.uv_texcoord * _MainTex_ST.xy + _MainTex_ST.zw;
clip( tex2D( _MainTex, uv_MainTex ).a - _Cutoff );
}
ENDCG
}
CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=18500
287;309;1382;648;779.9207;284.6495;1.046712;True;False
Node;AmplifyShaderEditor.RangedFloatNode;8;-347.5857,445.3018;Inherit;False;Property;_Outline_Width;Outline_Width;1;0;Create;True;0;0;False;0;False;0;1;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;5;-743.1245,-136.5234;Inherit;False;Global;Length;Length;0;0;Create;True;0;0;False;0;False;5;35;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;6;-749.1449,-49.33564;Inherit;False;Global;Offset;Offset;1;0;Create;True;0;0;False;0;False;0;0;0;0;0;1;FLOAT;0
Node;AmplifyShaderEditor.NormalVertexDataNode;9;-344.5857,255.3022;Inherit;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.ScaleNode;10;-148.3429,440.3138;Inherit;False;0.001;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.CameraDepthFade;1;-525.7656,-123.8789;Inherit;False;3;2;FLOAT3;0,0,0;False;0;FLOAT;1;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-49.58564,304.3021;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.SamplerNode;12;-345.4782,-1.867204;Inherit;True;Property;_MainTex;MainTex;2;0;Create;True;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.OneMinusNode;4;-213.0137,-175.1542;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;15;229.2125,14.16482;Float;False;True;-1;2;ASEMaterialInspector;0;0;Standard;DepthShader;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Custom;0.5;True;False;0;True;Opaque;;AlphaTest;All;14;all;True;True;True;True;0;False;-1;False;0;False;-1;255;False;-1;255;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;False;2;15;10;25;False;0.5;False;0;5;False;-1;10;False;-1;0;1;False;-1;1;False;-1;0;False;-1;0;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;;0;-1;-1;-1;0;False;0;0;False;-1;-1;0;False;-1;0;0;0;False;0.1;False;-1;0;False;-1;False;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0;False;9;FLOAT;0;False;10;FLOAT;0;False;13;FLOAT3;0,0,0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
WireConnection;10;0;8;0
WireConnection;1;0;5;0
WireConnection;1;1;6;0
WireConnection;11;0;9;0
WireConnection;11;1;10;0
WireConnection;4;0;1;0
WireConnection;15;2;1;0
WireConnection;15;10;12;4
WireConnection;15;11;11;0
ASEEND*/
//CHKSM=6B241380E5AA10943B14A993E72468FA220D6D4E