├── .gitignore ├── Assets ├── Materials.meta ├── Materials │ ├── 00.mat │ ├── 00.mat.meta │ ├── 01.mat │ ├── 01.mat.meta │ ├── 02.mat │ └── 02.mat.meta ├── Scenes.meta ├── Scenes │ ├── Demo.unity │ └── Demo.unity.meta ├── Scripts.meta ├── Scripts │ ├── Example.cs │ ├── Example.cs.meta │ ├── HolographicEffect.cs │ ├── HolographicEffect.cs.meta │ ├── HolographicRenderer.cs │ └── HolographicRenderer.cs.meta ├── Shaders.meta ├── Shaders │ ├── MosicEffect.shader │ ├── MosicEffect.shader.meta │ ├── WorldMPosRenderer.shader │ └── WorldMPosRenderer.shader.meta ├── Textures.meta └── Textures │ ├── 1.jpg │ ├── 1.jpg.meta │ ├── 2.jpg │ ├── 2.jpg.meta │ ├── misc03.jpg │ ├── misc03.jpg.meta │ ├── misc03n.jpg │ ├── misc03n.jpg.meta │ ├── paving11.jpg │ └── paving11.jpg.meta ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset └── UnityConnectSettings.asset └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Visual Studio 2015 cache directory 9 | /.vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | 26 | # Unity3D generated meta files 27 | *.pidb.meta 28 | 29 | # Unity3D Generated File On Crash Reports 30 | sysinfo.txt 31 | 32 | # Builds 33 | *.apk 34 | *.unitypackage 35 | -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d74138800a474d4a8af38759ff3e51f 3 | folderAsset: yes 4 | timeCreated: 1509192574 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials/00.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Materials/00.mat -------------------------------------------------------------------------------- /Assets/Materials/00.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76ec2f77868f5084b8187521c93037e5 3 | timeCreated: 1509192622 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials/01.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Materials/01.mat -------------------------------------------------------------------------------- /Assets/Materials/01.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17d27b7b266c3b34391e176ccb405cf7 3 | timeCreated: 1509192622 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Materials/02.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Materials/02.mat -------------------------------------------------------------------------------- /Assets/Materials/02.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5ed06772310f8248ae20cbc9b05d92c 3 | timeCreated: 1509192622 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f34ae8a5341a7c4e88e994632adbb81 3 | folderAsset: yes 4 | timeCreated: 1509192947 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scenes/Demo.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Scenes/Demo.unity -------------------------------------------------------------------------------- /Assets/Scenes/Demo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 765596659beb5ee448e552ab74c460ef 3 | timeCreated: 1509192947 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2156fc1387c4e84395158b4ce12698e 3 | folderAsset: yes 4 | timeCreated: 1509191155 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/Example.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class Example : MonoBehaviour { 6 | 7 | 8 | void Update () { 9 | if (Input.GetMouseButtonDown(0)) 10 | { 11 | HolographicEffect.CallScan(transform.position); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Assets/Scripts/Example.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d941f383ba4fd646936794de0f8ea3b 3 | timeCreated: 1509191581 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/HolographicEffect.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEngine.Rendering; 4 | 5 | public class HolographicEffect : MonoBehaviour 6 | { 7 | 8 | private static HolographicEffect instance; 9 | 10 | /// 11 | /// 渲染世界空间扫描效果 12 | /// 13 | public Shader worldRenderShader; 14 | /// 15 | /// 渲染全息效果 16 | /// 17 | public Shader effectShader; 18 | 19 | /// 20 | /// 扫描最大持续时间 21 | /// 22 | public float maxScanTime; 23 | /// 24 | /// 扫描淡出时间 25 | /// 26 | public float fadeScanTime; 27 | 28 | /// 29 | /// 最大停留时间 30 | /// 31 | public float maxStayTime; 32 | /// 33 | /// 结束淡出时间 34 | /// 35 | public float fadeOutTime; 36 | 37 | /// 38 | /// 全息效果纹理 39 | /// 40 | public Texture2D holographicTex; 41 | 42 | /// 43 | /// 半径 44 | /// 45 | public float radius; 46 | /// 47 | /// 淡出 48 | /// 49 | public float fade; 50 | /// 51 | /// 淡出宽度 52 | /// 53 | public float fadeWidth; 54 | /// 55 | /// 56 | /// 57 | public float effectSize = 10; 58 | 59 | private Material m_ReplaceMaterial; 60 | private Material m_EffectMaterial; 61 | private Material m_WorldRenderMaterial; 62 | 63 | private CommandBuffer m_CommandBuffer; 64 | private RenderTexture m_RenderTexture; 65 | 66 | private bool m_IsInitialized; 67 | 68 | private float m_ScanTime; 69 | private bool m_IsScaning; 70 | 71 | private float m_CurrentTime; 72 | private bool m_IsShowingEffect; 73 | 74 | private Camera m_Camera; 75 | 76 | void Awake() 77 | { 78 | if (m_IsInitialized) 79 | return; 80 | instance = this; 81 | 82 | if (effectShader == null || !effectShader.isSupported) 83 | return; 84 | if (worldRenderShader == null || !worldRenderShader.isSupported) 85 | return; 86 | m_ReplaceMaterial = new Material(Shader.Find("Unlit/Color")); 87 | m_EffectMaterial = new Material(effectShader); 88 | m_WorldRenderMaterial = new Material(worldRenderShader); 89 | if (holographicTex) 90 | m_EffectMaterial.SetTexture("_EffectTex", holographicTex); 91 | 92 | m_EffectMaterial.SetVector("_EffectScale", new Vector4(((float) Screen.width)/ effectSize, ((float) Screen.height)/ effectSize, 0, 0)); 93 | 94 | m_RenderTexture = new RenderTexture(Screen.width, Screen.height, 16); 95 | m_CommandBuffer = new CommandBuffer(); 96 | m_CommandBuffer.name = "[Holographic Effect]"; 97 | m_Camera = GetComponent(); 98 | m_Camera.AddCommandBuffer(CameraEvent.BeforeImageEffectsOpaque, m_CommandBuffer); 99 | 100 | m_Camera.depthTextureMode |= DepthTextureMode.Depth; 101 | 102 | m_IsInitialized = true; 103 | } 104 | 105 | 106 | void Update() 107 | { 108 | if (m_IsShowingEffect) 109 | { 110 | m_CurrentTime += Time.deltaTime; 111 | if (m_CurrentTime > maxStayTime) 112 | { 113 | m_IsShowingEffect = false; 114 | } 115 | } 116 | if (m_IsScaning) 117 | { 118 | m_ScanTime += Time.deltaTime; 119 | if (m_ScanTime > maxScanTime) 120 | { 121 | m_IsScaning = false; 122 | } 123 | } 124 | } 125 | 126 | void OnDestroy() 127 | { 128 | if (m_ReplaceMaterial) 129 | Destroy(m_ReplaceMaterial); 130 | m_ReplaceMaterial = null; 131 | if (m_EffectMaterial) 132 | Destroy(m_EffectMaterial); 133 | m_EffectMaterial = null; 134 | if (m_WorldRenderMaterial) 135 | Destroy(m_WorldRenderMaterial); 136 | m_WorldRenderMaterial = null; 137 | if (m_CommandBuffer != null) 138 | m_CommandBuffer.Release(); 139 | m_CommandBuffer = null; 140 | if (m_RenderTexture) 141 | Destroy(m_RenderTexture); 142 | m_RenderTexture = null; 143 | } 144 | 145 | private static bool IsInitialized() 146 | { 147 | if (instance == null) 148 | return false; 149 | return instance.m_IsInitialized; 150 | } 151 | 152 | public static void CallRender(Vector3 worldPosition, Renderer[] renderer) 153 | { 154 | if (!IsInitialized()) 155 | return; 156 | if (instance.m_IsShowingEffect) 157 | { 158 | if (renderer == null) 159 | return; 160 | Vector3 pjpos = instance.m_Camera.worldToCameraMatrix.MultiplyPoint(worldPosition); 161 | pjpos = instance.m_Camera.projectionMatrix.MultiplyPoint(pjpos); 162 | if (pjpos.x < -1 || pjpos.x > 1 || pjpos.y < -1 || pjpos.y > 1 || pjpos.z < -1 || pjpos.z > 1) 163 | return; 164 | for (int i = 0; i < renderer.Length; i++) 165 | { 166 | instance.m_CommandBuffer.DrawRenderer(renderer[i], instance.m_ReplaceMaterial); 167 | } 168 | } 169 | } 170 | 171 | public static bool CallScan(Vector3 worldPosition) 172 | { 173 | if (!IsInitialized()) 174 | return false; 175 | if (instance.m_IsScaning) 176 | return false; 177 | instance.m_WorldRenderMaterial.SetVector("internalCentPos", worldPosition); 178 | instance.m_IsScaning = true; 179 | instance.m_IsShowingEffect = true; 180 | instance.m_CurrentTime = 0; 181 | instance.m_ScanTime = 0; 182 | return true; 183 | } 184 | 185 | void OnPostRender() 186 | { 187 | if (!m_IsInitialized) 188 | return; 189 | m_CommandBuffer.Clear(); 190 | m_CommandBuffer.SetRenderTarget(m_RenderTexture); 191 | m_CommandBuffer.ClearRenderTarget(true, true, Color.black); 192 | } 193 | 194 | void OnRenderImage(RenderTexture src, RenderTexture dst) 195 | { 196 | 197 | if (m_IsScaning || m_IsShowingEffect) 198 | { 199 | Matrix4x4 frustumCorners = Matrix4x4.identity; 200 | 201 | float fovWHalf = m_Camera.fieldOfView * 0.5f; 202 | 203 | Vector3 toRight = m_Camera.transform.right * m_Camera.nearClipPlane * Mathf.Tan(fovWHalf * Mathf.Deg2Rad) * m_Camera.aspect; 204 | Vector3 toTop = m_Camera.transform.up * m_Camera.nearClipPlane * Mathf.Tan(fovWHalf * Mathf.Deg2Rad); 205 | 206 | Vector3 topLeft = (m_Camera.transform.forward * m_Camera.nearClipPlane - toRight + toTop); 207 | float camScale = topLeft.magnitude * m_Camera.farClipPlane / m_Camera.nearClipPlane; 208 | 209 | topLeft.Normalize(); 210 | topLeft *= camScale; 211 | 212 | Vector3 topRight = (m_Camera.transform.forward * m_Camera.nearClipPlane + toRight + toTop); 213 | topRight.Normalize(); 214 | topRight *= camScale; 215 | 216 | Vector3 bottomRight = (m_Camera.transform.forward * m_Camera.nearClipPlane + toRight - toTop); 217 | bottomRight.Normalize(); 218 | bottomRight *= camScale; 219 | 220 | Vector3 bottomLeft = (m_Camera.transform.forward * m_Camera.nearClipPlane - toRight - toTop); 221 | bottomLeft.Normalize(); 222 | bottomLeft *= camScale; 223 | 224 | frustumCorners.SetRow(0, topLeft); 225 | frustumCorners.SetRow(1, topRight); 226 | frustumCorners.SetRow(2, bottomRight); 227 | frustumCorners.SetRow(3, bottomLeft); 228 | m_WorldRenderMaterial.SetMatrix("_FrustumCorners", frustumCorners); 229 | 230 | 231 | 232 | 233 | //m_WorldRenderMaterial.SetMatrix("internalCameraToWorld", m_Camera.cameraToWorldMatrix); 234 | m_WorldRenderMaterial.SetVector("internalArg", new Vector4(radius*m_ScanTime, fade, fadeWidth, 1)); 235 | float scanFade = 1 - Mathf.Clamp01((m_ScanTime - fadeScanTime)/(maxScanTime - fadeScanTime)); 236 | float efade = 1 - Mathf.Clamp01((m_CurrentTime - fadeOutTime)/(maxStayTime - fadeOutTime)); 237 | m_WorldRenderMaterial.SetVector("internalFade", new Vector4(scanFade, efade, 1, 1)); 238 | RenderTexture rt = RenderTexture.GetTemporary(Screen.width, Screen.height, 16); 239 | //Graphics.Blit(m_RenderTexture, rt, m_WorldRenderMaterial); 240 | CustomGraphicsBlit(m_RenderTexture, rt, m_WorldRenderMaterial); 241 | RenderEffect(src, dst, rt); 242 | RenderTexture.ReleaseTemporary(rt); 243 | } 244 | else 245 | { 246 | Graphics.Blit(src, dst); 247 | } 248 | } 249 | 250 | private void RenderEffect(RenderTexture src, RenderTexture dst, RenderTexture rt) 251 | { 252 | m_EffectMaterial.SetTexture("_PreTex", rt); 253 | 254 | Graphics.Blit(src, dst, m_EffectMaterial); 255 | } 256 | 257 | private static void CustomGraphicsBlit(RenderTexture source, RenderTexture dest, Material fxMaterial) 258 | { 259 | //Graphics.Blit(source, dest, fxMaterial); 260 | //return; 261 | RenderTexture.active = dest; 262 | 263 | fxMaterial.SetTexture("_MainTex", source); 264 | 265 | GL.PushMatrix(); 266 | GL.LoadOrtho(); 267 | 268 | fxMaterial.SetPass(0); 269 | 270 | GL.Begin(GL.QUADS); 271 | 272 | GL.MultiTexCoord2(0, 0.0f, 0.0f); 273 | GL.Vertex3(0.0f, 0.0f, 3.0f); // BL 274 | 275 | GL.MultiTexCoord2(0, 1.0f, 0.0f); 276 | GL.Vertex3(1.0f, 0.0f, 2.0f); // BR 277 | 278 | GL.MultiTexCoord2(0, 1.0f, 1.0f); 279 | GL.Vertex3(1.0f, 1.0f, 1.0f); // TR 280 | 281 | GL.MultiTexCoord2(0, 0.0f, 1.0f); 282 | GL.Vertex3(0.0f, 1.0f, 0.0f); // TL 283 | 284 | GL.End(); 285 | GL.PopMatrix(); 286 | } 287 | } 288 | -------------------------------------------------------------------------------- /Assets/Scripts/HolographicEffect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf6945a6eae14514f82b9a178bb32b2a 3 | timeCreated: 1509191160 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/HolographicRenderer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | 4 | public class HolographicRenderer : MonoBehaviour 5 | { 6 | private Renderer[] m_Renderers; 7 | 8 | void Start() 9 | { 10 | Renderer[] renderers = GetComponentsInChildren(); 11 | List filters = new List(); 12 | for (int i = 0; i < renderers.Length; i++) 13 | { 14 | if (renderers[i] is MeshRenderer) 15 | { 16 | filters.Add(renderers[i]); 17 | continue; 18 | } 19 | if (renderers[i] is SkinnedMeshRenderer) 20 | { 21 | filters.Add(renderers[i]); 22 | continue; 23 | } 24 | } 25 | if (filters.Count > 0) 26 | m_Renderers = filters.ToArray(); 27 | } 28 | 29 | void OnRenderObject() 30 | { 31 | if (m_Renderers != null) 32 | HolographicEffect.CallRender(transform.position, m_Renderers); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Assets/Scripts/HolographicRenderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 117d6cbeba0846a4593c2ce0660bb8b2 3 | timeCreated: 1509191160 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5dfd3671f5ee6f47b7be7e2ced65311 3 | folderAsset: yes 4 | timeCreated: 1509191298 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/MosicEffect.shader: -------------------------------------------------------------------------------- 1 |  2 | Shader "Hidden/MosicEffect" 3 | { 4 | Properties 5 | { 6 | _MainTex ("Texture", 2D) = "white" {} 7 | } 8 | SubShader 9 | { 10 | Cull Off ZWrite Off ZTest Always 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | 18 | #include "UnityCG.cginc" 19 | 20 | struct appdata 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | }; 25 | 26 | struct v2f 27 | { 28 | float2 uv : TEXCOORD0; 29 | float4 vertex : SV_POSITION; 30 | }; 31 | 32 | v2f vert (appdata v) 33 | { 34 | v2f o; 35 | o.vertex = UnityObjectToClipPos(v.vertex); 36 | o.uv = v.uv; 37 | return o; 38 | } 39 | 40 | sampler2D _MainTex; 41 | sampler2D _PreTex; 42 | sampler2D _EffectTex; 43 | 44 | float2 _EffectScale; 45 | 46 | fixed4 frag (v2f i) : SV_Target 47 | { 48 | fixed4 col = tex2D(_MainTex, i.uv); 49 | #if UNITY_UV_STARTS_AT_TOP 50 | // i.uv.y = 1 - i.uv.y; 51 | #endif 52 | float2 fl = floor(i.uv * _EffectScale); 53 | float dp = tex2D(_PreTex, (fl + float2(0.5, 0.5)) / _EffectScale); 54 | 55 | float4 led = tex2D(_EffectTex, i.uv * _EffectScale - fl); 56 | 57 | col.rgb += led.rgb*dp; 58 | 59 | return col; 60 | } 61 | ENDCG 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Assets/Shaders/MosicEffect.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d0f557736d648a47b840ce71c43ac49 3 | timeCreated: 1509191325 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/WorldMPosRenderer.shader: -------------------------------------------------------------------------------- 1 | // 该shader用于渲染世界空间的扫描效果 2 | 3 | Shader "Hidden/WorldMPosRenderer" 4 | { 5 | Properties 6 | { 7 | _MainTex ("Texture", 2D) = "white" {} 8 | } 9 | SubShader 10 | { 11 | Cull Off ZWrite Off ZTest Always 12 | 13 | Pass 14 | { 15 | CGPROGRAM 16 | #pragma vertex vert 17 | #pragma fragment frag 18 | 19 | #include "UnityCG.cginc" 20 | 21 | struct appdata 22 | { 23 | float4 vertex : POSITION; 24 | float2 uv : TEXCOORD0; 25 | }; 26 | 27 | struct v2f 28 | { 29 | float2 uv : TEXCOORD0; 30 | float2 uv_depth : TEXCOORD1; 31 | float3 interpolatedRay : TEXCOORD2; 32 | float4 vertex : SV_POSITION; 33 | }; 34 | 35 | sampler2D _MainTex; 36 | float4 _MainTex_TexelSize; 37 | sampler2D_float _CameraDepthTexture; 38 | 39 | //float4x4 internalCameraToWorld; 40 | float4x4 _FrustumCorners; 41 | 42 | float4 internalCentPos; 43 | float4 internalArg; 44 | 45 | float4 internalFade; 46 | 47 | v2f vert (appdata v) 48 | { 49 | v2f o; 50 | half index = v.vertex.z; 51 | v.vertex.z = 0.1; 52 | o.vertex = UnityObjectToClipPos(v.vertex); 53 | o.uv = v.uv.xy; 54 | o.uv_depth = v.uv.xy; 55 | #if UNITY_UV_STARTS_AT_TOP 56 | if (_MainTex_TexelSize.y < 0) 57 | o.uv.y = 1 - o.uv.y; 58 | #endif 59 | o.interpolatedRay = _FrustumCorners[(int)index].xyz; 60 | return o; 61 | } 62 | 63 | fixed4 frag (v2f i) : SV_Target 64 | { 65 | fixed4 c = tex2D(_MainTex, UnityStereoTransformScreenSpaceTex(i.uv)); 66 | 67 | 68 | fixed depth = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, UnityStereoTransformScreenSpaceTex(i.uv_depth))); 69 | 70 | fixed4 worldPos = fixed4(depth*i.interpolatedRay, 1); 71 | 72 | worldPos.xyz += _WorldSpaceCameraPos; 73 | 74 | fixed dis = length(internalCentPos.xyz - worldPos.xyz); 75 | 76 | fixed a = 1 - saturate((abs(dis - internalArg.x) - internalArg.y) / internalArg.z); 77 | a = a * internalFade.x + c * internalFade.y; 78 | return fixed4(a, a, a, a); 79 | } 80 | ENDCG 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Assets/Shaders/WorldMPosRenderer.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27f599921b01f6b4fabaa914df6b0363 3 | timeCreated: 1509191325 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8af7ab590b6b65148b388a593bd3a3ef 3 | folderAsset: yes 4 | timeCreated: 1509191352 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Textures/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Textures/1.jpg -------------------------------------------------------------------------------- /Assets/Textures/1.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a419f5c86b70f5d4ca748445c2b2ea32 3 | timeCreated: 1509191355 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/Textures/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Textures/2.jpg -------------------------------------------------------------------------------- /Assets/Textures/2.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fde7e0b4271bfe94bb8074627df93141 3 | timeCreated: 1509194004 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/Textures/misc03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Textures/misc03.jpg -------------------------------------------------------------------------------- /Assets/Textures/misc03.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d56667c95a96e44996f4468e52256f4 3 | timeCreated: 1509192612 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /Assets/Textures/misc03n.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Textures/misc03n.jpg -------------------------------------------------------------------------------- /Assets/Textures/misc03n.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74ceb2d3612b6f14895bf2d1367ec3e5 3 | timeCreated: 1509192670 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 0 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 1 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | - buildTarget: Standalone 62 | maxTextureSize: 2048 63 | textureFormat: -1 64 | textureCompression: 1 65 | compressionQuality: 50 66 | crunchedCompression: 0 67 | allowsAlphaSplitting: 0 68 | overridden: 0 69 | - buildTarget: iPhone 70 | maxTextureSize: 2048 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 50 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | - buildTarget: Android 78 | maxTextureSize: 2048 79 | textureFormat: -1 80 | textureCompression: 1 81 | compressionQuality: 50 82 | crunchedCompression: 0 83 | allowsAlphaSplitting: 0 84 | overridden: 0 85 | - buildTarget: WebGL 86 | maxTextureSize: 2048 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | spriteSheet: 94 | serializedVersion: 2 95 | sprites: [] 96 | outline: [] 97 | spritePackingTag: 98 | userData: 99 | assetBundleName: 100 | assetBundleVariant: 101 | -------------------------------------------------------------------------------- /Assets/Textures/paving11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/Assets/Textures/paving11.jpg -------------------------------------------------------------------------------- /Assets/Textures/paving11.jpg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7cea48d3048e1f64b92bd52831fd28e2 3 | timeCreated: 1509192618 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 4 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | sRGBTexture: 1 12 | linearTexture: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 6 25 | cubemapConvolution: 0 26 | seamlessCubemap: 0 27 | textureFormat: 1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | compressionQuality: 50 37 | spriteMode: 0 38 | spriteExtrude: 1 39 | spriteMeshType: 1 40 | alignment: 0 41 | spritePivot: {x: 0.5, y: 0.5} 42 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 43 | spritePixelsToUnits: 100 44 | alphaUsage: 1 45 | alphaIsTransparency: 0 46 | spriteTessellationDetail: -1 47 | textureType: 0 48 | textureShape: 1 49 | maxTextureSizeSet: 0 50 | compressionQualitySet: 0 51 | textureFormatSet: 0 52 | platformSettings: 53 | - buildTarget: DefaultTexturePlatform 54 | maxTextureSize: 2048 55 | textureFormat: -1 56 | textureCompression: 1 57 | compressionQuality: 50 58 | crunchedCompression: 0 59 | allowsAlphaSplitting: 0 60 | overridden: 0 61 | spriteSheet: 62 | serializedVersion: 2 63 | sprites: [] 64 | outline: [] 65 | spritePackingTag: 66 | userData: 67 | assetBundleName: 68 | assetBundleVariant: 69 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.6.3p3 2 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AsehesL/ScanEffect/1115ebcb967a5ca72c93cb1d906b79d17f2ba6f4/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ScanEffect --------------------------------------------------------------------------------