{"id":289184,"date":"2018-09-10T12:50:07","date_gmt":"2018-09-10T08:50:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=289184"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=289184","title":{"rendered":"\u0420\u0435\u0432\u0435\u0440\u0441-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043d\u0433 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a\u0430 3\u00bb"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/422573\/\" class=\"post__text post__text-html js-mediator-article\">\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u043e\u043c \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a\u0430 3\u00bb. \u0412 \u044d\u0442\u043e\u0439 \u0438\u0433\u0440\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0438\u0451\u043c\u044b \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d\u0430 \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u0430 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u044e\u0436\u0435\u0442\u0430\/\u043c\u0443\u0437\u044b\u043a\u0438\/\u0433\u0435\u0439\u043c\u043f\u043b\u0435\u044f.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e5b\/54e\/95e\/e5b54e95e53d14c22be446c3de24f8c3.jpg\"><\/div>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 The Witcher 3. \u041e\u043d\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0441\u0435\u043e\u0431\u044a\u0435\u043c\u043b\u044e\u0449\u0435\u0439, \u043a\u0430\u043a \u0430\u043d\u0430\u043b\u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 <a href=\"https:\/\/habr.com\/company\/ua-hosting\/blog\/271931\/\">GTA V<\/a> \u0410\u0434\u0440\u0438\u0430\u043d\u0430 \u041a\u043e\u0440\u0440\u0435\u0436\u0435, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043f\u043e\u043a\u0430.<\/p>\n<p>  \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u0440\u0435\u0432\u0435\u0440\u0441-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043d\u0433\u0430 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 1: \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f<\/h2>\n<p>  \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 AAA-\u0438\u0433\u0440 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u044d\u0442\u0430\u043f\u043e\u0432 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f.<\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u044e \u0432\u0430\u043c, \u0447\u0442\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u044f\u0440\u043a\u043e\u0441\u0442\u0438, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0443 \u044d\u043a\u0440\u0430\u043d\u043e\u0432 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432 \u043e\u0447\u0435\u043d\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d (8 \u0431\u0438\u0442 \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c, \u0447\u0442\u043e \u0434\u0430\u0451\u0442 \u043d\u0430\u043c 0-255). \u0418\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f (tonemapping), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0443\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u0438\u0439. \u041e\u0431\u044b\u0447\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445: HDR-\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0442 1.0, \u0438 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u043e\u0441\u0432\u0435\u0449\u0451\u043d\u043d\u043e\u0441\u0442\u044c \u0441\u0446\u0435\u043d\u044b (\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438, \u0434\u0430\u0436\u0435 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438 \u0433\u043b\u0430\u0437\u0430 \u0434\u043b\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0445 \u0433\u043b\u0430\u0437, \u043d\u043e \u0437\u0434\u0435\u0441\u044c \u044d\u0442\u043e \u043d\u0435\u0432\u0430\u0436\u043d\u043e).<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 (\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439) \u044d\u0442\u0430\u043f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0438, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0446\u0432\u0435\u0442\u0430 \u0441 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0438 \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u0440\u0438\u0432\u043e\u0439 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438. \u0418 \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u00ab\u0442\u043e\u0447\u043a\u0430 \u0431\u0435\u043b\u043e\u0433\u043e\u00bb (white point) \u0438 \u00ab\u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0441\u0435\u0440\u044b\u0439 \u0446\u0432\u0435\u0442\u00bb (middle gray). \u0415\u0441\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043a\u0440\u0438\u0432\u044b\u0445, \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u041c\u044d\u0442\u0442\u0430 \u041f\u0435\u0442\u0442\u0438\u043d\u0435\u043e <a href=\"https:\/\/mynameismjp.wordpress.com\/2010\/04\/30\/a-closer-look-at-tone-mapping\/\">\u00abA Closer Look at Tone Mapping\u00bb<\/a>.<\/p>\n<p>  \u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435. \u0412 \u0441\u0435\u0442\u0438 \u0435\u0441\u0442\u044c \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 <a href=\"https:\/\/github.com\/walbourn\/directx-sdk-samples\/tree\/master\/HDRToneMappingCS11\">\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e<\/a>\u00a0<a href=\"https:\/\/software.intel.com\/en-us\/articles\/compute-shader-hdr-and-bloom\">\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445<\/a> <a href=\"https:\/\/mynameismjp.wordpress.com\/2010\/04\/30\/a-closer-look-at-tone-mapping\/\">\u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043c\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u2026 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442 HDR-\u044f\u0440\u043a\u043e\u0441\u0442\u044c\/\u0442\u043e\u0447\u043a\u0443 \u0431\u0435\u043b\u043e\u0433\u043e\/\u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0441\u0435\u0440\u044b\u0439 \u0446\u0432\u0435\u0442, \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0435\u0442 \u2014 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442. \u041c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u00ab\u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u0443\u044e \u0432 \u0431\u043e\u044f\u0445\u00bb \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<p>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 RenderDoc \u0441 \u0437\u0430\u0445\u0432\u0430\u0442\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u0432\u0435\u0441\u0442\u043e\u0432 \u041d\u043e\u0432\u0438\u0433\u0440\u0430\u0434\u0430. \u0412\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/406\/c2d\/e21\/406c2de21d4e934e0f25d0e6331fd272.jpg\"><\/div>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430\u0432, \u044f \u043d\u0430\u0448\u0451\u043b \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438! \u041a\u0430\u043a \u044f \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u0432\u044b\u0448\u0435, \u0435\u0441\u0442\u044c \u0431\u0443\u0444\u0435\u0440 HDR-\u0446\u0432\u0435\u0442\u043e\u0432 (\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430 \u043d\u043e\u043c\u0435\u0440 0, \u043f\u043e\u043b\u043d\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435) \u0438 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u0441\u0446\u0435\u043d\u044b (\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430 \u043d\u043e\u043c\u0435\u0440 1, 1&#215;1, \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u0440\u0430\u043d\u0435\u0435 compute-\u0448\u0435\u0439\u0434\u0435\u0440\u043e\u043c).<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9fe\/836\/3bd\/9fe8363bdeda3b9e7336f0f67fc41dc3.jpg\"><\/div>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430:<\/p>\n<pre><code> ps_5_0       dcl_globalFlags refactoringAllowed       dcl_constantbuffer cb3[17], immediateIndexed       dcl_resource_texture2d (float,float,float,float) t0       dcl_resource_texture2d (float,float,float,float) t1       dcl_input_ps_siv v0.xy, position       dcl_output o0.xyzw       dcl_temps 4      0: ld_indexable(texture2d)(float,float,float,float) r0.x, l(0, 0, 0, 0), t1.xyzw      1: max r0.x, r0.x, cb3[4].y      2: min r0.x, r0.x, cb3[4].z      3: max r0.x, r0.x, l(0.000100)      4: mul r0.y, cb3[16].x, l(11.200000)      5: div r0.x, r0.x, r0.y      6: log r0.x, r0.x      7: mul r0.x, r0.x, cb3[16].z      8: exp r0.x, r0.x      9: mul r0.x, r0.y, r0.x     10: div r0.x, cb3[16].x, r0.x     11: ftou r1.xy, v0.xyxx     12: mov r1.zw, l(0, 0, 0, 0)     13: ld_indexable(texture2d)(float,float,float,float) r0.yzw, r1.xyzw, t0.wxyz     14: mul r0.xyz, r0.yzwy, r0.xxxx     15: mad r1.xyz, cb3[7].xxxx, r0.xyzx, cb3[7].yyyy     16: mul r2.xy, cb3[8].yzyy, cb3[8].xxxx     17: mad r1.xyz, r0.xyzx, r1.xyzx, r2.yyyy     18: mul r0.w, cb3[7].y, cb3[7].z     19: mad r3.xyz, cb3[7].xxxx, r0.xyzx, r0.wwww     20: mad r0.xyz, r0.xyzx, r3.xyzx, r2.xxxx     21: div r0.xyz, r0.xyzx, r1.xyzx     22: mad r0.w, cb3[7].x, l(11.200000), r0.w     23: mad r0.w, r0.w, l(11.200000), r2.x     24: div r1.x, cb3[8].y, cb3[8].z     25: add r0.xyz, r0.xyzx, -r1.xxxx     26: max r0.xyz, r0.xyzx, l(0, 0, 0, 0)     27: mul r0.xyz, r0.xyzx, cb3[16].yyyy     28: mad r1.y, cb3[7].x, l(11.200000), cb3[7].y     29: mad r1.y, r1.y, l(11.200000), r2.y     30: div r0.w, r0.w, r1.y     31: add r0.w, -r1.x, r0.w     32: max r0.w, r0.w, l(0)     33: div o0.xyz, r0.xyzx, r0.wwww     34: mov o0.w, l(1.000000)     35: ret<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u0430\u044f \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0440\u0430\u0432\u043d\u044f\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f (\u0432\u044b\u0437\u043e\u0432\u044b max\/min) \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0430\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442). \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0438\u043b\u0438 \u043d\u0438\u0437\u043a\u043e\u0439 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0446\u0435\u043d\u044b. \u042d\u0442\u043e\u0442 \u0445\u043e\u0434 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u043c, \u043d\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u043b. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u2014 \u0442\u043e\u0442, \u043a\u0442\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043a\u0440\u0438\u0432\u044b\u043c\u0438 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438, \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e \u0443\u0437\u043d\u0430\u044e\u0442 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00ab11.2\u00bb, \u0432\u0435\u0434\u044c \u043f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0431\u0435\u043b\u043e\u0433\u043e \u0438\u0437 <a href=\"http:\/\/filmicworlds.com\/blog\/filmic-tonemapping-operators\/\">\u043a\u0440\u0438\u0432\u043e\u0439 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 Uncharted2<\/a> \u0414\u0436\u043e\u043d\u0430 \u0425\u0435\u0439\u0431\u043b\u0430.<\/p>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b A-F \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0438\u0437 cbuffer.<\/p>\n<p>  \u0422\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0435\u0449\u0451 \u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: cb3_v16.x, cb3_v16.y, cb3_v16.z. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a52\/975\/78b\/a5297578b0069fdded06bd3e82f2fadf.jpg\"><\/div>\n<p>  \u041c\u043e\u0438 \u0434\u043e\u0433\u0430\u0434\u043a\u0438:<\/p>\n<p>  \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u00abx\u00bb \u2014 \u044d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u00ab\u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u0431\u0435\u043b\u043e\u0433\u043e\u00bb \u0438\u043b\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 11.2 (\u0441\u0442\u0440\u043e\u043a\u0430 4), \u0430 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0438 (\u0441\u0442\u0440\u043e\u043a\u0430 10).<\/p>\n<p>  \u00aby\u00bb \u2014 \u044f \u043d\u0430\u0437\u0432\u0430\u043b \u0435\u0433\u043e \u00ab\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u043c \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044f u2\u00bb, \u0438 \u0441\u043a\u043e\u0440\u043e \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u043f\u043e\u0447\u0435\u043c\u0443.<\/p>\n<p>  \u00abz\u00bb \u2014 \u00ab\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0442\u0440\u043e\u0439\u043a\u0435 log\/mul\/exp (\u043f\u043e \u0441\u0443\u0442\u0438 \u2014 \u043f\u0440\u0438 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c).<\/p>\n<p>  \u041d\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u0441\u044c \u043a \u044d\u0442\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441 \u0434\u043e\u043b\u0435\u0439 \u0441\u043a\u0435\u043f\u0442\u0438\u0446\u0438\u0437\u043c\u0430!<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435:<\/p>\n<p>  cb3_v4.yz \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f min\/max \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0439 \u044f\u0440\u043a\u043e\u0441\u0442\u0438,<br \/>  cb3_v7.xyz \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b A-C \u043a\u0440\u0438\u0432\u043e\u0439 Uncharted2,<br \/>  cb3_v8.xyz \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b D-F \u043a\u0440\u0438\u0432\u043e\u0439 Uncharted2.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443 \u2014 \u043d\u0430\u043f\u0438\u0448\u0435\u043c HLSL-\u0448\u0435\u0439\u0434\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0442\u0440\u0443\u0434\u043d\u043e, \u0438 \u0447\u0435\u043c \u0434\u043b\u0438\u043d\u043d\u0435\u0435 \u0448\u0435\u0439\u0434\u0435\u0440, \u0442\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u0447\u0430. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0437\u0430\u0434 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c hlsl-&gt;asm.<\/p>\n<p>  \u041b\u0435\u0434\u0438 \u0438 \u0434\u0436\u0435\u043d\u0442\u043b\u044c\u043c\u0435\u043d\u044b\u2026 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0439\u0442\u0435 D3DShaderDisassembler!<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/394\/463\/6ec\/3944636ec3737e5e1ff5463e7b89d49f.jpg\"><\/div>\n<p>  \u041f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0441 \u043a\u043e\u0434\u043e\u043c, \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0433\u043e\u0442\u043e\u0432\u044b\u0439 HLSL <b><i>\u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 The Witcher 3<\/i><\/b>:<\/p>\n<pre><code> cbuffer cBuffer : register (b3)    {      float4 cb3_v0;      float4 cb3_v1;      float4 cb3_v2;      float4 cb3_v3;      float4 cb3_v4;      float4 cb3_v5;      float4 cb3_v6;      float4 cb3_v7;      float4 cb3_v8;      float4 cb3_v9;      float4 cb3_v10;      float4 cb3_v11;      float4 cb3_v12;      float4 cb3_v13;      float4 cb3_v14;      float4 cb3_v15;      float4 cb3_v16, cb3_v17;    }        Texture2D     TexHDRColor          : register (t0);    Texture2D     TexAvgLuminance     : register (t1);        struct VS_OUTPUT_POSTFX    {      float4 Position : SV_Position;    };        float3 U2Func( float A, float B, float C, float D, float E, float F, float3 x )    {         return ((x*(A*x+C*B)+D*E)\/(x*(A*x+B)+D*F)) - E\/F;    }        float3 ToneMapU2Func( float A, float B, float C, float D, float E, float F, float3 color, float numMultiplier )    {         float3 numerator =  U2Func( A, B, C, D, E, F, color );         numerator = max( numerator, 0 );         numerator.rgb *= numMultiplier;             float3 denominator = U2Func( A, B, C, D, E, F, 11.2 );         denominator = max( denominator, 0 );             return numerator \/ denominator;    }                float4 ToneMappingPS( VS_OUTPUT_POSTFX Input) : SV_Target0    {         float avgLuminance = TexAvgLuminance.Load( int3(0, 0, 0) );         avgLuminance = clamp( avgLuminance, cb3_v4.y, cb3_v4.z );         avgLuminance = max( avgLuminance, 1e-4 );             float scaledWhitePoint = cb3_v16.x * 11.2;             float luma = avgLuminance \/ scaledWhitePoint;         luma = pow( luma, cb3_v16.z );             luma = luma * scaledWhitePoint;         luma = cb3_v16.x \/ luma;             float3 HDRColor = TexHDRColor.Load( uint3(Input.Position.xy, 0) ).rgb;             float3 color = ToneMapU2Func( cb3_v7.x, cb3_v7.y, cb3_v7.z, cb3_v8.x, cb3_v8.y,             cb3_v8.z, luma*HDRColor, cb3_v16.y);             return float4(color, 1);    }<\/code><\/pre>\n<p>  \u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0438\u0437 \u043c\u043e\u0435\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f9c\/1e9\/70a\/f9c1e970a743cac54c9129261514c3e1.jpg\"><\/div>\n<p>  \u0412\u0443\u0430\u043b\u044f!<\/p>\n<p>  \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 TW3, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u042f \u0443\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u0451\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 \u0438 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e!<\/p>\n<p>  \u042f \u0441\u043a\u0430\u0437\u0430\u043b \u00ab\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u00bb, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <i>\u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u044e<\/i>, \u043f\u043e\u0447\u0435\u043c\u0443 denominator \u0432 ToneMapU2Func \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438 \u043d\u0443\u043b\u0435. \u041f\u0440\u0438 \u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043d\u0430 0 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u0435\u0434\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c\u0441\u044f undefined?<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c, \u043d\u043e \u043f\u043e\u0447\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0432 \u044d\u0442\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 TW3, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u0437\u0430\u043a\u0430\u0442\u0430 (\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0433\u0440\u0430\u0444\u0438\u043a\u0438!)<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/292\/25b\/bea\/29225bbeae55c97c5a83e3461f7f24a7.jpg\"><\/div>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u0448\u0435\u0439\u0434\u0435\u0440\u0430:<\/p>\n<pre><code> ps_5_0       dcl_globalFlags refactoringAllowed       dcl_constantbuffer cb3[18], immediateIndexed       dcl_resource_texture2d (float,float,float,float) t0       dcl_resource_texture2d (float,float,float,float) t1       dcl_input_ps_siv v0.xy, position       dcl_output o0.xyzw       dcl_temps 5      0: ld_indexable(texture2d)(float,float,float,float) r0.x, l(0, 0, 0, 0), t1.xyzw      1: max r0.y, r0.x, cb3[9].y      2: max r0.x, r0.x, cb3[4].y      3: min r0.x, r0.x, cb3[4].z      4: min r0.y, r0.y, cb3[9].z      5: max r0.xy, r0.xyxx, l(0.000100, 0.000100, 0.000000, 0.000000)      6: mul r0.z, cb3[17].x, l(11.200000)      7: div r0.y, r0.y, r0.z      8: log r0.y, r0.y      9: mul r0.y, r0.y, cb3[17].z     10: exp r0.y, r0.y     11: mul r0.y, r0.z, r0.y     12: div r0.y, cb3[17].x, r0.y     13: ftou r1.xy, v0.xyxx     14: mov r1.zw, l(0, 0, 0, 0)     15: ld_indexable(texture2d)(float,float,float,float) r1.xyz, r1.xyzw, t0.xyzw     16: mul r0.yzw, r0.yyyy, r1.xxyz     17: mad r2.xyz, cb3[11].xxxx, r0.yzwy, cb3[11].yyyy     18: mul r3.xy, cb3[12].yzyy, cb3[12].xxxx     19: mad r2.xyz, r0.yzwy, r2.xyzx, r3.yyyy     20: mul r1.w, cb3[11].y, cb3[11].z     21: mad r4.xyz, cb3[11].xxxx, r0.yzwy, r1.wwww     22: mad r0.yzw, r0.yyzw, r4.xxyz, r3.xxxx     23: div r0.yzw, r0.yyzw, r2.xxyz     24: mad r1.w, cb3[11].x, l(11.200000), r1.w     25: mad r1.w, r1.w, l(11.200000), r3.x     26: div r2.x, cb3[12].y, cb3[12].z     27: add r0.yzw, r0.yyzw, -r2.xxxx     28: max r0.yzw, r0.yyzw, l(0, 0, 0, 0)     29: mul r0.yzw, r0.yyzw, cb3[17].yyyy     30: mad r2.y, cb3[11].x, l(11.200000), cb3[11].y     31: mad r2.y, r2.y, l(11.200000), r3.y     32: div r1.w, r1.w, r2.y     33: add r1.w, -r2.x, r1.w     34: max r1.w, r1.w, l(0)     35: div r0.yzw, r0.yyzw, r1.wwww     36: mul r1.w, cb3[16].x, l(11.200000)     37: div r0.x, r0.x, r1.w     38: log r0.x, r0.x     39: mul r0.x, r0.x, cb3[16].z     40: exp r0.x, r0.x     41: mul r0.x, r1.w, r0.x     42: div r0.x, cb3[16].x, r0.x     43: mul r1.xyz, r1.xyzx, r0.xxxx     44: mad r2.xyz, cb3[7].xxxx, r1.xyzx, cb3[7].yyyy     45: mul r3.xy, cb3[8].yzyy, cb3[8].xxxx     46: mad r2.xyz, r1.xyzx, r2.xyzx, r3.yyyy     47: mul r0.x, cb3[7].y, cb3[7].z     48: mad r4.xyz, cb3[7].xxxx, r1.xyzx, r0.xxxx     49: mad r1.xyz, r1.xyzx, r4.xyzx, r3.xxxx     50: div r1.xyz, r1.xyzx, r2.xyzx     51: mad r0.x, cb3[7].x, l(11.200000), r0.x     52: mad r0.x, r0.x, l(11.200000), r3.x     53: div r1.w, cb3[8].y, cb3[8].z     54: add r1.xyz, -r1.wwww, r1.xyzx     55: max r1.xyz, r1.xyzx, l(0, 0, 0, 0)     56: mul r1.xyz, r1.xyzx, cb3[16].yyyy     57: mad r2.x, cb3[7].x, l(11.200000), cb3[7].y     58: mad r2.x, r2.x, l(11.200000), r3.y     59: div r0.x, r0.x, r2.x     60: add r0.x, -r1.w, r0.x     61: max r0.x, r0.x, l(0)     62: div r1.xyz, r1.xyzx, r0.xxxx     63: add r0.xyz, r0.yzwy, -r1.xyzx     64: mad o0.xyz, cb3[13].xxxx, r0.xyzx, r1.xyzx     65: mov o0.w, l(1.000000)     66: ret<\/code><\/pre>\n<p>  \u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0443\u0433\u0430\u044e\u0449\u0435, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u0432\u0441\u0451 \u0442\u0430\u043a \u043f\u043b\u043e\u0445\u043e. \u041f\u043e\u0441\u043b\u0435 \u043a\u0440\u0430\u0442\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Uncharted2 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043d\u0430\u0431\u043e\u0440\u0430\u043c\u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (A-F, min\/max \u044f\u0440\u043a\u043e\u0441\u0442\u044c&#8230;). \u0422\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044f \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b.<\/p>\n<p>  \u0418 HLSL:<\/p>\n<pre><code> cbuffer cBuffer : register (b3)    {      float4 cb3_v0;      float4 cb3_v1;      float4 cb3_v2;      float4 cb3_v3;      float4 cb3_v4;      float4 cb3_v5;      float4 cb3_v6;      float4 cb3_v7;      float4 cb3_v8;      float4 cb3_v9;      float4 cb3_v10;      float4 cb3_v11;      float4 cb3_v12;      float4 cb3_v13;      float4 cb3_v14;      float4 cb3_v15;      float4 cb3_v16, cb3_v17;    }        Texture2D     TexHDRColor     : register (t0);    Texture2D     TexAvgLuminance     : register (t1);        float3 U2Func( float A, float B, float C, float D, float E, float F, float3 x )    {         return ((x*(A*x+C*B)+D*E)\/(x*(A*x+B)+D*F)) - E\/F;    }        float3 ToneMapU2Func( float A, float B, float C, float D, float E, float F, float3 color, float numMultiplier )    {         float3 numerator =  U2Func( A, B, C, D, E, F, color );         numerator = max( numerator, 0 );         numerator.rgb *= numMultiplier;             float3 denominator = U2Func( A, B, C, D, E, F, 11.2 );         denominator = max( denominator, 0 );             return numerator \/ denominator;    }        struct VS_OUTPUT_POSTFX    {      float4 Position : SV_Position;    };        float getExposure(float avgLuminance, float minLuminance, float maxLuminance, float middleGray, float powParam)    {         avgLuminance = clamp( avgLuminance, minLuminance, maxLuminance );         avgLuminance = max( avgLuminance, 1e-4 );             float scaledWhitePoint = middleGray * 11.2;             float luma = avgLuminance \/ scaledWhitePoint;         luma = pow( luma, powParam);             luma = luma * scaledWhitePoint;         float exposure = middleGray \/ luma;         return exposure;    }        float4 ToneMappingPS( VS_OUTPUT_POSTFX Input) : SV_Target0    {         float avgLuminance = TexAvgLuminance.Load( int3(0, 0, 0) );                   float exposure1 = getExposure( avgLuminance, cb3_v9.y, cb3_v9.z, cb3_v17.x, cb3_v17.z);         float exposure2 = getExposure( avgLuminance, cb3_v4.y, cb3_v4.z, cb3_v16.x, cb3_v16.z);                      float3 HDRColor = TexHDRColor.Load( uint3(Input.Position.xy, 0) ).rgb;             float3 color1 = ToneMapU2Func( cb3_v11.x, cb3_v11.y, cb3_v11.z, cb3_v12.x, cb3_v12.y,             cb3_v12.z, exposure1*HDRColor, cb3_v17.y);             float3 color2 = ToneMapU2Func( cb3_v7.x, cb3_v7.y, cb3_v7.z, cb3_v8.x, cb3_v8.y,             cb3_v8.z, exposure2*HDRColor, cb3_v16.y);                float3 finalColor = lerp( color2, color1, cb3_v13.x );        return float4(finalColor, 1);    }<\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043e \u0441\u0443\u0442\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0434\u0432\u0430 \u0446\u0432\u0435\u0442\u0430 \u0441 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0435\u0439, \u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u0438\u0445. \u0423\u043c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435!<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 2: \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u0433\u043b\u0430\u0437\u0430<\/h2>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0432 TW3 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f. \u041e\u0431\u044a\u044f\u0441\u043d\u044f\u044f \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u044b, \u044f \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044e \u0433\u043b\u0430\u0437\u0430. \u0418 \u0437\u043d\u0430\u0435\u0442\u0435 \u0447\u0442\u043e? \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u0433\u043b\u0430\u0437\u0430.<\/p>\n<p>  \u041d\u043e \u043f\u043e\u0441\u0442\u043e\u0439\u0442\u0435, \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u0433\u043b\u0430\u0437\u0430 \u0438 \u0437\u0430\u0447\u0435\u043c \u043e\u043d\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430? <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%B4%D0%B0%D0%BF%D1%82%D0%B0%D1%86%D0%B8%D1%8F_%D0%B3%D0%BB%D0%B0%D0%B7%D0%B0\">\u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044f<\/a> \u0437\u043d\u0430\u0435\u0442 \u043e \u043d\u0435\u0439 \u0432\u0441\u0451, \u043d\u043e \u044f \u043e\u0431\u044a\u044f\u0441\u043d\u044e: \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0435\u0441\u044c \u0432 \u0442\u0451\u043c\u043d\u043e\u0439 \u043a\u043e\u043c\u043d\u0430\u0442\u0435 (\u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c Life is Strange) \u0438\u043b\u0438 \u0432 \u043f\u0435\u0449\u0435\u0440\u0435, \u0438 \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0430\u0440\u0443\u0436\u0443, \u0433\u0434\u0435 \u0441\u0432\u0435\u0442\u043b\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u043b\u043d\u0446\u0435.<\/p>\n<p>  \u0412 \u0442\u0435\u043c\u043d\u043e\u0442\u0435 \u043d\u0430\u0448\u0438 \u0437\u0440\u0430\u0447\u043a\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445 \u043a \u0441\u0435\u0442\u0447\u0430\u0442\u043a\u0435 \u043f\u043e\u043f\u0430\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0432\u0435\u0442\u0430. \u041a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u0432\u0435\u0442\u043b\u043e, \u043d\u0430\u0448\u0438 \u0437\u0440\u0430\u0447\u043a\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0433\u043b\u0430\u0437\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u00ab\u0431\u043e\u043b\u044c\u043d\u043e\u00bb.<\/p>\n<p>  \u042d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e. \u0413\u043b\u0430\u0437 \u0434\u043e\u043b\u0436\u0435\u043d \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c \u044f\u0440\u043a\u043e\u0441\u0442\u0438. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044e \u0433\u043b\u0430\u0437\u0430 \u043f\u0440\u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0435 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438 \u0433\u043b\u0430\u0437\u0430 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/github.com\/walbourn\/directx-sdk-samples\/tree\/master\/HDRToneMappingCS11\">HDRToneMappingCS11<\/a> \u0438\u0437 DirectX SDK. \u0420\u0435\u0437\u043a\u0438\u0435 \u0441\u043c\u0435\u043d\u044b \u0441\u0440\u0435\u0434\u043d\u0435\u0439 \u044f\u0440\u043a\u043e\u0441\u0442\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b \u0438 \u043d\u0435\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c! \u0420\u0430\u0434\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043a\u0430\u0434\u0440 \u0438\u0437 \u041d\u043e\u0432\u0438\u0433\u0440\u0430\u0434\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/406\/c2d\/e21\/406c2de21d4e934e0f25d0e6331fd272.jpg\"><\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0443\u0433\u043b\u0443\u0431\u0438\u043c\u0441\u044f \u0432 \u0437\u0430\u0445\u0432\u0430\u0442 \u043a\u0430\u0434\u0440\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 RenderDoc. \u0410\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u0433\u043b\u0430\u0437\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u043e \u043f\u0435\u0440\u0435\u0434 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0435\u0439, \u0438 \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a 3\u00bb \u0432 \u044d\u0442\u043e\u043c \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8ed\/fde\/eec\/8edfdeeec29fef781801b94948c90e6f.png\"><\/div>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e68\/2fd\/2f4\/e682fd2f410f32eb8661c2476c8a2294.jpg\"><\/div>\n<p>  \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 2 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b, R32_FLOAT, 1&#215;1 (\u043e\u0434\u0438\u043d \u043f\u0438\u043a\u0441\u0435\u043b\u044c). texture0 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u0441\u0446\u0435\u043d\u044b \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430. texture1 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u0441\u0446\u0435\u043d\u044b \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430 (\u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c compute-\u0448\u0435\u0439\u0434\u0435\u0440\u043e\u043c \u2014 \u044f \u043f\u043e\u043c\u0435\u0442\u0438\u043b \u044d\u0442\u043e \u0441\u0438\u043d\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u043c).<\/p>\n<p>  \u0412\u043f\u043e\u043b\u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 R32_FLOAT, 1&#215;1. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440.<\/p>\n<pre><code> ps_5_0       dcl_globalFlags refactoringAllowed       dcl_constantbuffer cb3[1], immediateIndexed       dcl_sampler s0, mode_default       dcl_sampler s1, mode_default       dcl_resource_texture2d (float,float,float,float) t0       dcl_resource_texture2d (float,float,float,float) t1       dcl_output o0.xyzw       dcl_temps 1      0: sample_l(texture2d)(float,float,float,float) r0.x, l(0, 0, 0, 0), t1.xyzw, s1, l(0)      1: sample_l(texture2d)(float,float,float,float) r0.y, l(0, 0, 0, 0), t0.yxzw, s0, l(0)      2: ge r0.z, r0.y, r0.x      3: add r0.x, -r0.y, r0.x      4: movc r0.z, r0.z, cb3[0].x, cb3[0].y      5: mad o0.xyzw, r0.zzzz, r0.xxxx, r0.yyyy      6: ret<\/code><\/pre>\n<p>  \u041e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439! \u0412\u0441\u0435\u0433\u043e 7 \u0441\u0442\u0440\u043e\u043a \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442? \u041e\u0431\u044a\u044f\u0441\u043d\u044e \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<p>  0) \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430.<br \/>  1) \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430.<br \/>  2) \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443: \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u043d\u0430 \u044f\u0440\u043a\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u0434\u0440\u0430?<br \/>   \u0415\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u0441\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<br \/>  3) \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c:<i> difference = currentLum \u2014 previousLum.<\/i><br \/>  4) \u042d\u0442\u0430 \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0430 (movc) \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 2 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0434\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0443\u043c\u043d\u044b\u0439 \u0445\u043e\u0434, \u0432\u0435\u0434\u044c \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u0438 \u0438 \u0434\u043b\u044f \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f, \u0438 \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u044f\u0440\u043a\u043e\u0441\u0442\u0438. \u041d\u043e \u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u043e\u0431\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043e\u0442 0.11 \u0434\u043e 0.3.<br \/>  5) \u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u044f\u0440\u043a\u043e\u0441\u0442\u0438: <i>adaptedLuminance = speedFactor * difference\u00a0+ previousLuminance.<\/i><br \/>  6) \u041a\u043e\u043d\u0435\u0446 \u0448\u0435\u0439\u0434\u0435\u0440\u0430<\/p>\n<p>  \u042d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 HLSL \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code> \/\/ The Witcher 3 eye adaptation shader        cbuffer cBuffer : register (b3)    {      float4 cb3_v0;    }     struct VS_OUTPUT_POSTFX    {      float4 Position                                             : SV_Position;    };       SamplerState samplerPointClamp : register (s0);    SamplerState samplerPointClamp2 : register (s1);        Texture2D TexPreviousAvgLuminance  : register (t0);    Texture2D TexCurrentAvgLuminance  : register (t1);        float4 TW3_EyeAdaptationPS(VS_OUTPUT_POSTFX Input) : SV_TARGET    {      \/\/ Get current and previous luminance.      float currentAvgLuminance = TexCurrentAvgLuminance.SampleLevel( samplerPointClamp2, float2(0.0, 0.0), 0 );      float previousAvgLuminance = TexPreviousAvgLuminance.SampleLevel( samplerPointClamp, float2(0.0, 0.0), 0 );            \/\/ Difference between current and previous luminance.      float difference = currentAvgLuminance - previousAvgLuminance;          \/\/ Scale factor. Can be different for both falling down and rising up of luminance.      \/\/ It affects speed of adaptation.      \/\/ Small conditional test is performed here, so different speed can be set differently for both these cases.      float adaptationSpeedFactor = (currentAvgLuminance &lt;= previousAvgLuminance) ? cb3_v0.x : cb3_v0.y;          \/\/ Calculate adapted luminance.      float adaptedLuminance = adaptationSpeedFactor * difference + previousAvgLuminance;      return adaptedLuminance;    }<\/code><\/pre>\n<p>  \u042d\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u0430\u044e\u0442 \u043d\u0430\u043c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434. \u042f \u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0438\u043f \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 <i>float4<\/i> \u043d\u0430 <i>float<\/i>. \u041d\u0435\u0442 \u043d\u0443\u0436\u0434\u044b \u0432 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0439 \u0442\u0440\u0430\u0442\u0435 \u043f\u043e\u043b\u043e\u0441\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u044f. \u0412\u043e\u0442 \u0442\u0430\u043a \u0432 Witcher 3 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044f \u0433\u043b\u0430\u0437\u0430. \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u0440\u0430\u0432\u0434\u0430?<\/p>\n<p>  PS. \u041e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0411\u0430\u043b\u0434\u0443\u0440\u0443 \u041a\u0430\u0440\u043b\u0441\u0441\u043e\u043d\u0443 (Twitter: <a href=\"https:\/\/twitter.com\/baldurk\">@baldurk<\/a>\u00a0) \u0437\u0430 RenderDoc. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 3: \u0445\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u044f<\/h2>\n<p>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A5%D1%80%D0%BE%D0%BC%D0%B0%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B0%D1%8F_%D0%B0%D0%B1%D0%B5%D1%80%D1%80%D0%B0%D1%86%D0%B8%D1%8F\">\u0425\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u044f<\/a> \u2014 \u044d\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0443 \u0434\u0435\u0448\u0451\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043e\u0432. \u041e\u043d \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u044b \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043f\u0440\u0435\u043b\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u043b\u0438\u043d \u0432\u0438\u0434\u0438\u043c\u043e\u0433\u043e \u0441\u0432\u0435\u0442\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0438\u0434\u0438\u043c\u043e\u0435 \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u043e\u043d\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u043d\u0435 \u0432\u0441\u0435\u043c. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0432 Witcher 3 \u044d\u0442\u043e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e\u0437\u0430\u043c\u0435\u0442\u0435\u043d, \u0430 \u043f\u043e\u0442\u043e\u043c\u0443 \u043d\u0435 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u0435\u0442 \u043f\u0440\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 (\u043c\u0435\u043d\u044f, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435). \u041d\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0446\u0435\u043d\u044b \u0441 \u0445\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u0435\u0439 \u0438 \u0431\u0435\u0437 \u043d\u0435\u0451:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a5e\/078\/853\/a5e0788530c688f849013ff3ed64134f.png\"><\/div>\n<p>  <i>\u0425\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430<\/i><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d8d\/20f\/ee7\/d8d20fee7a901301b9f2e5f67a2f56be.png\"><\/div>\n<p>  <i>\u0425\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0430<\/i><\/p>\n<p>  \u0412\u044b \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u0442\u0435 \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u0440\u044f\u0434\u043e\u043c \u0441 \u043a\u0440\u0430\u044f\u043c\u0438? \u042f \u0442\u043e\u0436\u0435 \u043d\u0435\u0442. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0446\u0435\u043d\u0443:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/cff\/9a3\/b41\/cff9a3b41c135e4c43cd3065328dc235.png\"><\/div>\n<p>  <i>\u0425\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u00ab\u043a\u0440\u0430\u0441\u043d\u043e\u0435\u00bb \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438.<\/i><\/p>\n<p>  \u0410\u0433\u0430, \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435! \u0417\u0434\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442 \u043c\u0435\u0436\u0434\u0443 \u0442\u0451\u043c\u043d\u044b\u043c\u0438 \u0438 \u0441\u0432\u0435\u0442\u043b\u044b\u043c\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438 \u0441\u0438\u043b\u044c\u043d\u0435\u0435, \u0438 \u0432 \u0443\u0433\u043b\u0443 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u0438\u0435. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u0430\u0431. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a \u043e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0441\u0430\u043c\u043e\u0439 \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438: \u043a \u043a\u043e\u0434\u0443!<\/p>\n<p>  <b>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0441 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u043c. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0445\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u00ab\u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0445\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u0438, \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0433\u0430\u043c\u043c\u0430-\u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438. \u0412\u0441\u0451 \u044d\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u043f\u0440\u0438\u0433\u043b\u044f\u0434\u0438\u043c\u0441\u044f \u043a \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430:<\/p>\n<pre><code> ps_5_0       dcl_globalFlags refactoringAllowed       dcl_constantbuffer cb3[18], immediateIndexed       dcl_sampler s1, mode_default       dcl_resource_texture2d (float,float,float,float) t0       dcl_input_ps_siv v0.xy, position       dcl_input_ps linear v1.zw       dcl_output o0.xyzw       dcl_temps 4      0: mul r0.xy, v0.xyxx, cb3[17].zwzz      1: mad r0.zw, v0.xxxy, cb3[17].zzzw, -cb3[17].xxxy      2: div r0.zw, r0.zzzw, cb3[17].xxxy      3: dp2 r1.x, r0.zwzz, r0.zwzz      4: sqrt r1.x, r1.x      5: add r1.y, r1.x, -cb3[16].y      6: mul_sat r1.y, r1.y, cb3[16].z      7: sample_l(texture2d)(float,float,float,float) r2.xyz, r0.xyxx, t0.xyzw, s1, l(0)      8: lt r1.z, l(0), r1.y      9: if_nz r1.z     10:  mul r1.y, r1.y, r1.y     11:  mul r1.y, r1.y, cb3[16].x     12:  max r1.x, r1.x, l(0.000100)     13:  div r1.x, r1.y, r1.x     14:  mul r0.zw, r0.zzzw, r1.xxxx     15:  mul r0.zw, r0.zzzw, cb3[17].zzzw     16:  mad r0.xy, -r0.zwzz, l(2.000000, 2.000000, 0.000000, 0.000000), r0.xyxx     17:  sample_l(texture2d)(float,float,float,float) r2.x, r0.xyxx, t0.xyzw, s1, l(0)     18:  mad r0.xy, v0.xyxx, cb3[17].zwzz, -r0.zwzz     19:  sample_l(texture2d)(float,float,float,float) r2.y, r0.xyxx, t0.xyzw, s1, l(0)     20: endif    ...<\/code><\/pre>\n<p>  \u0418 \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c cbuffer:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7d9\/e1d\/6b6\/7d9e1d6b60039074712ea0e60dba2ae0.jpg\"><\/div>\n<p>  \u0422\u0430\u043a, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u041f\u043e \u0441\u0443\u0442\u0438, cb3_v17.xy \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440\u043e\u043c \u0445\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442 2d-\u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u0437 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0442\u0435\u043a\u0441\u0435\u043b\u043e\u0432 (cb3_v17.zw = \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0432\u044c\u044e\u043f\u043e\u0440\u0442\u0430) \u0434\u043e \u00ab\u0446\u0435\u043d\u0442\u0440\u0430 \u0445\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u0438\u00bb \u0438 \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0443, \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0435. \u041f\u0440\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0445\u0440\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0435\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u0438 \u0438\u0441\u043a\u0430\u0436\u0430\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u044b R \u0438 G. \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0447\u0435\u043c \u0431\u043b\u0438\u0436\u0435 \u043a \u043a\u0440\u0430\u044f\u043c \u044d\u043a\u0440\u0430\u043d\u0430, \u0442\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442. \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 10, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u00ab\u043f\u0440\u0438\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0431\u043b\u0438\u0436\u0435\u00bb, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0440\u0435\u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0430\u0431\u0435\u0440\u0440\u0430\u0446\u0438\u044e. \u0421 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0432\u0430\u043c\u0438 \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u044d\u0444\u0444\u0435\u043a\u0442\u0430. \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0439\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441 (\u0441\u043e\u043b\u0438\u0434\u043d\u043e\u0439) \u0434\u043e\u043b\u0435\u0439 \u0441\u043a\u0435\u043f\u0442\u0438\u0446\u0438\u0437\u043c\u0430. \u0418 \u0443\u0447\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f <i>\u0434\u043e<\/i> \u0433\u0430\u043c\u043c\u0430-\u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438.<\/p>\n<pre><code> void ChromaticAberration( float2 uv, inout float3 color )    {      \/\/ User-defined params      float2 chromaticAberrationCenter = float2(0.5, 0.5);      float chromaticAberrationCenterAvoidanceDistance = 0.2;      float fA = 1.25;      float fChromaticAbberationIntensity = 30;      float fChromaticAberrationDistortionSize = 0.75;          \/\/ Calculate vector      float2 chromaticAberrationOffset = uv - chromaticAberrationCenter;      chromaticAberrationOffset = chromaticAberrationOffset \/ chromaticAberrationCenter;            float chromaticAberrationOffsetLength = length(chromaticAberrationOffset);           \/\/ To avoid applying chromatic aberration in center, subtract small value from      \/\/ just calculated length.      float chromaticAberrationOffsetLengthFixed = chromaticAberrationOffsetLength - chromaticAberrationCenterAvoidanceDistance;      float chromaticAberrationTexel = saturate(chromaticAberrationOffsetLengthFixed * fA);          float fApplyChromaticAberration = (0.0 &lt; chromaticAberrationTexel);      if (fApplyChromaticAberration)      {        chromaticAberrationTexel *= chromaticAberrationTexel;        chromaticAberrationTexel *= fChromaticAberrationDistortionSize;            chromaticAberrationOffsetLength = max(chromaticAberrationOffsetLength, 1e-4);                float fMultiplier = chromaticAberrationTexel \/ chromaticAberrationOffsetLength;            chromaticAberrationOffset *= fMultiplier;        chromaticAberrationOffset *= g_Viewport.zw;        chromaticAberrationOffset *= fChromaticAbberationIntensity;            float2 offsetUV = -chromaticAberrationOffset * 2 + uv;        color.r = TexColorBuffer.SampleLevel(samplerLinearClamp, offsetUV, 0).r;            offsetUV = uv - chromaticAberrationOffset;        color.g = TexColorBuffer.SampleLevel(samplerLinearClamp, offsetUV, 0).g;      }    }<\/code><\/pre>\n<p>  \u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u00abfChromaticAberrationIntensity\u00bb, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0438 \u0441\u0438\u043b\u0443 \u044d\u0444\u0444\u0435\u043a\u0442\u0430, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f (TW3 = 1.0). Intensity = 40:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/864\/69e\/aea\/86469eaea28862b558fa90784b8c4585.png\"><\/div>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0451! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c 4: \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%92%D0%B8%D0%BD%D1%8C%D0%B5%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5\">\u0412\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a> \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u0438\u0433\u0440\u0430\u0445. \u041e\u043d \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0435\u043d \u0438 \u0432 \u0444\u043e\u0442\u043e\u0441\u044a\u0451\u043c\u043a\u0435. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u0430\u0442\u0435\u043d\u0451\u043d\u043d\u044b\u0435 \u0443\u0433\u043b\u044b \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <a href=\"https:\/\/github.com\/EpicGames\/UnrealEngine\/blob\/1d2c1e48bf49836a4fee1465be87ab3f27d5ae3a\/Engine\/Shaders\/Private\/PostProcessCommon.ush#L138\">Unreal Engine 4<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439. \u041d\u043e \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a The Witcher 3. <a href=\"https:\/\/international.download.nvidia.com\/geforce-com\/international\/comparisons\/the-witcher-3-wild-hunt\/the-witcher-3-wild-hunt-vignette-interactive-comparison-1-on-vs-off.html\">\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u0441\u044e\u0434\u0430<\/a>, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u0430\u0434\u0440\u043e\u0432 \u0441 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u0437\u044f\u0442\u043e \u0438\u0437 <a href=\"https:\/\/www.geforce.com\/whats-new\/guides\/the-witcher-3-wild-hunt-graphics-performance-and-tweaking-guide\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 NVIDIA \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 The Witcher 3<\/a>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b27\/b52\/986\/b27b52986e845f39a32710276adc9fa8.png\"><\/div>\n<p>  <i>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0438\u0437 \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a\u0430 3\u00bb \u0441\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c.<\/i><\/p>\n<p>  \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u043b\u0435\u0432\u044b\u0439 \u0443\u0433\u043e\u043b (\u043d\u0435\u0431\u043e) \u043d\u0435 \u0442\u0430\u043a \u0437\u0430\u0442\u0435\u043d\u0451\u043d, \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u0437\u0436\u0435 \u043c\u044b \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443.<\/p>\n<p>  <b>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/b><\/p>\n<p>  \u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a\u0430 3\u00bb (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0432\u044b\u043f\u0443\u0449\u0435\u043d\u0430 19 \u043c\u0430\u044f 2015 \u0433\u043e\u0434\u0430) \u0438 \u0432 \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a 3: \u041a\u0440\u043e\u0432\u044c \u0438 \u0432\u0438\u043d\u043e\u00bb. \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u00ab\u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u00bb \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u0430, \u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043e\u043d \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 2D-\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 256&#215;256:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/455\/0b4\/c1d\/4550b4c1d1a0ae80923cd75cd63c3e7f.jpg\"><\/div>\n<p>  \u0422\u0435\u043a\u0441\u0442\u0443\u0440\u0430 256&#215;256, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u043a\u0430\u043a \u00ab\u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u00bb \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u00ab\u041a\u0440\u043e\u0432\u044c \u0438 \u0432\u0438\u043d\u043e\u00bb.<\/p>\n<p>  \u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0435\u0439\u0434\u0435\u0440 \u0438\u0437 \u00ab\u041a\u0440\u043e\u0432\u0438 \u0438 \u0432\u0438\u043d\u0430\u00bb (\u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0438\u0433\u0440\u0430, \u043a\u0441\u0442\u0430\u0442\u0438). \u041a\u0430\u043a \u0438 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0433\u0440, \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a\u0430 3\u00bb \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0435 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code> ...     44: log r0.xyz, r0.xyzx     45: mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000)     46: exp r0.xyz, r0.xyzx     47: mul r1.xyz, r0.xyzx, cb3[9].xyzx     48: sample_indexable(texture2d)(float,float,float,float) r0.w, v1.zwzz, t2.yzwx, s2     49: log r2.xyz, r1.xyzx     50: mul r2.xyz, r2.xyzx, l(2.200000, 2.200000, 2.200000, 0.000000)     51: exp r2.xyz, r2.xyzx     52: dp3 r1.w, r2.xyzx, cb3[6].xyzx     53: add_sat r1.w, -r1.w, l(1.000000)     54: mul r1.w, r1.w, cb3[6].w     55: mul_sat r0.w, r0.w, r1.w     56: mad r0.xyz, -r0.xyzx, cb3[9].xyzx, cb3[7].xyzx     57: mad r0.xyz, r0.wwww, r0.xyzx, r1.xyzx    ...<\/code><\/pre>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e! \u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u0433\u0430\u043c\u043c\u0430 (\u0441\u0442\u0440\u043e\u043a\u0430 46), \u0438 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 (\u0441\u0442\u0440\u043e\u043a\u0430 51). \u0412 \u0441\u0442\u0440\u043e\u043a\u0435 48 \u043c\u044b \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u0443\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u00ab\u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430\u00bb. cb3[9].xyz \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u043c \u043a\u0430\u0434\u0440\u0435 \u0435\u043c\u0443 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 float3(1.0, 1.0, 1.0), \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c \u0432 \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u0445 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0437\u0430\u0442\u0435\u043c\u043d\u0435\u043d\u0438\u044f\/\u043e\u0441\u0432\u0435\u0442\u043b\u0435\u043d\u0438\u044f \u044d\u043a\u0440\u0430\u043d\u0430 (fade-in \/ fade-out). \u0414\u043b\u044f \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 TW3 \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430:<\/p>\n<ul>\n<li>\u041d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c (cb3[6].w) \u2014 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0441\u0438\u043b\u0443 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. 0 \u2014 \u043d\u0435\u0442 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, 1 \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u041f\u043e \u043c\u043e\u0438\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c, \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u043c The Witcher 3 \u043e\u043d \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0432\u0435\u043d 1.0, \u0430 \u0432 \u00ab\u041a\u0440\u043e\u0432\u0438 \u0438 \u0432\u0438\u043d\u0435\u00bb \u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u0439\u043e\u043d\u0435 0.15.<\/li>\n<li>\u0426\u0432\u0435\u0442 (cb3[7].xyz) \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f TW3 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0446\u0432\u0435\u0442\u0430. \u041e\u043d\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u043e \u0431\u044b\u0442\u044c \u0447\u0451\u0440\u043d\u044b\u043c, \u043d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435\u2026 \u041e\u0431\u044b\u0447\u043d\u043e \u043e\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f float3( 3.0 \/ 255.0, 4.0 \/ 255.0, 5.0 \/ 255.0 ) \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435 \u2014 \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b, \u043a\u0440\u0430\u0442\u043d\u044b\u0435 0.00392156 = 1.0\/255.0<\/li>\n<li>\u0412\u0435\u0441\u0430 (cb3[6].xyz) \u2014 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440. \u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0438\u0434\u0435\u043b \u00ab\u043f\u043b\u043e\u0441\u043a\u0438\u0435\u00bb \u0432\u0438\u043d\u044c\u0435\u0442\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0438\u0435:<\/li>\n<\/ul>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a25\/9e8\/7f9\/a259e87f9e5bbfc3edf6b4ff30aea90d.png\"><\/div>\n<p>  <i>\u0422\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u043c\u0430\u0441\u043a\u0430 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/i><\/p>\n<p>  \u041d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u0441\u043e\u0432 (\u0441\u0442\u0440\u043e\u043a\u0430 52) \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6c0\/c88\/6c0\/6c0c886c0175635ba609ef61e61b3ea3.png\"><\/div>\n<p>  <i>\u041c\u0430\u0441\u043a\u0430 \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f TW3, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0441\u043e\u0432<\/i><\/p>\n<p>  \u0412\u0435\u0441\u0430 \u0431\u043b\u0438\u0437\u043a\u0438 \u043a 1.0. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u0438\u0437 \u00ab\u041a\u0440\u043e\u0432\u0438 \u0438 \u0432\u0438\u043d\u0430\u00bb (\u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0438\u0440\u0430 \u0441 \u0440\u0430\u0434\u0443\u0433\u043e\u0439): \u0432\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430 \u044f\u0440\u043a\u0438\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043d\u0435\u0431\u0430 \u043d\u0435 \u043f\u043e\u0432\u043b\u0438\u044f\u043b\u043e \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/68a\/2a9\/9e5\/68a2a99e54b0c8cf9e71561001315a34.png\"><\/div>\n<p>  <b>\u041a\u043e\u0434<\/b><\/p>\n<p>  \u0412\u043e\u0442 \u043c\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0438\u043d\u044c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f TW3 \u043d\u0430 HLSL.<\/p>\n<p>  GammaToLinear = pow(color, 2.2)<\/p>\n<pre><code> \/*    \/\/ The Witcher 3 vignette.    \/\/    \/\/ Input color is in gamma space    \/\/ Output color is in gamma space as well.    *\/    float3 Vignette_TW3( in float3 gammaColor, in float3 vignetteColor, in float3 vignetteWeights,                         in float vignetteOpacity, in Texture2D texVignette, in float2 texUV )    {         \/\/ For coloring vignette         float3 vignetteColorGammaSpace = -gammaColor + vignetteColor;             \/\/ Calculate vignette amount based on color in *LINEAR* color space and vignette weights.         float vignetteWeight = dot( GammaToLinear( gammaColor ), vignetteWeights );             \/\/ We need to keep vignette weight in [0-1] range         vignetteWeight = saturate( 1.0 - vignetteWeight );             \/\/ Multiply by opacity         vignetteWeight *= vignetteOpacity;             \/\/ Obtain vignette mask (here is texture; you can also calculate your custom mask here)         float sampledVignetteMask = texVignette.Sample( samplerLinearClamp, texUV ).x;             \/\/ Final (inversed) vignette mask         float finalInvVignetteMask = saturate( vignetteWeight * sampledVignetteMask );             \/\/ final composite in gamma space         float3 Color = vignetteColorGammaSpace * finalInvVignetteMask + gammaColor.rgb;             \/\/ * uncomment to debug vignette mask:         \/\/ return 1.0 - finalInvVignetteMask;             \/\/ Return final color         return Color;    }<\/code><\/pre>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0439 <a href=\"http:\/\/astralcode.blogspot.com\/2018\/02\/hlslexplorer-is-out.html\">HLSLexplorer<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043c\u043e\u0433 \u043c\u043d\u0435 \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 HLSL.<\/p>\n<p>  \u041a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0439\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441 \u0434\u043e\u043b\u0435\u0439 \u0441\u043a\u0435\u043f\u0442\u0438\u0446\u0438\u0437\u043c\u0430 \u2014 \u0448\u0435\u0439\u0434\u0435\u0440\u044b TW3 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b D3DStripShader, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043e \u043d\u0438\u0445 \u043d\u0435 \u0437\u043d\u0430\u044e, \u043c\u043d\u0435 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u0430\u0434\u0430\u0442\u044c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044f \u043d\u0435 \u043d\u0435\u0441\u0443 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0437\u0430 \u0443\u0440\u043e\u043d, \u043d\u0430\u043d\u0435\u0441\u0451\u043d\u043d\u044b\u0439 \u0432\u0430\u0448\u0435\u043c\u0443 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044e \u044d\u0442\u0438\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u043c \ud83d\ude09<\/p>\n<p>  <b>\u0411\u043e\u043d\u0443\u0441: \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430<\/b><\/p>\n<p>  \u0412 \u0432\u044b\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u043c \u0432 2015 \u0433\u043e\u0434\u0443 \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a\u0435 3\u00bb \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u043b\u0441\u044f \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u043e\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0435, \u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b. \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>  35: add r2.xy, v1.zwzz, l(-0.500000, -0.500000, 0.000000, 0.000000)     36: dp2 r1.w, r2.xyxx, r2.xyxx     37: sqrt r1.w, r1.w     38: mad r1.w, r1.w, l(2.000000), l(-0.550000)     39: mul_sat r2.w, r1.w, l(1.219512)     40: mul r2.z, r2.w, r2.w     41: mul r2.xy, r2.zwzz, r2.zzzz     42: dp4 r1.w, l(-0.100000, -0.105000, 1.120000, 0.090000), r2.xyzw     43: min r1.w, r1.w, l(0.940000)<\/code><\/pre>\n<p>  \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e \u0434\u043b\u044f \u043d\u0430\u0441, \u043e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442. \u041d\u0430 HLSL \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code> float TheWitcher3_2015_Mask( in float2 uv )    {         float distanceFromCenter = length( uv - float2(0.5, 0.5) );             float x = distanceFromCenter * 2.0 - 0.55;         x = saturate( x * 1.219512 );          \/\/ 1.219512 = 100\/82             float x2 = x * x;         float x3 = x2 * x;         float x4 = x2 * x2;             float outX = dot( float4(x4, x3, x2, x), float4(-0.10, -0.105, 1.12, 0.09) );         outX = min( outX, 0.94 );             return outX;    }<\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0434\u043e \u0442\u0435\u043a\u0441\u0442\u0435\u043b\u0430, \u0442\u0432\u043e\u0440\u0438\u043c \u0441 \u043d\u0438\u043c \u043d\u0435\u043a\u0443\u044e \u043c\u0430\u0433\u0438\u044e (\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, saturate&#8230;), \u0430 \u0437\u0430\u0442\u0435\u043c\u2026 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d! \u041f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0435.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/25d\/79c\/e67\/25d79ce679f05a53946b475c6c152cc4.png\"><\/div>\n<h2>\u0427\u0430\u0441\u0442\u044c 5: \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u043f\u044c\u044f\u043d\u0435\u043d\u0438\u044f<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0432 \u0438\u0433\u0440\u0435 \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a 3: \u0414\u0438\u043a\u0430\u044f \u043e\u0445\u043e\u0442\u0430\u00bb \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u043f\u044c\u044f\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u0432 \u043d\u0435\u0451 \u0435\u0449\u0451 \u043d\u0435 \u0438\u0433\u0440\u0430\u043b\u0438, <strike>\u0442\u043e \u0431\u0440\u043e\u0441\u0430\u0439\u0442\u0435 \u0432\u0441\u0451, \u043f\u043e\u043a\u0443\u043f\u0430\u0439\u0442\u0435 \u0438 \u0438\u0433\u0440\u0430\u0439\u0442\u0435<\/strike> \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432\u0438\u0434\u0435\u043e:<\/p>\n<p>  \u0412\u0435\u0447\u0435\u0440:<\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 0; position: relative; padding-bottom: 56.2493%;\"><iframe src=\"https:\/\/www.youtube.com\/embed\/Gy_B2V0QaqA?rel=0&amp;showinfo=1&amp;hl=en-US\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen scrolling=\"no\"><\/iframe><\/div>\n<\/div>\n<\/div>\n<p>  \u041d\u043e\u0447\u044c:<\/p>\n<div class=\"oembed\">\n<div>\n<div style=\"left: 0; width: 100%; height: 0; position: relative; padding-bottom: 56.2493%;\"><iframe src=\"https:\/\/www.youtube.com\/embed\/CXu3e7LWkjE?rel=0&amp;showinfo=1&amp;hl=en-US\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen scrolling=\"no\"><\/iframe><\/div>\n<\/div>\n<\/div>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0434\u0432\u043e\u044f\u0449\u0435\u0435\u0441\u044f \u0438 \u043a\u0440\u0443\u0436\u0430\u0449\u0435\u0435\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0435\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u044c\u0435\u0448\u044c \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438. \u0427\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0442\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f. \u042f \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0432\u0442\u043e\u0440\u043e\u0435 \u0432\u0438\u0434\u0435\u043e \u0441 \u043d\u043e\u0447\u044c\u044e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0447\u0451\u0442\u043a\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u043e \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 \u0437\u0432\u0451\u0437\u0434\u0430\u0445 (\u0432\u0438\u0434\u0438\u0442\u0435 8 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a?)<\/p>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043e\u043f\u044c\u044f\u043d\u0435\u043d\u0438\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u043d\u0430\u044f, \u2014 \u044d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0443\u043c\u0430. \u041e\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0440\u044f\u0434\u043e\u043c \u0441 \u0446\u0435\u043d\u0442\u0440\u043e\u043c.<\/p>\n<p>  \u041d\u0430\u0432\u0435\u0440\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0439 \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 (\u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u043c). \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u043f\u044c\u044f\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 <i>\u043f\u043e\u0441\u043b\u0435<\/i> \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 \u0438 \u043f\u0440\u044f\u043c\u043e \u043f\u0435\u0440\u0435\u0434 motion blur (\u00ab\u043f\u044c\u044f\u043d\u043e\u0435\u00bb \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f motion blur).<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0451\u043c \u0438\u0433\u0440\u044b \u0441 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code> ps_5_0       dcl_globalFlags refactoringAllowed       dcl_constantbuffer cb0[2], immediateIndexed       dcl_constantbuffer cb3[3], immediateIndexed       dcl_sampler s0, mode_default       dcl_resource_texture2d (float,float,float,float) t0       dcl_input_ps_siv v1.xy, position       dcl_output o0.xyzw       dcl_temps 8      0: mad r0.x, cb3[0].y, l(-0.100000), l(1.000000)      1: mul r0.yz, cb3[1].xxyx, l(0.000000, 0.050000, 0.050000, 0.000000)      2: mad r1.xy, v1.xyxx, cb0[1].zwzz, -cb3[2].xyxx      3: dp2 r0.w, r1.xyxx, r1.xyxx      4: sqrt r1.z, r0.w      5: mul r0.w, r0.w, l(10.000000)      6: min r0.w, r0.w, l(1.000000)      7: mul r0.w, r0.w, cb3[0].y      8: mul r2.xyzw, r0.yzyz, r1.zzzz      9: mad r2.xyzw, r1.xyxy, r0.xxxx, -r2.xyzw     10: mul r3.xy, r0.xxxx, r1.xyxx     11: mad r3.xyzw, r0.yzyz, r1.zzzz, r3.xyxy     12: add r3.xyzw, r3.xyzw, cb3[2].xyxy     13: add r2.xyzw, r2.xyzw, cb3[2].xyxy     14: mul r0.x, r0.w, cb3[0].x     15: mul r0.x, r0.x, l(5.000000)     16: mul r4.xyzw, r0.xxxx, cb3[0].zwzw     17: mad r5.xyzw, r4.zwzw, l(1.000000, 0.000000, -1.000000, -0.000000), r2.xyzw     18: sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r5.xyxx, t0.xyzw, s0     19: sample_indexable(texture2d)(float,float,float,float) r5.xyzw, r5.zwzz, t0.xyzw, s0     20: add r5.xyzw, r5.xyzw, r6.xyzw     21: mad r6.xyzw, r4.zwzw, l(0.707000, 0.707000, -0.707000, -0.707000), r2.xyzw     22: sample_indexable(texture2d)(float,float,float,float) r7.xyzw, r6.xyxx, t0.xyzw, s0     23: sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r6.zwzz, t0.xyzw, s0     24: add r5.xyzw, r5.xyzw, r7.xyzw     25: add r5.xyzw, r6.xyzw, r5.xyzw     26: mad r6.xyzw, r4.zwzw, l(0.000000, 1.000000, -0.000000, -1.000000), r2.xyzw     27: mad r2.xyzw, r4.xyzw, l(-0.707000, 0.707000, 0.707000, -0.707000), r2.xyzw     28: sample_indexable(texture2d)(float,float,float,float) r7.xyzw, r6.xyxx, t0.xyzw, s0     29: sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r6.zwzz, t0.xyzw, s0     30: add r5.xyzw, r5.xyzw, r7.xyzw     31: add r5.xyzw, r6.xyzw, r5.xyzw     32: sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r2.xyxx, t0.xyzw, s0     33: sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r2.zwzz, t0.xyzw, s0     34: add r5.xyzw, r5.xyzw, r6.xyzw     35: add r2.xyzw, r2.xyzw, r5.xyzw     36: mul r2.xyzw, r2.xyzw, l(0.062500, 0.062500, 0.062500, 0.062500)     37: mad r5.xyzw, r4.zwzw, l(1.000000, 0.000000, -1.000000, -0.000000), r3.zwzw     38: sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r5.xyxx, t0.xyzw, s0     39: sample_indexable(texture2d)(float,float,float,float) r5.xyzw, r5.zwzz, t0.xyzw, s0     40: add r5.xyzw, r5.xyzw, r6.xyzw     41: mad r6.xyzw, r4.zwzw, l(0.707000, 0.707000, -0.707000, -0.707000), r3.zwzw     42: sample_indexable(texture2d)(float,float,float,float) r7.xyzw, r6.xyxx, t0.xyzw, s0     43: sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r6.zwzz, t0.xyzw, s0     44: add r5.xyzw, r5.xyzw, r7.xyzw     45: add r5.xyzw, r6.xyzw, r5.xyzw     46: mad r6.xyzw, r4.zwzw, l(0.000000, 1.000000, -0.000000, -1.000000), r3.zwzw     47: mad r3.xyzw, r4.xyzw, l(-0.707000, 0.707000, 0.707000, -0.707000), r3.xyzw     48: sample_indexable(texture2d)(float,float,float,float) r4.xyzw, r6.xyxx, t0.xyzw, s0     49: sample_indexable(texture2d)(float,float,float,float) r6.xyzw, r6.zwzz, t0.xyzw, s0     50: add r4.xyzw, r4.xyzw, r5.xyzw     51: add r4.xyzw, r6.xyzw, r4.xyzw     52: sample_indexable(texture2d)(float,float,float,float) r5.xyzw, r3.xyxx, t0.xyzw, s0     53: sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r3.zwzz, t0.xyzw, s0     54: add r4.xyzw, r4.xyzw, r5.xyzw     55: add r3.xyzw, r3.xyzw, r4.xyzw     56: mad r2.xyzw, r3.xyzw, l(0.062500, 0.062500, 0.062500, 0.062500), r2.xyzw     57: mul r0.x, cb3[0].y, l(8.000000)     58: mul r0.xy, r0.xxxx, cb3[0].zwzz     59: mad r0.z, cb3[1].y, l(0.020000), l(1.000000)     60: mul r1.zw, r0.zzzz, r1.xxxy     61: mad r1.xy, r1.xyxx, r0.zzzz, cb3[2].xyxx     62: mad r3.xy, r1.zwzz, r0.xyxx, r1.xyxx     63: mul r0.xy, r0.xyxx, r1.zwzz     64: mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), r1.xyxx     65: sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r1.xyxx, t0.xyzw, s0     66: sample_indexable(texture2d)(float,float,float,float) r4.xyzw, r0.xyxx, t0.xyzw, s0     67: sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r3.xyxx, t0.xyzw, s0     68: add r1.xyzw, r1.xyzw, r3.xyzw     69: add r1.xyzw, r4.xyzw, r1.xyzw     70: mad r2.xyzw, -r1.xyzw, l(0.333333, 0.333333, 0.333333, 0.333333), r2.xyzw     71: mul r1.xyzw, r1.xyzw, l(0.333333, 0.333333, 0.333333, 0.333333)     72: mul r0.xyzw, r0.wwww, r2.xyzw     73: mad o0.xyzw, cb3[0].yyyy, r0.xyzw, r1.xyzw     74: ret<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0434\u0432\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d7e\/ce2\/eb8\/d7ece2eb8b0acf421cffd93222dd6821.png\"><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/832\/ef8\/941\/832ef8941e9b4b6a38ad24b0c2e84cfa.png\"><\/div>\n<p>  \u041d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445:<\/p>\n<p>  cb0_v0.x -&gt; \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f (\u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445)<br \/>  cb0_v1.xyzw \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0432\u044c\u044e\u043f\u043e\u0440\u0442\u0430 \u0438 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430, \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0432\u044c\u044e\u043f\u043e\u0440\u0442\u0430 (\u043e\u043d\u0430 \u0436\u0435 \u00ab\u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u00bb)<br \/>  cb3_v0.x \u2014 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432\u043e\u043a\u0440\u0443\u0433 \u043f\u0438\u043a\u0441\u0435\u043b\u044f, \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1.0.<br \/>  cb3_v0.y \u2014 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043e\u043f\u044c\u044f\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432 \u043f\u043e\u043b\u043d\u0443\u044e \u0441\u0438\u043b\u0443, \u0430 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0441 0.0 \u0434\u043e 1.0. <br \/>  cv3_v1.xy \u2014 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435). \u042d\u0442\u043e \u043f\u0430\u0440\u0430 sin\/cos, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0448\u0435\u0439\u0434\u0435\u0440\u0435 sincos(time).<br \/>  cb3_v2.xy \u2014 \u0446\u0435\u043d\u0442\u0440 \u044d\u0444\u0444\u0435\u043a\u0442\u0430, \u043e\u0431\u044b\u0447\u043d\u043e float2( 0.5, 0.5 ).<br \/>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0441\u043b\u0435\u043f\u0443\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0448\u0435\u0439\u0434\u0435\u0440.<\/p>\n<p>  \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a:<\/p>\n<pre><code> ps_5_0      0: mad r0.x, cb3[0].y, l(-0.100000), l(1.000000)      1: mul r0.yz, cb3[1].xxyx, l(0.000000, 0.050000, 0.050000, 0.000000)      2: mad r1.xy, v1.xyxx, cb0[1].zwzz, -cb3[2].xyxx      3: dp2 r0.w, r1.xyxx, r1.xyxx      4: sqrt r1.z, r0.w<\/code><\/pre>\n<p>  \u0421\u0442\u0440\u043e\u043a\u0443 0 \u044f \u043d\u0430\u0437\u044b\u0432\u0430\u044e \u00ab\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c \u0437\u0443\u043c\u0430\u00bb, \u0438 \u0441\u043a\u043e\u0440\u043e \u0432\u044b \u043f\u043e\u0439\u043c\u0451\u0442\u0435, \u043f\u043e\u0447\u0435\u043c\u0443. \u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0451 (\u0441\u0442\u0440\u043e\u043a\u0430 1), \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u00ab\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430\u00bb. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0445\u043e\u0434\u043d\u0430\u044f \u043f\u0430\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 sin\/cos, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u043d\u0430 0.05.<\/p>\n<p>  \u0421\u0442\u0440\u043e\u043a\u0438 2-4: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440 \u0438\u0437 \u0446\u0435\u043d\u0442\u0440\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u0434\u043e UV-\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f (3) \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (4) (\u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0434\u043e \u0442\u0435\u043a\u0441\u0435\u043b\u0430)<\/p>\n<h4>\u0422\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441 \u0437\u0443\u043c\u043e\u043c<\/h4>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>   8: mul r2.xyzw, r0.yzyz, r1.zzzz      9: mad r2.xyzw, r1.xyxy, r0.xxxx, -r2.xyzw     10: mul r3.xy, r0.xxxx, r1.xyxx     11: mad r3.xyzw, r0.yzyz, r1.zzzz, r3.xyxy     12: add r3.xyzw, r3.xyzw, cb3[2].xyxy     13: add r2.xyzw, r2.xyzw, cb3[2].xyxy<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u043f\u0430\u0440\u0443 float.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, r0.yz \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u00ab\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430\u00bb, r1.z \u2014 \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0434\u043e \u0442\u0435\u043a\u0441\u0435\u043b\u0430, r1.xy \u2014 \u044d\u0442\u043e \u0432\u0435\u043a\u0442\u043e\u0440 \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u0434\u043e \u0442\u0435\u043a\u0441\u0435\u043b\u0430, r0.x \u2014 \u044d\u0442\u043e \u00ab\u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0437\u0443\u043c\u0430\u00bb.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u044d\u0442\u043e, \u043f\u0440\u0438\u043c\u0435\u043c \u043f\u043e\u043a\u0430, \u0447\u0442\u043e zoomFactor = 1.0, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code>   8: mul r2.xyzw, r0.yzyz, r1.zzzz      9: mad r2.xyzw, r1.xyxy, r0.xxxx, -r2.xyzw     13: add r2.xyzw, r2.xyzw, cb3[2].xyxy   r2.xy = (texel - center) * zoomFactor - rotationOffsets * distanceFromCenter + center;<\/code><\/pre>\n<p>  \u041d\u043e zoomFactor = 1.0:<\/p>\n<pre><code>  r2.xy = texel - center - rotationOffsets * distanceFromCenter + center;   r2.xy = texel - rotationOffsets * distanceFromCenter;<\/code><\/pre>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f r3.xy:<\/p>\n<pre><code>  10: mul r3.xy, r0.xxxx, r1.xyxx     11: mad r3.xyzw, r0.yzyz, r1.zzzz, r3.xyxy     12: add r3.xyzw, r3.xyzw, cb3[2].xyxy    r3.xy = rotationOffsets * distanceFromCenter + zoomFactor * (texel - center) + center<\/code><\/pre>\n<p>  \u041d\u043e zoomFactor = 1.0:<\/p>\n<p>  <code>r3.xy = rotationOffsets * distanceFromCenter + texel - <strike>center<\/strike> + <strike>center<\/strike> r3.xy = texel + rotationOffsets * distanceFromCenter<\/code><\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443 \u043d\u0430\u0441 \u043f\u043e \u0441\u0443\u0442\u0438 \u0435\u0441\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0430\u044f TextureUV (texel) \u00b1 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430, \u043d\u043e \u0447\u0442\u043e \u043d\u0430\u0441\u0447\u0451\u0442 zoomFactor? \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 0. \u041f\u043e \u0441\u0443\u0442\u0438, zoomFactor = 1.0 \u2014 0.1 * drunkAmount. \u0414\u043b\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e drunkAmount \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 zoomFactor \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e 0.9, \u0430 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441 \u0437\u0443\u043c\u043e\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u0430\u043a:<\/p>\n<pre><code>  baseTexcoordsA = 0.9 * texel + 0.1 * center + rotationOffsets * distanceFromCenter   baseTexcoordsB = 0.9 * texel + 0.1 * center - rotationOffsets * distanceFromCenter<\/code><\/pre>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435: \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u043d\u0430 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043c\u0435\u0436\u0434\u0443 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u043c\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c\u0438 \u0438 \u0446\u0435\u043d\u0442\u0440\u043e\u043c. \u042d\u0442\u043e \u00ab\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0435 \u0437\u0443\u043c\u043e\u043c\u00bb \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u044d\u0442\u043e, \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0412\u043e\u0442 <a href=\"https:\/\/www.shadertoy.com\/view\/4tyyWz\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 Shadertoy, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438.<\/p>\n<h4>\u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442<\/h4>\n<p>  \u0412\u0435\u0441\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043d\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u043c \u043a\u043e\u0434\u0435:<\/p>\n<pre><code>   2: mad r1.xy, v1.xyxx, cb0[1].zwzz, -cb3[2].xyxx    3: dp2 r0.w, r1.xyxx, r1.xyxx      5: mul r0.w, r0.w, l(10.000000)      6: min r0.w, r0.w, l(1.000000)      7: mul r0.w, r0.w, cb3[0].y     14: mul r0.x, r0.w, cb3[0].x     15: mul r0.x, r0.x, l(5.000000)           \/\/ texcoords offset intensity   16: mul r4.xyzw, r0.xxxx, cb3[0].zwzw     \/\/ texcoords offset<\/code><\/pre>\n<p>  \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043d\u0435\u043a\u0438\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442, \u043d\u0430\u0437\u043e\u0432\u0451\u043c \u0435\u0433\u043e \u00ab\u043c\u0430\u0441\u043a\u043e\u0439 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u00bb. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043e\u043d \u0434\u0430\u0451\u0442 \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u0435 \u0432 r0.w (\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u043f\u043e\u0437\u0436\u0435) \u0438 \u0432\u0442\u043e\u0440\u043e\u0435, \u0432 5 \u0440\u0430\u0437 \u0441\u0438\u043b\u044c\u043d\u0435\u0435, \u0432 r0.x (\u0441\u0442\u0440\u043e\u043a\u0430 15). \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u043b\u0443\u0436\u0438\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0442\u0435\u043a\u0441\u0435\u043b\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0441\u0438\u043b\u0443 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>  <b>\u0421\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c<\/b><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0438\u044f \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f 2 \u0441\u0435\u0440\u0438\u0438 \u043d\u0430 8 \u0432\u044b\u0431\u043e\u0440\u043e\u043a, \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u00ab\u0441\u0442\u043e\u0440\u043e\u043d\u0443\u00bb. \u041d\u0430 HLSL \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>   static const float2 pointsAroundPixel[8] =     {         float2(1.0, 0.0),         float2(-1.0, 0.0),         float2(0.707,  0.707),         float2(-0.707, -0.707),         float2(0.0,  1.0),         float2(0.0, -1.0),         float2(-0.707, 0.707),         float2(0.707, -0.707)     };      float4 colorA = 0;     float4 colorB = 0;      int i=0;     [unroll] for (i = 0; i &lt; 8; i++)     {         colorA += TexColorBuffer.Sample( samplerLinearClamp, baseTexcoordsA + texcoordsOffset * pointsAroundPixel[i] );     }     colorA \/= 16.0;      [unroll] for (i = 0; i &lt; 8; i++)     {         colorB += TexColorBuffer.Sample( samplerLinearClamp, baseTexcoordsB + texcoordsOffset * pointsAroundPixel[i] );     }     colorB \/= 16.0;      float4 rotationPart = colorA + colorB;<\/code><\/pre>\n<p>  \u0425\u0438\u0442\u0440\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a baseTexcoordsA\/B \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u043b\u0435\u0436\u0430\u0449\u0435\u0435 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u0443\u044e \u0440\u0430\u043d\u0435\u0435 \u00ab\u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u00bb. \u0427\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u044c, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0434\u0438\u0443\u0441 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u2014 \u043c\u044b \u0441\u044d\u043c\u043f\u043b\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e 8 \u0440\u0430\u0437, \u0447\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u043d\u0430 \u0437\u0432\u0451\u0437\u0434\u0430\u0445. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f pointsAroundPixel (\u043a\u0440\u0430\u0442\u043d\u044b\u0435 45 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u043c):<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/0cb\/5d0\/5b4\/0cb5d05b44fd9d2969af0416684d4b77.jpg\"><\/div>\n<p>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%95%D0%B4%D0%B8%D0%BD%D0%B8%D1%87%D0%BD%D0%B0%D1%8F_%D0%BE%D0%BA%D1%80%D1%83%D0%B6%D0%BD%D0%BE%D1%81%D1%82%D1%8C\">\u0415\u0434\u0438\u043d\u0438\u0447\u043d\u0430\u044f \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u044c<\/a><\/p>\n<p>  <b>\u0421\u044d\u043c\u043f\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u0437\u0443\u043c\u043e\u043c<\/b><\/p>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043e\u043f\u044c\u044f\u043d\u0435\u043d\u0438\u044f \u0432 The Witcher 3 \u2014 \u044d\u0442\u043e \u0437\u0443\u043c \u0441 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u043e\u0442\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>  56: mad r2.xyzw, r3.xyzw, l(0.062500, 0.062500, 0.062500, 0.062500), r2.xyzw  \/\/ the rotation part is stored in r2 register    57: mul r0.x, cb3[0].y, l(8.000000)   58: mul r0.xy, r0.xxxx, cb3[0].zwzz   59: mad r0.z, cb3[1].y, l(0.020000), l(1.000000)   60: mul r1.zw, r0.zzzz, r1.xxxy   61: mad r1.xy, r1.xyxx, r0.zzzz, cb3[2].xyxx   62: mad r3.xy, r1.zwzz, r0.xyxx, r1.xyxx   63: mul r0.xy, r0.xyxx, r1.zwzz   64: mad r0.xy, r0.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), r1.xyxx   65: sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r1.xyxx, t0.xyzw, s0   66: sample_indexable(texture2d)(float,float,float,float) r4.xyzw, r0.xyxx, t0.xyzw, s0   67: sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r3.xyxx, t0.xyzw, s0   68: add r1.xyzw, r1.xyzw, r3.xyzw   69: add r1.xyzw, r4.xyzw, r1.xyzw<\/code><\/pre>\n<p>  \u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0442\u0435\u043a\u0441\u0442\u0443\u0440. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c, \u043a\u0430\u043a \u0438\u0437 \u043d\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<pre><code>  float  zoomInOutScalePixels = drunkEffectAmount * 8.0; \/\/ line 57   float2 zoomInOutScaleNormalizedScreenCoordinates = zoomInOutScalePixels * texelSize.xy; \/\/ line 58   float  zoomInOutAmplitude = 1.0 + 0.02*cos(time); \/\/ line 59   float2 zoomInOutfromCenterToTexel = zoomInOutAmplitude * fromCenterToTexel; \/\/ line 60<\/code><\/pre>\n<p>  \u041f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0435\u043b\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 8.0 * \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0435\u043a\u0441\u0435\u043b\u0430), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u0431\u0430\u0437\u043e\u0432\u044b\u043c uv-\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c. \u0410\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u043e\u0442 0.98 \u0438 1.02, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0434\u0430\u0442\u044c \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435 \u0437\u0443\u043c\u0430, \u043a\u0430\u043a \u0438 zoomFactor \u0432 \u0447\u0430\u0441\u0442\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0430\u0440\u044b \u2014 r1.xy (\u0441\u0442\u0440\u043e\u043a\u0430 61)<\/p>\n<pre><code>  r1.xy = fromCenterToTexel * amplitude + center   r1.xy = (TextureUV - Center) * amplitude + Center \/\/ you can insert here zoomInOutfromCenterToTexel   r1.xy = TextureUV * amplitude - Center * amplitude + Center   r1.xy = TextureUV * amplitude + Center * 1.0 - Center * amplitude   r1.xy = TextureUV * amplitude + Center * (1.0 - amplitude)      r1.xy = lerp( TextureUV, Center, amplitude);<\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c:<\/p>\n<pre><code>float2 zoomInOutBaseTextureUV = lerp(TextureUV, Center, amplitude);<\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c:<\/p>\n<pre><code>  float2 zoomInOutBaseTextureUV = lerp(TextureUV, Center, amplitude);<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u043f\u0430\u0440\u0443 \u2014 r3.xy (\u0441\u0442\u0440\u043e\u043a\u0430 62)<\/p>\n<pre><code>  r3.xy = (amplitude * fromCenterToTexel) * zoomInOutScaleNormalizedScreenCoordinates         + zoomInOutBaseTextureUV<\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c:<\/p>\n<pre><code>  float2 zoomInOutAddTextureUV0 = zoomInOutBaseTextureUV                       + zoomInOutfromCenterToTexel*zoomInOutScaleNormalizedScreenCoordinates;<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0442\u0440\u0435\u0442\u044c\u044e \u043f\u0430\u0440\u0443 \u2014 r0.xy (\u0441\u0442\u0440\u043e\u043a\u0438 63-64)<\/p>\n<pre><code>  r0.xy = zoomInOutScaleNormalizedScreenCoordinates * (amplitude * fromCenterToTexel) * 2.0 + zoomInOutBaseTextureUV<\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c:<\/p>\n<pre><code>  float2 zoomInOutAddTextureUV1 = zoomInOutBaseTextureUV   + 2.0*zoomInOutfromCenterToTexel*zoomInOutScaleNormalizedScreenCoordinates<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0442\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0442\u0435\u043a\u0441\u0442\u0443\u0440 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 r1. \u0421\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u044d\u043c\u043f\u043b\u0435\u0440 \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <b>\u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435<\/b><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 r2 \u0438 \u0442\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0437\u0443\u043c\u0430 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 r1. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code>  70: mad r2.xyzw, -r1.xyzw, l(0.333333, 0.333333, 0.333333, 0.333333), r2.xyzw     71: mul r1.xyzw, r1.xyzw, l(0.333333, 0.333333, 0.333333, 0.333333)     72: mul r0.xyzw, r0.wwww, r2.xyzw     73: mad o0.xyzw, cb3[0].yyyy, r0.xyzw, r1.xyzw     74: ret<\/code><\/pre>\n<p>  \u041e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445: r0.w \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 7, \u044d\u0442\u043e \u043d\u0430\u0448\u0430 \u043c\u0430\u0441\u043a\u0430 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u0438, \u0430 cb3[0].y \u2014 \u044d\u0442\u043e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u043e\u043f\u044c\u044f\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041c\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u0432 \u00ab\u0431\u0440\u0443\u0442\u0444\u043e\u0440\u0441\u0435\u00bb:<\/p>\n<pre><code>  float4 finalColor = intensityMask * (rotationPart - zoomingPart);   finalColor = drunkIntensity * finalColor + zoomingPart;      return finalColor;<\/code><\/pre>\n<p>  \u041d\u043e <i>\u043a\u0430\u043a\u043e\u0433\u043e \u0447\u0451\u0440\u0442\u0430, \u043d\u0438\u043a\u0442\u043e \u0442\u0430\u043a \u043d\u0435 \u043f\u0438\u0448\u0435\u0442 \u0448\u0435\u0439\u0434\u0435\u0440\u044b<\/i>. \u042f \u0432\u0437\u044f\u043b \u043a\u0430\u0440\u0430\u043d\u0434\u0430\u0448 \u0441 \u0431\u0443\u043c\u0430\u0433\u043e\u0439 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a\u0443\u044e \u0444\u043e\u0440\u043c\u0443\u043b\u0443:<\/p>\n<pre><code>  finalColor = effectAmount * [intensityMask * (rotationPart - zoomPart)] + zoomPart   finalColor = effectAmount * intensityMask * rotationPart - effectAmount * intensityMask * zoomPart + zooomPart<\/code><\/pre>\n<p>  \u0413\u0434\u0435 t = effectAmount * intensityMask<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f:<\/p>\n<pre><code>  finalColor = t * rotationPart - t * zoomPart + zoomPart   finalColor = t * rotationPart + zoomPart - t * zoomPart   finalColor = t * rotationPart + (1.0 - t) * zoomPart   finalColor = lerp( zoomingPart, rotationPart, t )<\/code><\/pre>\n<p>  \u0418 \u043c\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443:<\/p>\n<pre><code>  finalColor = lerp(zoomingPart, rotationPart, intensityMask * drunkIntensity);<\/code><\/pre>\n<p>  \u0414\u0430, \u044d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439, \u043d\u043e \u043c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438! \u041b\u0438\u0447\u043d\u043e \u044f \u043d\u0430\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u043e\u0435-\u0447\u0435\u043c\u0443 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0438 \u0432\u044b \u0442\u043e\u0436\u0435!<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u043e\u043b\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043d\u0430 HLSL \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u044b <a href=\"https:\/\/pastebin.com\/9um712sC\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u042f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u0438\u0445 \u0441\u0432\u043e\u0438\u043c <a href=\"http:\/\/astralcode.blogspot.com\/2018\/02\/hlslexplorer-is-out.html\">HLSLexplorer<\/a>, \u0438 \u0445\u043e\u0442\u044f \u043d\u0435\u0442 \u043f\u0440\u044f\u043c\u044b\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439 \u043e\u0434\u0438\u043d \u0432 \u043e\u0434\u0438\u043d \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u043c, \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0442\u0430\u043a \u043c\u0430\u043b\u044b (\u043d\u0430 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043c\u0435\u043d\u044c\u0448\u0435), \u0447\u0442\u043e \u044f \u043c\u043e\u0433\u0443 \u0441 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435!<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/422573\/\"> https:\/\/habr.com\/post\/422573\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/422573\/\" class=\"post__text post__text-html js-mediator-article\">\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u043e\u043c \u00ab\u0412\u0435\u0434\u044c\u043c\u0430\u043a\u0430 3\u00bb. \u0412 \u044d\u0442\u043e\u0439 \u0438\u0433\u0440\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u0438\u0451\u043c\u044b \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d\u0430 \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u0430 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u044e\u0436\u0435\u0442\u0430\/\u043c\u0443\u0437\u044b\u043a\u0438\/\u0433\u0435\u0439\u043c\u043f\u043b\u0435\u044f.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e5b\/54e\/95e\/e5b54e95e53d14c22be446c3de24f8c3.jpg\"><\/div>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 The Witcher 3. \u041e\u043d\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0441\u0435\u043e\u0431\u044a\u0435\u043c\u043b\u044e\u0449\u0435\u0439, \u043a\u0430\u043a \u0430\u043d\u0430\u043b\u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 <a href=\"https:\/\/habr.com\/company\/ua-hosting\/blog\/271931\/\">GTA V<\/a> \u0410\u0434\u0440\u0438\u0430\u043d\u0430 \u041a\u043e\u0440\u0440\u0435\u0436\u0435, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043f\u043e\u043a\u0430.<\/p>\n<p>  \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u0440\u0435\u0432\u0435\u0440\u0441-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043d\u0433\u0430 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438.  <\/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-289184","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289184","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=289184"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289184\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}