{"id":338975,"date":"2022-09-28T15:00:31","date_gmt":"2022-09-28T15:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338975"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338975","title":{"rendered":"<span>\u041e\u0447\u0443\u043c\u0435\u043b\u044b\u0439 \u0441\u0430\u043c\u043e\u0440\u0443\u0447\u043d\u0438\u043a \u2014 \u0441\u043f\u0440\u0430\u0439\u0442\u044b \u043a\u0430\u043a \u0432 Doom&#8217;\u0435 \u0431\u0435\u0437 \u0434\u043e\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u043d\u0438\u044f<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0418 \u0442\u0430\u043a. \u041c\u043e\u0436\u043d\u043e \u0438 \u044d\u0434\u0430\u043a.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8cd\/191\/940\/8cd191940b068f93c7ace20e64bcc625.png\" width=\"558\" height=\"377\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8cd\/191\/940\/8cd191940b068f93c7ace20e64bcc625.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<p>\u0412 \u0434\u0430\u043b\u0451\u043a\u0438\u0439 1993 \u0433\u043e\u0434 Raven Software \u0440\u0435\u0448\u0438\u043b\u0438 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443 ID Software \u0434\u0432\u0438\u0436\u043e\u043a id Tech 1.<\/p>\n<figure class=\"float\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c95\/c67\/1f1\/c95c671f1bc5795364bea331b36c9d77.gif\" width=\"148\" height=\"125\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c95\/c67\/1f1\/c95c671f1bc5795364bea331b36c9d77.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043d\u0430 \u0432\u0440\u0435\u043c\u044f &#8212; \u0447\u0430\u0441\u0442\u044c \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u0431\u044b\u043b\u0430 \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u0430 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u0440\u0438\u0441\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445 \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u043d\u043e \u0432\u043e\u0442 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 &#8212; \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0436\u0435.<\/p>\n<p>\u0420\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0438\u043b\u044b \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u044b\u043b\u0430 \u0441\u043a\u0440\u0443\u0447\u0435\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c\u043a\u0430<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/192\/721\/e17\/192721e1770d77f11487029780076ac4.png\" width=\"1920\" height=\"1027\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/192\/721\/e17\/192721e1770d77f11487029780076ac4.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/be7\/156\/66d\/be715666daa00ae44190c1ee35342daa.png\" width=\"1280\" height=\"800\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/be7\/156\/66d\/be715666daa00ae44190c1ee35342daa.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0435\u043b\u0430\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u0441\u0442\u0430\u0440\u043e\u0439, \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u044f\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0443\u0448\u043a\u0438 demon tech repeater \u0434\u043b\u044f \u043c\u043e\u0434\u0430 Complex Doom Invasion. \u0412 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430\u0445 \u043e\u0434\u043d\u0438 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, \u0434\u043e \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0411\u043b\u0435\u043d\u0434\u0435\u0440\u0430 \u0432\u044b\u0448\u043b\u0438 \u0440\u0430\u0437\u043c\u044b\u0442\u044b\u043c\u0438, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u043e antialiasing \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0432\u043e\u0451 \u0434\u0435\u043b\u043e. <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u043d\u0435\u0435 \u044f \u0443\u0436\u0435 \u043a\u043e\u0434\u0438\u043b \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 Unity &#8212; \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u043d\u0451\u043c.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u044b \u0438\u0437 Unity \u043f\u0440\u043e\u0441\u0442\u043e \u0441 \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435\u043c \u0438 \u0434\u0430\u0436\u0435 \u0441 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Lancoz \u0444\u0438\u043b\u044c\u0442\u0440 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u044b\u043b\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/335\/30a\/a03\/33530aa030a4a46e6fe97cfd00b572fd.png\" width=\"656\" height=\"391\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/335\/30a\/a03\/33530aa030a4a46e6fe97cfd00b572fd.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c1c\/c17\/bc0\/c1cc17bc07c5dba975dbd1de08770ae8.png\" width=\"665\" height=\"414\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c1c\/c17\/bc0\/c1cc17bc07c5dba975dbd1de08770ae8.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u041f\u0438\u0442\u043e\u043d\u0430 (\u041f\u0430\u0439\u0442\u043e\u043d\u0430, \u043a\u0430\u043a \u0432\u0430\u043c \u0443\u0433\u043e\u0434\u043d\u043e) \u0438 \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f (<a href=\"https:\/\/gist.github.com\/smoketh\/814bc095880bc48bc64058d52fb108c8\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u0434 \u0442\u0443\u0442<\/a>).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6c8\/eee\/3b3\/6c8eee3b3007e775716fd51c18be8237.png\" width=\"608\" height=\"411\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6c8\/eee\/3b3\/6c8eee3b3007e775716fd51c18be8237.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u0431\u044b\u043b \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d outline. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a &#8212; \u0431\u0435\u0440\u0451\u043c legacy image effects \u0438\u0437 assetstore&#8217;\u0430, \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c edge detection \u0441 \u0440\u0435\u0436\u0438\u043c\u043e\u043c triangle depth normals. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f lancoz. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3b8\/187\/cf8\/3b8187cf850030dee46bf3ac4cdb44df.png\" width=\"609\" height=\"431\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3b8\/187\/cf8\/3b8187cf850030dee46bf3ac4cdb44df.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u043b\u043e\u0436\u0438\u043b \u043e\u0434\u043d\u043e \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435 (\u0432\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u044b):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/489\/133\/c02\/489133c028fde6d0b3107dc9c49590d8.png\" width=\"1344\" height=\"813\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/489\/133\/c02\/489133c028fde6d0b3107dc9c49590d8.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0443\u0442\u044c \u0447\u0443\u0442\u044c \u0434\u043e\u0440\u0438\u0441\u043e\u0432\u0430\u043b, \u0434\u043e\u0431\u0430\u0432\u0438\u043b 50% \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e (\u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c \u0441 \u043f\u0410\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 &#8212; \u043d\u0430 \u0420\u0443\u0441\u0441\u043a\u043e\u043c \u0442\u0435\u0440\u043c\u0438\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0418\u0437\u043e\u0433\u0435\u043b\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%98%D0%B7%D0%BE%D0%B3%D0%B5%D0%BB%D0%B8%D1%8F\" rel=\"noopener noreferrer nofollow\">https:\/\/ru.wikipedia.org\/wiki\/\u0418\u0437\u043e\u0433\u0435\u043b\u0438\u044f<\/a> ) \u0441\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435\u043c (\u043a\u0430\u043a \u044d\u0444\u0444\u0435\u043a\u0442 \u043a\u0430\u043c\u0435\u0440\u044b) \u0430 \u0442\u0430\u043a\u0436\u0435 SSAO \u0434\u043b\u044f \u0442\u0435\u043d\u0435\u0439.<\/p>\n<p>\u041a\u043e\u0434 \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043a\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0440\u0445 \u043a\u0430\u043c\u0435\u0440\u044b:<\/p>\n<pre><code class=\"cpp\">Shader \"Hidden\/LightPosterize\" {   \/\/\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0440\u044b\u0431\u0430 CG \u0448\u0435\u0439\u0434\u0435\u0440\u0430, \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c    \/\/\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0438\u043b\u044b \u0418\u0437\u043e\u0433\u0435\u043b\u0438\u0438 \u0438 \u0441\u0438\u043b\u044b \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f     Properties     {         _MainTex (\"Texture\", 2D) = \"white\" {} _Precision (\"Precision\", Range(0.001, 0.1)) = 0.15 _Interp(\"Interp\", Range(0,1)) = 1     }     SubShader     {         \/\/ No culling or depth         Cull Off ZWrite Off ZTest Always          Pass         {             CGPROGRAM             #pragma vertex vert             #pragma fragment frag              #include \"UnityCG.cginc\"              struct appdata             {                 float4 vertex : POSITION;                 float2 uv : TEXCOORD0;             };              struct v2f             {                 float2 uv : TEXCOORD0;                 float4 vertex : SV_POSITION;             };              v2f vert (appdata v)             {                 v2f o;                 o.vertex = UnityObjectToClipPos(v.vertex);                 o.uv = v.uv;                 return o;             }              sampler2D _MainTex;           \/\/\u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0443 \u0433\u043b\u0443\u0431\u0438\u043d-\u043d\u043e\u0440\u043c\u0430\u043b\u0435\u0439 sampler2D _CameraDepthNormalsTexture; float _Precision, _Interp;             fixed4 frag (v2f i) : SV_Target             {                 fixed4 col = tex2D(_MainTex, i.uv); float3 normalValues; float depthValue;   DecodeDepthNormal(tex2D(_CameraDepthNormalsTexture, i.uv), depthValue, normalValues);                 \/\/\u043e\u0431\u0440\u0435\u0437\u0430\u0435\u043c \u044d\u0444\u0444\u0435\u043a\u0442 \u0435\u0441\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u043e - \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 if (depthValue > 0.99) return col;               \/\/\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u0434 - \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u043c float3 upscaled = col.rgb \/ _Precision + float3(0.5, 0.5, 0.5)*_Precision;  float3 final = round( upscaled )* _Precision;  col.rgb = lerp(col.rgb, final, _Interp);                 return col;             }             ENDCG         }     } } <\/code><\/pre>\n<pre><code class=\"cs\">using UnityEngine; using System.Collections; [ExecuteInEditMode] public class ShaderApply : MonoBehaviour {     public Material mat;     public DepthTextureMode mode;     Camera cam; \/\/\u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u043d\u0443\u044e \u043a\u0430\u043c\u0435\u0440\u0443 -  \/\/\u043f\u043e\u0434\u0441\u0430\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 OnRenderImage     void OnRenderImage(RenderTexture source, RenderTexture destination)     {         cam = GetComponent&lt;Camera>(); \/\/\u0435\u0441\u043b\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043d\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0435\u0442 - \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0434\u0430\u043b\u044c\u0448\u0435         if (mat == null)         {                Graphics.Blit(source, destination);             return;         } \/\/\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c - \u0431\u0435\u0440\u0435\u043c \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 source rendertexture'\u0435 \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448 \u0448\u0435\u0439\u0434\u0435\u0440         cam.depthTextureMode = mode;         \/\/mat is the material containing your shader         Graphics.Blit(source, destination, mat);     } }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0b5\/128\/bd5\/0b5128bd502ab1be06bd508074b71d41.png\" width=\"558\" height=\"377\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0b5\/128\/bd5\/0b5128bd502ab1be06bd508074b71d41.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0443 \u0438 \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u043d\u0430 \u0438 \u043f\u0440\u043e\u0433\u043d\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u044b:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6332cbda784fcacea514d077\" data-style=\"\" id=\"6332cbda784fcacea514d077\" width=\"\"><\/div>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3ec\/e89\/a67\/3ece89a67a9c6503fc7ff9a433f659b1.png\" width=\"713\" height=\"401\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ec\/e89\/a67\/3ece89a67a9c6503fc7ff9a433f659b1.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/07b\/781\/bf9\/07b781bf9fa82235fd3dace7efcd5c10.png\" width=\"320\" height=\"200\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/07b\/781\/bf9\/07b781bf9fa82235fd3dace7efcd5c10.png\"\/><figcaption><\/figcaption><\/figure>\n<ul>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0432 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0438 640&#215;400 \u0441 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0437\u043a\u043e\u0441\u0442\u044c\u044e, SSAO \u0438 \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u044d\u0444\u0444\u0435\u043a\u0442 \u043f\u043b\u0430\u0437\u043c\u044b. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0440\u0435\u043d\u0434\u0435\u0440\u044e \u043d\u0430 \u0447\u0451\u0440\u043d\u043e\u043c \u0444\u043e\u043d\u0435 \u0431\u0435\u0437 \u0430\u043b\u044c\u0444\u0430 \u043a\u0430\u043d\u0430\u043b\u0430, \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u044e \u0432 \u041f\u0438\u0442\u043e\u043d, \u0441\u043e\u0437\u0434\u0430\u044e \u0430\u043b\u044c\u0444\u0430 \u043a\u0430\u043d\u0430\u043b \u0438\u0437 \u0447\u0451\u0440\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u044e \u0446\u0432\u0435\u0442 &#8212; \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u0431\u0435\u0433\u0430\u044f colorbanding<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c outline \u0432 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0438 1280&#215;800 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u044e \u0442\u043e\u0436\u0435 \u0432 \u043f\u0438\u0442\u043e\u043d. \u0421\u043a\u0440\u0438\u043f\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0441\u043f\u0440\u0430\u0439\u0442 \u0430\u0443\u0442\u043b\u0430\u0439\u043d\u0430, \u043c\u043d\u043e\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043f\u0440\u0430\u0439\u0442 \u043d\u0430 \u0430\u0443\u0442\u043b\u0430\u0439\u043d (50% \u043f\u043e\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435), \u0437\u0430\u0442\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0441\u043f\u0440\u0430\u0439\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043f\u043b\u0430\u0437\u043c\u044b, \u0435\u0441\u043b\u0438 \u0442\u043e\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0440\u044f\u0434\u0443 \u043a\u0430\u0434\u0440\u043e\u0432. <\/p>\n<\/li>\n<\/ul>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/690576\/\"> https:\/\/habr.com\/ru\/post\/690576\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0418 \u0442\u0430\u043a. \u041c\u043e\u0436\u043d\u043e \u0438 \u044d\u0434\u0430\u043a.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<p>\u0412 \u0434\u0430\u043b\u0451\u043a\u0438\u0439 1993 \u0433\u043e\u0434 Raven Software \u0440\u0435\u0448\u0438\u043b\u0438 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443 ID Software \u0434\u0432\u0438\u0436\u043e\u043a id Tech 1.<\/p>\n<figure class=\"float\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043d\u0430 \u0432\u0440\u0435\u043c\u044f &#8212; \u0447\u0430\u0441\u0442\u044c \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u0431\u044b\u043b\u0430 \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u0430 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u0440\u0438\u0441\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445 \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u043d\u043e \u0432\u043e\u0442 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 &#8212; \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0436\u0435.<\/p>\n<p>\u0420\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0438\u043b\u044b \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u044b\u043b\u0430 \u0441\u043a\u0440\u0443\u0447\u0435\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c\u043a\u0430<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"float full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0435\u043b\u0430\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u0441\u0442\u0430\u0440\u043e\u0439, \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u044f\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0443\u0448\u043a\u0438 demon tech repeater \u0434\u043b\u044f \u043c\u043e\u0434\u0430 Complex Doom Invasion. \u0412 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430\u0445 \u043e\u0434\u043d\u0438 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, \u0434\u043e \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0411\u043b\u0435\u043d\u0434\u0435\u0440\u0430 \u0432\u044b\u0448\u043b\u0438 \u0440\u0430\u0437\u043c\u044b\u0442\u044b\u043c\u0438, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u043e antialiasing \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0432\u043e\u0451 \u0434\u0435\u043b\u043e. <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u043d\u0435\u0435 \u044f \u0443\u0436\u0435 \u043a\u043e\u0434\u0438\u043b \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 Unity &#8212; \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u043d\u0451\u043c.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u044b \u0438\u0437 Unity \u043f\u0440\u043e\u0441\u0442\u043e \u0441 \u0440\u0430\u0437\u043c\u044b\u0442\u0438\u0435\u043c \u0438 \u0434\u0430\u0436\u0435 \u0441 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Lancoz \u0444\u0438\u043b\u044c\u0442\u0440 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u044b\u043b\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u044b:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u041f\u0438\u0442\u043e\u043d\u0430 (\u041f\u0430\u0439\u0442\u043e\u043d\u0430, \u043a\u0430\u043a \u0432\u0430\u043c \u0443\u0433\u043e\u0434\u043d\u043e) \u0438 \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f (<a href=\"https:\/\/gist.github.com\/smoketh\/814bc095880bc48bc64058d52fb108c8\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u0434 \u0442\u0443\u0442<\/a>).<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u0431\u044b\u043b \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d outline. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a &#8212; \u0431\u0435\u0440\u0451\u043c legacy image effects \u0438\u0437 assetstore&#8217;\u0430, \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c edge detection \u0441 \u0440\u0435\u0436\u0438\u043c\u043e\u043c triangle depth normals. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f lancoz. <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u043b\u043e\u0436\u0438\u043b \u043e\u0434\u043d\u043e \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435 (\u0432\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u044b):<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0443\u0442\u044c \u0447\u0443\u0442\u044c \u0434\u043e\u0440\u0438\u0441\u043e\u0432\u0430\u043b, \u0434\u043e\u0431\u0430\u0432\u0438\u043b 50% \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e (\u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c \u0441 \u043f\u0410\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 &#8212; \u043d\u0430 \u0420\u0443\u0441\u0441\u043a\u043e\u043c \u0442\u0435\u0440\u043c\u0438\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0418\u0437\u043e\u0433\u0435\u043b\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%98%D0%B7%D0%BE%D0%B3%D0%B5%D0%BB%D0%B8%D1%8F\" rel=\"noopener noreferrer nofollow\">https:\/\/ru.wikipedia.org\/wiki\/\u0418\u0437\u043e\u0433\u0435\u043b\u0438\u044f<\/a> ) \u0441\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u0435\u043c (\u043a\u0430\u043a \u044d\u0444\u0444\u0435\u043a\u0442 \u043a\u0430\u043c\u0435\u0440\u044b) \u0430 \u0442\u0430\u043a\u0436\u0435 SSAO \u0434\u043b\u044f \u0442\u0435\u043d\u0435\u0439.<\/p>\n<p>\u041a\u043e\u0434 \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043a\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0440\u0445 \u043a\u0430\u043c\u0435\u0440\u044b:<\/p>\n<pre><code class=\"cpp\">Shader \"Hidden\/LightPosterize\" {   \/\/\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0440\u044b\u0431\u0430 CG \u0448\u0435\u0439\u0434\u0435\u0440\u0430, \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c    \/\/\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0438\u043b\u044b \u0418\u0437\u043e\u0433\u0435\u043b\u0438\u0438 \u0438 \u0441\u0438\u043b\u044b \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u043d\u0438\u044f     Properties     {         _MainTex (\"Texture\", 2D) = \"white\" {} _Precision (\"Precision\", Range(0.001, 0.1)) = 0.15 _Interp(\"Interp\", Range(0,1)) = 1     }     SubShader     {         \/\/ No culling or depth         Cull Off ZWrite Off ZTest Always          Pass         {             CGPROGRAM             #pragma vertex vert             #pragma fragment frag              #include \"UnityCG.cginc\"              struct appdata             {                 float4 vertex : POSITION;                 float2 uv : TEXCOORD0;             };              struct v2f             {                 float2 uv : TEXCOORD0;                 float4 vertex : SV_POSITION;             };              v2f vert (appdata v)             {                 v2f o;                 o.vertex = UnityObjectToClipPos(v.vertex);                 o.uv = v.uv;                 return o;             }              sampler2D _MainTex;           \/\/\u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0443 \u0433\u043b\u0443\u0431\u0438\u043d-\u043d\u043e\u0440\u043c\u0430\u043b\u0435\u0439 sampler2D _CameraDepthNormalsTexture; float _Precision, _Interp;             fixed4 frag (v2f i) : SV_Target             {                 fixed4 col = tex2D(_MainTex, i.uv); float3 normalValues; float depthValue;   DecodeDepthNormal(tex2D(_CameraDepthNormalsTexture, i.uv), depthValue, normalValues);                 \/\/\u043e\u0431\u0440\u0435\u0437\u0430\u0435\u043c \u044d\u0444\u0444\u0435\u043a\u0442 \u0435\u0441\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u043e - \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 if (depthValue > 0.99) return col;               \/\/\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u0434 - \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u043c float3 upscaled = col.rgb \/ _Precision + float3(0.5, 0.5, 0.5)*_Precision;  float3 final = round( upscaled )* _Precision;  col.rgb = lerp(col.rgb, final, _Interp);                 return col;             }             ENDCG         }     } } <\/code><\/pre>\n<pre><code class=\"cs\">using UnityEngine; using System.Collections; [ExecuteInEditMode] public class ShaderApply : MonoBehaviour {     public Material mat;     public DepthTextureMode mode;     Camera cam; \/\/\u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u043d\u0443\u044e \u043a\u0430\u043c\u0435\u0440\u0443 -  \/\/\u043f\u043e\u0434\u0441\u0430\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 OnRenderImage     void OnRenderImage(RenderTexture source, RenderTexture destination)     {         cam = GetComponent&lt;Camera>(); \/\/\u0435\u0441\u043b\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043d\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0435\u0442 - \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0434\u0430\u043b\u044c\u0448\u0435         if (mat == null)         {                Graphics.Blit(source, destination);             return;         } \/\/\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c - \u0431\u0435\u0440\u0435\u043c \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 source rendertexture'\u0435 \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448 \u0448\u0435\u0439\u0434\u0435\u0440         cam.depthTextureMode = mode;         \/\/mat is the material containing your shader         Graphics.Blit(source, destination, mat);     } }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0443 \u0438 \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u043d\u0430 \u0438 \u043f\u0440\u043e\u0433\u043d\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u044b:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/6332cbda784fcacea514d077\" data-style=\"\" id=\"6332cbda784fcacea514d077\" width=\"\"><\/div>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<ul>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0432 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0438 640&#215;400 \u0441 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0437\u043a\u043e\u0441\u0442\u044c\u044e, SSAO \u0438 \u043f\u043e\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u044d\u0444\u0444\u0435\u043a\u0442 \u043f\u043b\u0430\u0437\u043c\u044b. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0440\u0435\u043d\u0434\u0435\u0440\u044e \u043d\u0430 \u0447\u0451\u0440\u043d\u043e\u043c \u0444\u043e\u043d\u0435 \u0431\u0435\u0437 \u0430\u043b\u044c\u0444\u0430 \u043a\u0430\u043d\u0430\u043b\u0430, \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u044e \u0432 \u041f\u0438\u0442\u043e\u043d, \u0441\u043e\u0437\u0434\u0430\u044e \u0430\u043b\u044c\u0444\u0430 \u043a\u0430\u043d\u0430\u043b \u0438\u0437 \u0447\u0451\u0440\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u044e \u0446\u0432\u0435\u0442 &#8212; \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u0431\u0435\u0433\u0430\u044f colorbanding<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c outline \u0432 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0438 1280&#215;800 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u044e \u0442\u043e\u0436\u0435 \u0432 \u043f\u0438\u0442\u043e\u043d. \u0421\u043a\u0440\u0438\u043f\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0441\u043f\u0440\u0430\u0439\u0442 \u0430\u0443\u0442\u043b\u0430\u0439\u043d\u0430, \u043c\u043d\u043e\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043f\u0440\u0430\u0439\u0442 \u043d\u0430 \u0430\u0443\u0442\u043b\u0430\u0439\u043d (50% \u043f\u043e\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435), \u0437\u0430\u0442\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0441\u043f\u0440\u0430\u0439\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043f\u043b\u0430\u0437\u043c\u044b, \u0435\u0441\u043b\u0438 \u0442\u043e\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0440\u044f\u0434\u0443 \u043a\u0430\u0434\u0440\u043e\u0432. <\/p>\n<\/li>\n<\/ul>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/690576\/\"> https:\/\/habr.com\/ru\/post\/690576\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-338975","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=338975"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338975\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}