{"id":461918,"date":"2025-06-03T15:02:31","date_gmt":"2025-06-03T15:02:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=461918"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=461918","title":{"rendered":"<span>\u0421\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0436\u0438\u0437\u043d\u0438 \u0447\u0430\u0441\u0442\u0438\u0446 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0430 WebGPU<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39e\/b39\/093\/39eb39093bcca4284b9a4690f76fd1fe.png\" width=\"1280\" height=\"720\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/39e\/b39\/093\/39eb39093bcca4284b9a4690f76fd1fe.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39e\/b39\/093\/39eb39093bcca4284b9a4690f76fd1fe.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u042f <a href=\"https:\/\/lisyarus.github.io\/blog\/posts\/soft-body-physics.html\" rel=\"noopener noreferrer nofollow\">\u043b\u044e\u0431\u043b\u044e<\/a>\u00a0<a href=\"https:\/\/lisyarus.github.io\/blog\/posts\/structural-mechanics-2.html\" rel=\"noopener noreferrer nofollow\">\u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435<\/a>\u00a0<a href=\"https:\/\/lisyarus.github.io\/blog\/posts\/simulating-water-over-terrain.html\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438<\/a>, \u0430 \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 <a href=\"https:\/\/lisyarus.itch.io\/particle-simulator\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0447\u0430\u0441\u0442\u0438\u0446<\/a>. \u041e\u0431\u044b\u0447\u043d\u043e \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0447\u0442\u043e-\u0442\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0438, \u043d\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0437\u0430\u0431\u0430\u0432\u043d\u0443\u044e \u043d\u0435\u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0449\u0435\u0435 <em>\u0436\u0438\u0437\u043d\u044c<\/em>.<\/p>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430 C++ \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0434\u043b\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 WebGPU API. \u041e\u043d \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/683ec5adfec567ba65e5a77b\" data-style=\"\" id=\"683ec5adfec567ba65e5a77b\" width=\"\"><\/div>\n<p>\u0412 \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043e\u043d \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0432\u043d\u0443\u0442\u0440\u0438.<\/p>\n<h3>\u041c\u043e\u0434\u0435\u043b\u044c Particle Life<\/h3>\n<p>\u0412 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u044d\u0442\u043e \u0432\u0438\u0434\u0435\u043e), \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/www.youtube.com\/watch?v=4vk7YvBYpOs\" rel=\"noopener noreferrer nofollow\">1<\/a>,\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=p4YirERTVF0\" rel=\"noopener noreferrer nofollow\">2<\/a> \u0438 <a href=\"https:\/\/www.youtube.com\/watch?v=Z_zmZ23grXE\" rel=\"noopener noreferrer nofollow\">3<\/a>, \u0430 \u0432 <a href=\"https:\/\/www.youtube.com\/watch?v=scvuli-zcRc&amp;t=396s\" rel=\"noopener noreferrer nofollow\">\u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u043c<\/a> \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438. \u0418\u0437-\u0437\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0435\u0442\u0435\u043d\u0446\u0438\u043e\u0437\u043d\u043e\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0438\u0437 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u043b\u043e\u0432, \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u00abparticle life\u00bb \u043d\u0435 \u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0438\u0434\u0435\u043e \u043d\u0430 YouTube), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0432\u043e\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0412\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=xiUpAeos168\" rel=\"noopener noreferrer nofollow\">\u043e\u0434\u043d\u043e\u043c \u0432\u0438\u0434\u0435\u043e<\/a>\u00a0\u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u0442\u0430\u043b\u0438 \u043c\u0438\u043a\u0440\u043e\u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0434\u043e\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0442\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0447\u043d\u044b\u043c\u0438 \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>\u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0441\u0432\u043e\u0451 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u043a\u043e\u043d\u0432\u0435\u0435\u0432\u0441\u043a\u043e\u0439 \u0438\u0433\u0440\u043e\u0439 \u00ab\u0416\u0438\u0437\u043d\u044c\u00bb. \u041e\u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 <a href=\"https:\/\/google-research.github.io\/self-organising-systems\/particle-lenia\" rel=\"noopener noreferrer nofollow\">Particle Lenia<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0438\u0434\u0435\u044f \u0442\u0430\u043a\u043e\u0432\u0430: \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0438\u043f\u0438\u0447\u043d\u0443\u044e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0441 \u0442\u043e\u0447\u0435\u0447\u043d\u044b\u043c\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438, \u043d\u043e \u0441\u0438\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c <em>\u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c\u0438<\/em>: \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u0410 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0411, \u043d\u043e \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u0411 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0410 (\u0438\u043b\u0438 \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0435\u0451 \u0441 \u0431\u043e\u043b\u044c\u0448\u0435\u0439\/\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0441\u0438\u043b\u043e\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435). \u042d\u0442\u043e \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u0442\u0440\u0435\u0442\u0438\u0439 \u0437\u0430\u043a\u043e\u043d \u041d\u044c\u044e\u0442\u043e\u043d\u0430, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u0437\u0430\u043a\u043e\u043d\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f (\u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u0438, \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0438 \u0432\u0440\u0430\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430).<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c \u0438 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0430\u0449\u0438\u043c \u0444\u0438\u0437\u0438\u043a\u0435, \u043d\u043e<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0439 \u043c\u044b \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0437\u0430\u043a\u043e\u043d\u0430\u043c\u0438,<\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u044d\u043d\u0435\u0440\u0433\u0438\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0436\u0438\u0432\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043c\u044b.<\/p>\n<\/li>\n<\/ol>\n<p>\u0416\u0438\u0432\u044b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u043f\u0438\u0449\u0443 \u0438 \u043a\u0438\u0441\u043b\u043e\u0440\u043e\u0434 (\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0430), \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044f \u0438\u0445 \u0432 \u044d\u043d\u0435\u0440\u0433\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0438\u0441\u043a \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0410\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0435 \u0441\u0438\u043b\u044b Particle Life \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u043e, \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044f \u0446\u0438\u043a\u043b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0435\u0449\u0435\u0441\u0442\u0432 \u0432 \u044d\u043d\u0435\u0440\u0433\u0438\u044e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043d\u043e\u0432\u0443\u044e \u044d\u043d\u0435\u0440\u0433\u0438\u044e.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u0411 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0410, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0443\u0431\u0435\u0433\u0430\u0435\u0442 \u043e\u0442 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0411, \u0447\u0442\u043e \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0445\u0438\u0449\u043d\u0438\u043a\u0430 \u0438 \u0436\u0435\u0440\u0442\u0432\u044b \u0438\u0437 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u043d\u0435 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u044e\u0442\u0441\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u0411 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u00ab\u0441\u044a\u0435\u0441\u0442\u00bb \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0410.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e <em>\u0442\u0438\u043f\u043e\u0432<\/em> \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u044b \u0442\u0438\u043f\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0446. \u041b\u0438\u0447\u043d\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u044c, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u0432 <a href=\"https:\/\/www.youtube.com\/watch?v=xiUpAeos168\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0434\u0435\u043e<\/a>:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u0434\u0432\u0443\u0445 \u043b\u044e\u0431\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0446 \u0410 \u0438 \u0411 \u0441\u0438\u043b\u0430, \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u0438\u0446\u0435\u0439 \u0410 \u043e\u0442 \u0411, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: <em>\u0441\u0438\u043b\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f <\/em>\u0438 <em>\u0441\u0438\u043b\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043b\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0449\u0435\u0439 \u0438\u043b\u0438 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0449\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043b\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0449\u0430\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0435 \u0441\u0438\u043b\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u041f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u0435, \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u2014 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435. (\u0414\u043b\u044f \u0441\u0438\u043b\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435).<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0434\u0438\u0443\u0441 \u0441\u0438\u043b\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0440\u0430\u0434\u0438\u0443\u0441 \u0441\u0438\u043b\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u0431\u043b\u0438\u0437\u043a\u043e\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u2014 \u043d\u0430 \u0434\u0430\u043b\u0451\u043a\u043e\u043c).<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441\u0438\u043b\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0441\u0438\u043b\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0435 \u0441\u0438\u043b\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u0441 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0434\u0438\u0443\u0441\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0432\u0438\u0434\u0435 \u0444\u043e\u0440\u043c\u0443\u043b \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0438\u043b\u044b \u043e\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0442\u0430\u043a:<\/p>\n<p><img decoding=\"async\" class=\"formula\" source=\"F(r) = A\\cdot \\max\\left(0, \\frac{|r-R|}{R}\\right)\" alt=\"F(r) = A\\cdot \\max\\left(0, \\frac{|r-R|}{R}\\right)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f6b\/c3c\/9a8\/f6bc3c9a8e2177ca498748df920bc0d1.svg\" width=\"243\" height=\"50\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f6b\/c3c\/9a8\/f6bc3c9a8e2177ca498748df920bc0d1.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f6b\/c3c\/9a8\/f6bc3c9a8e2177ca498748df920bc0d1.svg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p>\u0413\u0434\u0435 A \u2014 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441\u0438\u043b\u044b (\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u044f),\u00a0R\u00a0\u2014 \u0440\u0430\u0434\u0438\u0443\u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0438\u043b\u044b \u0430 r\u00a0\u2014 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438.<\/p>\n<p>\u0412\u043e\u0442 \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u0438\u043b\u044b \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0433\u0434\u0435 A=5 \u0438 R=10:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/973\/c7b\/edb\/973c7bedb697b3a252ed1ab87edc6bbe.png\" width=\"822\" height=\"308\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/973\/c7b\/edb\/973c7bedb697b3a252ed1ab87edc6bbe.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/973\/c7b\/edb\/973c7bedb697b3a252ed1ab87edc6bbe.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0410 \u0432\u043e\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u044f, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0444\u0438\u0437\u0438\u043a\u0430:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e11\/140\/4f1\/e111404f14a62a2d64f71906f4604cda.png\" width=\"822\" height=\"308\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/e11\/140\/4f1\/e111404f14a62a2d64f71906f4604cda.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e11\/140\/4f1\/e111404f14a62a2d64f71906f4604cda.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0412 <a href=\"https:\/\/www.desmos.com\/calculator\/ram14bkp1r\" rel=\"noopener noreferrer nofollow\">Desmos<\/a>\u00a0\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u0438\u043b\u0443 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u043b\u0443 \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u044f, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u0438\u043b\u044b \u043e\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fd2\/963\/ed7\/fd2963ed71fd391f0db474c7dfa9bf53.png\" width=\"575\" height=\"235\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/fd2\/963\/ed7\/fd2963ed71fd391f0db474c7dfa9bf53.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fd2\/963\/ed7\/fd2963ed71fd391f0db474c7dfa9bf53.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0418 \u0442\u0430\u043a\u0443\u044e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u044d\u043d\u0435\u0440\u0433\u0438\u044e:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/02f\/963\/743\/02f963743d24d0651ecc4c1f1a626002.png\" width=\"575\" height=\"235\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/02f\/963\/743\/02f963743d24d0651ecc4c1f1a626002.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/02f\/963\/743\/02f963743d24d0651ecc4c1f1a626002.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041e\u043d\u0438 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 <a href=\"https:\/\/www.desmos.com\/calculator\/nebtb6ltme\" rel=\"noopener noreferrer nofollow\">Desmos<\/a>.<\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f + \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0433\u0434\u0435 \u0441\u0438\u043b\u0430 \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u0438\u0446, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u0438 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0438\u043b\u0430 (\u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0438 \u044d\u043d\u0435\u0440\u0433\u0438\u044f) \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u043d\u0443\u043b\u044e, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u043c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u043e\u043c <img decoding=\"async\" class=\"formula inline\" source=\"\\frac{1}{r}\" alt=\"\\frac{1}{r}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/94b\/919\/0fc\/94b9190fcbe09505995f08a01fbba04d.svg\" width=\"17\" height=\"42\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/94b\/919\/0fc\/94b9190fcbe09505995f08a01fbba04d.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/94b\/919\/0fc\/94b9190fcbe09505995f08a01fbba04d.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0433\u0440\u0430\u0432\u0438\u0442\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043c\u0430\u0433\u043d\u0435\u0442\u0438\u0437\u043c\u0430. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0441\u0438\u043b\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0438 \u0435\u0451 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u043b\u044b, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438\u043b\u0438 \u0440\u0430\u0434\u0438\u0443\u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0438\u0446 \u0441\u043b\u0438\u043b\u0438\u0441\u044c \u0432 \u043e\u0434\u043d\u0443:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1f9\/343\/86d\/1f934386d39e6b59ee7b86b88f810741.png\" width=\"1920\" height=\"1080\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/1f9\/343\/86d\/1f934386d39e6b59ee7b86b88f810741.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1f9\/343\/86d\/1f934386d39e6b59ee7b86b88f810741.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u044d\u0442\u043e \u043d\u0430\u0441 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442, \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0448\u0438\u043c \u0441\u0438\u043b\u0430\u043c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f (\u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u0430 \u0441 <img decoding=\"async\" class=\"formula inline\" source=\"\\frac{1}{r}\" alt=\"\\frac{1}{r}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/276\/42e\/0d3\/27642e0d393d9474f8fa0999e7adc4ce.svg\" width=\"17\" height=\"42\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/276\/42e\/0d3\/27642e0d393d9474f8fa0999e7adc4ce.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/276\/42e\/0d3\/27642e0d393d9474f8fa0999e7adc4ce.svg 781w\" loading=\"lazy\" decode=\"async\"\/>).<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0440\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438. \u041e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043e\u043d\u0430 \u0431\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0430 \u044d\u043d\u0435\u0440\u0433\u0438\u044e \u0438 \u0432\u0441\u0451 \u0431\u044b \u0443\u0441\u043a\u043e\u0440\u044f\u043b\u043e\u0441\u044c \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 WebGPU?<\/h3>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043f\u0435\u0440\u0435\u043d\u0451\u0441 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u043d\u0430 GPU. \u042d\u0442\u043e \u0442\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b GPU. \u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e WebGPU?<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0447\u0438\u0442\u0430\u043b\u0438 \u043c\u043e\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u0442\u043e \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044f \u043e\u0431\u043e\u0436\u0430\u044e WebGPU. \u042f \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u043b\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 OpenGL, \u0438 \u043c\u0435\u043d\u044f \u043e\u0442 \u043d\u0435\u0433\u043e \u0442\u043e\u0448\u043d\u0438\u0442. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0430\u0440\u044b\u0439, \u0443\u0436\u0430\u0441\u043d\u043e \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 API \u0441 \u043a\u0443\u0447\u0435\u0439 \u043b\u0435\u0433\u0430\u0441\u0438-\u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0441\u0435\u043c\u044c \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434. \u041e\u0434\u043d\u0430\u043a\u043e Vulkan, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0441\u0442\u0430\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c API, \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u044b\u0441\u044f\u0447\u0443 \u0441\u0442\u0440\u043e\u043a \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, <em>\u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/em>, \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u041d\u0435 \u043f\u043e\u0439\u043c\u0438\u0442\u0435 \u043c\u0435\u043d\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, Vulkan \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0440\u0443\u0442, \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0442 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u0432 \u0441\u0432\u043e\u0438\u0445 \u0445\u043e\u0431\u0431\u0438-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u042d\u0442\u0443 \u043d\u0438\u0448\u0443 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043b \u0434\u043b\u044f \u043c\u0435\u043d\u044f WebGPU. \u042d\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0438 \u0447\u0438\u0441\u0442\u044b\u0439 API, \u0438 \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439. \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u042f \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0435\u0433\u043e \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 (\u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/github.com\/gfx-rs\/wgpu-native\" rel=\"noopener noreferrer nofollow\">wgpu-native<\/a>), \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0434\u043b\u044f <a href=\"https:\/\/github.com\/lisyarus\/webgpu-raytracer\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043b\u0443\u0447\u0435\u0439 \u041c\u043e\u043d\u0442\u0435-\u041a\u0430\u0440\u043b\u043e<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/github.com\/lisyarus\/webgpu-shallow-water\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0432\u043e\u0434\u044b \u043d\u0430\u0434 \u0440\u0435\u043b\u044c\u0435\u0444\u043e\u043c<\/a>, \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e \u0435\u0433\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u2014 <a href=\"https:\/\/www.youtube.com\/playlist?list=PLSGI94QoFYJwGaieAkqw5_qfoupdppxHN\" rel=\"noopener noreferrer nofollow\">\u0433\u0440\u0430\u0434\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0432\u0435\u043a\u043e\u0432\u043e\u0439 \u0434\u0435\u0440\u0435\u0432\u043d\u0438<\/a>. \u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u044d\u0442\u043e\u0442 API.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0431\u0443\u0434\u0443\u0447\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c API, \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a compute-\u0448\u0435\u0439\u0434\u0435\u0440\u044b \u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043d\u0438\u0436\u0435, \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438. \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, WebGL \u0438\u0445 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0438 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0431\u043e\u043d\u0443\u0441 \u2014 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435! \u0418\u043b\u0438, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0444\u043b\u0430\u0433\u0430\u043c\u0438, \u043d\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u0426\u0438\u043a\u043b \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e WebGPU? \u0421\u0430\u043c \u0446\u0438\u043a\u043b \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c:<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043f\u0430\u0443\u0437\u0443,<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0441\u0438\u043b\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0430 \u043d\u0435\u0451 \u0434\u0440\u0443\u0433\u0438\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u043a \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043d\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u044b<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Semi-implicit_Euler_method\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u043c\u043f\u043b\u0435\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u042d\u0439\u043b\u0435\u0440\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438.<\/p>\n<p>\u042f \u0445\u0440\u0430\u043d\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 GPU. \u0427\u0430\u0441\u0442\u0438\u0446\u0430 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f struct \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"rust\">struct Particle {     \/\/ \u041f\u043e\u0437\u0438\u0446\u0438\u044f     x : f32,     y : f32,      \/\/ \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c     vx : f32,     vy : f32,      \/\/ \u0422\u0438\u043f     species : f32, }<\/code><\/pre>\n<p><em>\u042f \u043d\u0435 \u0445\u0440\u0430\u043d\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 <\/em><code><em>vec2f<\/em><\/code><em>\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f, \u0430 \u0442\u0438\u043f \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0445\u0440\u0430\u043d\u044e, \u043a\u0430\u043a <\/em><code><em>f32<\/em><\/code><em>, \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0438\u0437 JavaScript, \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 <\/em><code><em>Float32Array<\/em><\/code><em>.<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u2014 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043f\u044f\u0442\u044c float, \u0442\u043e \u0435\u0441\u0442\u044c 20 \u0431\u0430\u0439\u0442\u043e\u0432. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 compute-\u0448\u0435\u0439\u0434\u0435\u0440\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0438\u043b\u044b \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044e. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043b \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0443\u0437\u043a\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u043c: \u044d\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <img decoding=\"async\" class=\"formula inline\" source=\"O(N^2)\" alt=\"O(N^2)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53a\/d11\/b42\/53ad11b4261e416d32f8317d52e9ca64.svg\" width=\"56\" height=\"25\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53a\/d11\/b42\/53ad11b4261e416d32f8317d52e9ca64.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/53a\/d11\/b42\/53ad11b4261e416d32f8317d52e9ca64.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0440\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0438\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0432\u0441\u0435\u043c\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438. \u042d\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u0438\u0446, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 CPU \u043c\u043e\u0433\u043b\u0430 \u0432\u044b\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e 4096 \u0447\u0430\u0441\u0442\u0438\u0446, \u0434\u0430\u0436\u0435 \u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0445\u0438\u0442\u0440\u0435\u0435 \u043f\u043e\u0434\u043e\u0439\u0442\u0438 \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044e \u0441\u0438\u043b; \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0435\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 compute-\u043f\u0440\u043e\u0445\u043e\u0434. \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u0432\u0441\u0451 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e: \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 compute-\u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442 \u0435\u0451 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">@group(0) @binding(0) var&lt;storage, read_write&gt; particles : array&lt;Particle&gt;;  @group(1) @binding(0) var&lt;uniform&gt; simulationOptions : SimulationOptions;  @compute @workgroup_size(64) fn particleAdvance(@builtin(global_invocation_id) id : vec3u) {     \/\/ \u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0430 \u043a\u043e\u043d\u0446\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430     if (id.x &gt;= arrayLength(&amp;particles)) {         return;     }      let width = simulationOptions.right - simulationOptions.left;     let height = simulationOptions.top - simulationOptions.bottom;      var particle = particles[id.x];      \/\/ \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0435     particle.vx *= simulationOptions.friction;     particle.vy *= simulationOptions.friction;      \/\/ \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438     particle.x += particle.vx * simulationOptions.dt;     particle.y += particle.vy * simulationOptions.dt;      \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438\u0438 \u0441 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438     if (particle.x &lt; simulationOptions.left) {         particle.x = simulationOptions.left;         particle.vx *= -1.0;     }      if (particle.x &gt; simulationOptions.right) {         particle.x = simulationOptions.right;         particle.vx *= -1.0;     }      if (particle.y &lt; simulationOptions.bottom) {         particle.y = simulationOptions.bottom;         particle.vy *= -1.0;     }      if (particle.y &gt; simulationOptions.top) {         particle.y = simulationOptions.top;         particle.vy *= -1.0;     }      \/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b     particles[id.x] = particle; }<\/code><\/pre>\n<p><em>(\u041c\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043c\u044b\u0448\u044c \u0438 \u0437\u0430\u0446\u0438\u043a\u043b\u0435\u043d\u043d\u044b\u0435 \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u0435\u043c \u0436\u0435.)<\/em><\/p>\n<p><code>simulationOptions.friction<\/code>\u00a0\u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043a\u0430\u043a <img decoding=\"async\" class=\"formula inline\" source=\"\\exp(-\\text{friction}\\cdot\\Delta t)\" alt=\"\\exp(-\\text{friction}\\cdot\\Delta t)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ad\/c90\/bbe\/3adc90bbe9787e518a5207056837778f.svg\" width=\"157\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ad\/c90\/bbe\/3adc90bbe9787e518a5207056837778f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ad\/c90\/bbe\/3adc90bbe9787e518a5207056837778f.svg 781w\" loading=\"lazy\" decode=\"async\"\/>; \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u044d\u0442\u043e\u0433\u043e \u044f \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u043b \u0432 <a href=\"https:\/\/lisyarus.github.io\/blog\/posts\/exponential-smoothing.html\" rel=\"noopener noreferrer nofollow\">\u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<h3>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/h3>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0435\u0436\u0434\u0435, \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u0447\u0430\u0441\u0442\u0438\u0446, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0441\u0438\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0441\u0438\u043b\u044b \u0438\u043c\u0435\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u0441\u0435 \u0441\u0438\u043b\u044b \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e. \u0412 \u043c\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0441\u0438\u043b \u0440\u0430\u0432\u0435\u043d 32, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u043b\u044e\u0431\u0430\u044f \u043f\u0430\u0440\u0430 \u0447\u0430\u0441\u0442\u0438\u0446 \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 32 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c\/\u0431\u0438\u043d\u043d\u0438\u043d\u0433\u043e\u043c: \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u0438\u0437 \u044f\u0447\u0435\u0435\u043a\/\u0431\u0438\u043d\u043e\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 32\u00d732, \u0440\u0430\u0441\u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043f\u043e \u044d\u0442\u0438\u043c \u0431\u0438\u043d\u0430\u043c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u0431\u0438\u043d\u0430\u043c\u0438. \u0417\u0432\u0443\u0447\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e, \u0438 \u043d\u0430 CPU \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 C++ \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 2D-\u043c\u0430\u0441\u0441\u0438\u0432, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0439 <code>std::vector&lt;particle&gt;<\/code>). \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 GPU \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c GPU \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0437 \u0448\u0435\u0439\u0434\u0435\u0440\u0430!<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u043d\u043e\u0432 \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u0412\u043e\u0442, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0430\u0441\u0442\u0438\u0446, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u0438\u043d\u0435, \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043c\u0435\u0436\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0422\u0430\u043a\u0436\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0439 \u043d\u0430\u0447\u0430\u043b\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435) \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0438\u043d\u0430. \u0425\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 \u043a\u043e\u043d\u0435\u0446 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043d\u0435\u0446 \u0431\u0438\u043d\u0430 \u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u0430\u043c\u0438\u0445 \u0447\u0430\u0441\u0442\u0438\u0446 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 ID, \u043d\u043e \u044d\u0442\u043e \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043d\u0435\u043f\u0440\u044f\u043c\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0441\u0438\u043b\u044b.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u043c \u0442\u0440\u0451\u0445\u044d\u0442\u0430\u043f\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c:<\/p>\n<ul>\n<li>\n<p>\u042d\u0442\u0430\u043f 1: \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u0438\u0446 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0431\u0438\u043d\u0435<\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u0430\u043f 2: \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0438\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u0430\u043f 3: \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0431\u0438\u043d<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u044d\u0442\u0430\u043f\u0430\u0445 1 \u0438 3 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432. \u042d\u0442\u0430\u043f 1 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442 \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c compute-\u0448\u0435\u0439\u0434\u0435\u0440 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u0431\u0438\u043d\u0430 (\u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439) \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u043d\u0430:<\/p>\n<pre><code class=\"rust\">@group(0) @binding(0) var&lt;storage, read&gt; particles : array&lt;Particle&gt;;  @group(1) @binding(0) var&lt;uniform&gt; simulationOptions : SimulationOptions;  @group(2) @binding(0) var&lt;storage, read_write&gt; binSize : array&lt;atomic&lt;u32&gt;&gt;;  @compute @workgroup_size(64) fn fillBinSize(@builtin(global_invocation_id) id : vec3u) {     if (id.x &gt;= arrayLength(&amp;particles)) {         return;     }      \/\/ \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b     let particle = particles[id.x];      \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0431\u0438\u043d\u0430     let binIndex = getBinInfo(vec2f(particle.x, particle.y),         simulationOptions).binIndex;      \/\/ \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0438\u043d\u0430     atomicAdd(&amp;binSize[binIndex + 1], 1u); }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432, \u0437\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u042f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 <code>binIndex + 1<\/code>, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c 0, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f  \u044d\u0442\u043e\u043c\u0443 <code>binOffset[i + 1] - binOffset[i]<\/code>\u00a0\u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u0440\u0430\u0437\u043c\u0435\u0440 i-\u0442\u043e\u0433\u043e \u0431\u0438\u043d\u0430. \u0421\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>binSize<\/code>\u00a0\u043d\u0430 1 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u043d\u043e\u0432.<\/p>\n<p><code>getBinInfo<\/code>\u00a0\u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0449\u0430\u044f \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0431\u0438\u043d\u0430 \u0438\u0437 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u0441\u0435\u0439 \u0441\u0435\u0442\u043a\u0438 \u0431\u0438\u043d\u043e\u0432:<\/p>\n<pre><code class=\"rust\">fn getBinInfo(position : vec2f, simulationOptions : SimulationOptions) -&gt; BinInfo {     let binSize = simulationOptions.binSize;     let gridSize = simulationOptions.gridSize;      let binId = vec2i(         clamp(i32(floor((position.x - simulationOptions.left) \/ binSize)), 0, gridSize.x - 1),         clamp(i32(floor((position.y - simulationOptions.bottom) \/ binSize)), 0, gridSize.y - 1)     );      let binIndex = binId.y * gridSize.x + binId.x;      return BinInfo(binId, binIndex); }<\/code><\/pre>\n<p><em>(\u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 <\/em><code><em>gridSize<\/em><\/code><em>\u00a0\u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u0430\u043a uniform, \u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u043e\u0434 \u0442\u0430\u043a, \u0430 \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u0441\u0442\u0430\u043b \u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e.)<\/em><\/p>\n<p>\u041d\u0430 \u044d\u0442\u0430\u043f\u0435 2 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0431\u0438\u043d\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0439 \u0431\u0438\u043d\u043e\u0432. \u0422\u0430\u043a \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0438\u043d\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043f\u043e \u0441\u043e\u0441\u0435\u0434\u0441\u0442\u0432\u0443, \u0431\u0438\u043d \u0441 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043b\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0438\u0437 \u0431\u0438\u043d\u043e\u0432 \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 O[i]\u00a0i-\u0442\u043e\u0433\u043e \u0431\u0438\u043d\u0430 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0443\u043c\u043c\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 S[j] \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0431\u0438\u043d\u043e\u0432:\u00a0<img decoding=\"async\" class=\"formula inline\" source=\"O[i] = \\sum\\limits_{j=0}^{i-1} S[j]\" alt=\"O[i] = \\sum\\limits_{j=0}^{i-1} S[j]\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5c8\/9ec\/bd6\/5c89ecbd6b7f2363140ce47b0a694f79.svg\" width=\"120\" height=\"62\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5c8\/9ec\/bd6\/5c89ecbd6b7f2363140ce47b0a694f79.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5c8\/9ec\/bd6\/5c89ecbd6b7f2363140ce47b0a694f79.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. \u0412 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">offset[0] = 0; for (int i = 1; i &lt; binCount; ++i)     binOffset[i] = binOffset[i - 1] + binSize[i];<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c <em>\u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u043c\u043c<\/em> (<em>prefix sums<\/em>). \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u043d\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043c\u043e\u0449\u044c GPU, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u043c\u043c; \u043e \u043d\u0435\u0439 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435.<\/p>\n<p>\u041f\u043e\u043a\u0430 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0443\u0436\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043b\u0438 \u044d\u0442\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f. \u041d\u0430 \u044d\u0442\u0430\u043f\u0435 3 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c (\u00ab\u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00bb) \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432 \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e \u0442\u043e\u0433\u043e, \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u0431\u0438\u043d\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0447\u0430\u0441\u0442\u0438\u0446\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0441\u043d\u043e\u0432\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 compute-\u0448\u0435\u0439\u0434\u0435\u0440 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"rust\">@group(0) @binding(0) var&lt;storage, read&gt; source : array&lt;Particle&gt;; @group(0) @binding(1) var&lt;storage, read_write&gt; destination : array&lt;Particle&gt;; @group(0) @binding(2) var&lt;storage, read&gt; binOffset : array&lt;u32&gt;; @group(0) @binding(3) var&lt;storage, read_write&gt; binSize : array&lt;atomic&lt;u32&gt;&gt;;  @group(1) @binding(0) var&lt;uniform&gt; simulationOptions : SimulationOptions;  @compute @workgroup_size(64) fn sortParticles(@builtin(global_invocation_id) id : vec3u) {     if (id.x &gt;= arrayLength(&amp;source)) {         return;     }      \/\/ \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b     let particle = particles[id.x];      \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0431\u0438\u043d\u0430     let binIndex = getBinInfo(vec2f(particle.x, particle.y),         simulationOptions).binIndex;      \/\/ \u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b     \/\/ \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0431\u0438\u043d\u0435     let indexInBin = atomicAdd(&amp;binSize[binIndex], 1);      \/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432     let newParticleIndex = binOffset[binIndex] + indexInBin;     destination[newParticleIndex] = particle; }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 <code>binSize<\/code>. \u041f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0448\u0435\u0439\u0434\u0435\u0440\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432 \u0431\u0438\u043d\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0432 \u044d\u0442\u043e, \u043c\u044b \u0441 \u043b\u0451\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043e\u0439\u0442\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0431\u0438\u043d\u0435, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0448\u0435\u0439\u0434\u0435\u0440, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0438\u043b\u044b \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u043e\u0431\u043e\u0439\u0434\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0431\u0438\u043d\u044b. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0441\u043d\u043e\u0432\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440:<\/p>\n<pre><code class=\"rust\">@group(0) @binding(0) var&lt;storage, read_write&gt; particles : array&lt;Particle&gt;; @group(0) @binding(1) var&lt;storage, read&gt; binOffset : array&lt;u32&gt;; @group(0) @binding(2) var&lt;storage, read&gt; forces : array&lt;Force&gt;;  @group(1) @binding(0) var&lt;uniform&gt; simulationOptions : SimulationOptions;  @compute @workgroup_size(64) fn computeForces(@builtin(global_invocation_id) id : vec3u) {     if (id.x &gt;= arrayLength(&amp;particles)) {         return;     }      \/\/ \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b     var particle = particles[id.x];     let type = u32(particle.type);      \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0431\u0438\u043d, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u0443     let binInfo = getBinInfo(vec2f(particle.x, particle.y), simulationOptions);      \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u0431\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439     var binXMin = binInfo.binId.x - 1;     var binYMin = binInfo.binId.y - 1;     var binXMax = binInfo.binId.x + 1;     var binYMax = binInfo.binId.y + 1;      \/\/ \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0435\u0442\u043a\u0438     binXMin = max(0, binXMin);     binYMin = max(0, binYMin);     binXMax = min(binInfo.gridSize.x - 1, binXMax);     binYMax = min(binInfo.gridSize.y - 1, binYMax);      let particlePosition = vec2f(particle.x, particle.y);      var totalForce = vec2f(0.0, 0.0);      \/\/ \u0418\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0431\u0438\u043d\u044b     for (var binX = binXMin; binX &lt;= binXMax; binX += 1) {         for (var binY = binYMin; binY &lt;= binYMax; binY += 1) {             \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0431\u0438\u043d\u0430             let binIndex = binY * binInfo.gridSize.x + binX;              \/\/ \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0447\u0430\u0441\u0442\u0438\u0446 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u043d\u0430             let binStart = binOffset[binIndex];             let binEnd = binOffset[binIndex + 1];              \/\/ \u0418\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u043d\u0430             for (var j = binStart; j &lt; binEnd; j += 1) {                 \/\/ \u041f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0447\u0430\u0441\u0442\u0438\u0446 \u0441 \u0441\u043e\u0431\u043e\u0439                 if (j == id.x) {                     continue;                 }                  let other = particlesSource[j];                 let otherType = u32(other.type);                  \/\/ \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u0438\u043b\u0443 \u043c\u0435\u0436\u0434\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438                  let force = forces[type * u32(simulationOptions.typeCount) + otherType];                  var r = vec2f(other.x, other.y) - particlePosition;                 let d = length(r);                  if (d &gt; 0.0) {                     let n = r \/ d;                      totalForce += force.strength * max(0.0, 1.0 - d \/ force.radius) * n;                     totalForce -= force.collisionStrength * max(0.0, 1.0 - d \/ force.collisionRadius) * n;                 }             }         }     }      \/\/ \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u0441\u0447\u0438\u0442\u0430\u044f \u043c\u0430\u0441\u0441\u0443 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439     particle.vx += totalForce.x * simulationOptions.dt;     particle.vy += totalForce.y * simulationOptions.dt;      particles[id.x] = particle; }<\/code><\/pre>\n<p><em>(\u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u043b\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u0430\u0446\u0438\u043a\u043b\u0435\u043d\u043d\u044b\u0445 \u0433\u0440\u0430\u043d\u0438\u0446. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0432 \u0434\u0440\u0443\u0433\u043e\u0439, \u043d\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u0435\u043c \u0436\u0435.)<\/em><\/p>\n<p><code>forces<\/code>\u00a0\u2014 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 <img decoding=\"async\" class=\"formula inline\" source=\"M^2\" alt=\"M^2\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e1a\/47d\/f3e\/e1a47df3ee0bdc1cdefee62aec320a9f.svg\" width=\"29\" height=\"21\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e1a\/47d\/f3e\/e1a47df3ee0bdc1cdefee62aec320a9f.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e1a\/47d\/f3e\/e1a47df3ee0bdc1cdefee62aec320a9f.svg 781w\" loading=\"lazy\" decode=\"async\"\/> (\u0433\u0434\u0435 M\u00a0\u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0438\u043f\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0446), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0438\u043b, \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0436\u0434\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438.<\/p>\n<h3>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430<\/h3>\n<p>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u043c\u043c \u2014 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u043e\u0435 \u0432 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prefix_sum#Algorithm_1:_Shorter_span,_more_parallel\" rel=\"noopener noreferrer nofollow\">\u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438<\/a> <em>Algorithm 1<\/em>, \u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/developer.nvidia.com\/gpugems\/gpugems3\/part-vi-gpu-computing\/chapter-39-parallel-prefix-sum-scan-cuda\" rel=\"noopener noreferrer nofollow\">GPU Gems 3 <\/a>\u2014 <em>naive parallel scan<\/em>.<\/p>\n<p>\u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u0437 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0432\u0441\u0451 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/54b\/a66\/730\/54ba66730b9e9d44b7a03098eb38734c.png\" width=\"1024\" height=\"994\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/54b\/a66\/730\/54ba66730b9e9d44b7a03098eb38734c.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/54b\/a66\/730\/54ba66730b9e9d44b7a03098eb38734c.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0443  <img decoding=\"async\" class=\"formula inline\" source=\"\\log_2(N)\" alt=\"\\log_2(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b7a\/ae3\/86a\/b7aae386a5c1dac335066e89b425f3dd.svg\" width=\"66\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b7a\/ae3\/86a\/b7aae386a5c1dac335066e89b425f3dd.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b7a\/ae3\/86a\/b7aae386a5c1dac335066e89b425f3dd.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0440\u0430\u0437 (\u0433\u0434\u0435 N\u00a0\u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430), \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u044f <code>x[i-step]<\/code>\u00a0\u043a <code>x[i]<\/code>, \u0433\u0434\u0435 <code>step<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0434\u0432\u043e\u0439\u043a\u0438. \u0412 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434\u0435 \u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 <code>k<\/code>\u00a0\u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"cpp\">step = (1 &lt;&lt; k); parallel for (int i = step; i &lt; array.size; ++i)     array[i] += array[i - step];<\/code><\/pre>\n<p>\u0418\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <code>i = step<\/code>\u00a0, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 <code>array[i - step]<\/code>\u00a0\u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044c <code>array[i]<\/code>\u00a0\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b (\u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <code>i<\/code>), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430: \u043e\u0434\u0438\u043d \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438. \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">parallel for (int i = 0; i &lt; input.size; ++i) {     if (i &lt; step)         output[i] = input[i];     else         output[i] = input[i] + input[i - step]; }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0439 \u0441\u0443\u043c\u043c\u044b \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u0438\u0433\u0440\u0430\u0435\u043c \u0432 \u043f\u0438\u043d\u0433-\u043f\u043e\u043d\u0433 \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 <img decoding=\"async\" class=\"formula inline\" source=\"\\log_2(N)\" alt=\"\\log_2(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d4\/f6e\/68f\/9d4f6e68fc58c0b54f970eb3fabb3067.svg\" width=\"66\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d4\/f6e\/68f\/9d4f6e68fc58c0b54f970eb3fabb3067.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d4\/f6e\/68f\/9d4f6e68fc58c0b54f970eb3fabb3067.svg 781w\" loading=\"lazy\" decode=\"async\"\/>\u00a0\u0440\u0430\u0437; \u043f\u0440\u0438 \u044d\u0442\u043e\u043c <code>step<\/code>\u00a0\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u0434\u0432\u043e\u0439\u043a\u0438. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 (<code>k = 0, step = 1<\/code>) \u043c\u0430\u0441\u0441\u0438\u0432 <code>binSize<\/code>\u00a0\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u043c, \u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u2014 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 (<code>k = 1, step = 2<\/code>) \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0445\u043e\u0434\u043d\u043e\u0439, \u0430 <code>binSize<\/code>\u00a0\u2014 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f WebGPU, \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0433\u0440\u0443\u043f\u043f \u043f\u0440\u0438\u0432\u044f\u0437\u043e\u043a (bind group) \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439: \u043e\u0434\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>binSize<\/code>\u00a0\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u0434\u0440\u0443\u0433\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e.<\/p>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0438\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0447\u0451\u0442\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0447\u0451\u0442\u043d\u043e\u0441\u0442\u0438 <img decoding=\"async\" class=\"formula inline\" source=\"\\log_2(N)\" alt=\"\\log_2(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/940\/d4d\/9ea\/940d4d9ea42d82f2e34ceb4d1442a7e7.svg\" width=\"66\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/940\/d4d\/9ea\/940d4d9ea42d82f2e34ceb4d1442a7e7.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/940\/d4d\/9ea\/940d4d9ea42d82f2e34ceb4d1442a7e7.svg 781w\" loading=\"lazy\" decode=\"async\"\/>. \u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u044e \u044d\u0442\u043e \u0434\u043e \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u0447\u0451\u0442\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430: \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 <code>binSize<\/code>, \u0430 \u043b\u0438\u0448\u043d\u044f\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u043c\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0431\u0443\u0444\u0435\u0440 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 (\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 <code>step &gt;= array.size<\/code>).<\/p>\n<p>\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u043e\u043b\u0433\u0438\u043c, \u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430:<\/p>\n<pre><code class=\"rust\">@group(0) @binding(0) var&lt;storage, read&gt; input : array&lt;u32&gt;; @group(0) @binding(1) var&lt;storage, read_write&gt; output : array&lt;u32&gt;; @group(0) @binding(2) var&lt;uniform&gt; stepSize : u32;  @compute @workgroup_size(64) fn prefixSumStep(@builtin(global_invocation_id) id : vec3u) {     if (id.x &gt;= arrayLength(&amp;input)) {         return;     }      if (id.x &lt; stepSize) {         output[id.x] = input[id.x];     } else {         output[id.x] = input[id.x - stepSize] + input[id.x];     } }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>stepSize<\/code>\u00a0\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u0449\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0435\u0434\u0438\u043d\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0435 compute, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0431\u0443\u0444\u0435\u0440 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043c\u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <code>stepSize<\/code>\u00a0\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0435\u0433\u043e \u043a\u0430\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u043b\u044f uniform-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00a0<code>stepSize<\/code>\u00a0\u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 <code>GPUComputePassEncoder.setBindGroup<\/code>.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438 <img decoding=\"async\" class=\"formula inline\" source=\"\\log_2(N)\" alt=\"\\log_2(N)\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8c4\/5a8\/1f6\/8c45a81f6970ff77bac52ca9ace6801a.svg\" width=\"66\" height=\"22\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8c4\/5a8\/1f6\/8c45a81f6970ff77bac52ca9ace6801a.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8c4\/5a8\/1f6\/8c45a81f6970ff77bac52ca9ace6801a.svg 781w\" loading=\"lazy\" decode=\"async\"\/> \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 (\u043e\u043a\u0440\u0443\u0433\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u0434\u043e \u0447\u0451\u0442\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430) \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u044d\u0442\u043e\u0442 compute-\u0448\u0435\u0439\u0434\u0435\u0440 (\u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0432\u044b\u0437\u043e\u0432\u0443 \u043d\u0430 \u0431\u0438\u043d; \u0438\u043b\u0438, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435, <code>binCount + 1<\/code>\u00a0\u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c), \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0442\u0443\u0434\u0430 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0431\u0443\u0444\u0435\u0440\u0430\u043c\u0438. \u0412\u043e\u0442, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430 JavaScript:<\/p>\n<pre><code class=\"javascript\">prefixSumIterations = Math.ceil(Math.ceil(Math.log2(binCount + 1)) \/ 2) * 2;  ...  binningComputePass.setPipeline(binPrefixSumPipeline); for (var i = 0; i &lt; prefixSumIterations; ++i) {     binningComputePass.setBindGroup(0, binPrefixSumBindGroup[i % 2], [i * 256]);     binningComputePass.dispatchWorkgroups(Math.ceil((binCount + 1) \/ 64)); }<\/code><\/pre>\n<p><em>(\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 <\/em><code><em>i * 256<\/em><\/code><em>\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u0437-\u0437\u0430 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0440\u0430\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0439 256 \u0431\u0430\u0439\u0442\u0430\u043c. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0433\u0440\u0443\u043f\u043f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a <\/em><code><em>Math.ceil((binCount + 1) \/ 64)<\/em><\/code><em>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0448\u0435\u0439\u0434\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 64 \u0438 \u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e \u0438\u0445 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c <\/em><code><em>binCount + 1<\/em><\/code><em>.)<\/em><\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u043c\u043c, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 10000 \u0431\u0438\u043d\u043e\u0432 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0447\u0430\u0441\u0442\u0438\u0446 \u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u043c\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043d\u0430 \u043c\u043e\u0451\u043c GeForce GTX 1060 \u043e\u043a\u043e\u043b\u043e 0,1 \u043c\u0441. \u0412\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <em>\u0432\u0441\u0435\u0433\u0434\u0430<\/em> \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u043d\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043b \u043c\u0435\u0436\u0434\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u0430\u043f\u0430 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u043d\u0430 \u0431\u0438\u043d\u044b \u043d\u0435 \u0434\u0430\u0451\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0432\u044b\u0433\u043e\u0434\u044b.<\/p>\n<h3>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433<\/h3>\n<p>\u042f \u0440\u0435\u043d\u0434\u0435\u0440\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432 \u0432\u0438\u0434\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u043e\u043c \u0448\u0435\u0439\u0434\u0435\u0440\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043a\u0440\u0443\u0433\u0438. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 2 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430, \u0442\u043e \u0435\u0441\u0442\u044c 6 \u0438\u043b\u0438 4 \u0432\u0435\u0440\u0448\u0438\u043d\u044b (\u0441 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0435\u0440\u0448\u0438\u043d \u0438\u043b\u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e), \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0434\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b. \u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e: \u043c\u043d\u0435 \u0431\u044b \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438\u0446 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0438\u043d\u0433. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0438 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0430\u0441\u0442\u0438\u0446 \u043a\u0430\u043a \u0431\u0443\u0444\u0435\u0440 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 ID \u0432\u0435\u0440\u0448\u0438\u043d:<\/p>\n<pre><code class=\"rust\">@group(0) @binding(0) var&lt;storage, read&gt; particles : array&lt;Particle&gt;; @group(0) @binding(1) var&lt;storage, read&gt; species : array&lt;Species&gt;; @group(1) @binding(0) var&lt;uniform&gt; camera : Camera;  struct VertexOut {     @builtin(position) position : vec4f,     @location(0) offset : vec2f,     @location(1) color : vec4f, }  const offsets = array&lt;vec2f, 6&gt;(     vec2f(-1.0, -1.0),     vec2f( 1.0, -1.0),     vec2f(-1.0,  1.0),     vec2f(-1.0,  1.0),     vec2f( 1.0, -1.0),     vec2f( 1.0,  1.0), );  @vertex fn vertexCircle(@builtin(vertex_index) id : u32) -&gt; VertexOut {     let particle = particles[id \/ 6u];     let offset = offsets[id % 6u] * 1.5;     let position = vec2f(particle.x, particle.y) + offset;     return VertexOut(         vec4f((position - camera.center) \/ camera.extent, 0.0, 1.0),         offset,         species[u32(particle.species)].color     ); }<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u0435\u0440\u0448\u0438\u043d <code>6 * particleCount<\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b. \u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445 \u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u0434\u043e \u0446\u0435\u043d\u0442\u0440\u0430 \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u043b\u044c\u0444\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0440\u0443\u0433\u0430 \u0441 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0430\u043d\u0442\u0438\u0430\u043b\u0438\u0430\u0441\u0438\u043d\u0433\u043e\u043c:<\/p>\n<pre><code class=\"rust\">@fragment fn fragmentCircle(in : VertexOut) -&gt; @location(0) vec4f {     let alpha = clamp(camera.pixelsPerUnit * (1.0 - length(in.offset)) + 0.5, 0.0, 1.0);     return in.color * vec4f(1.0, 1.0, 1.0, alpha); }<\/code><\/pre>\n<p>\u0412\u043e\u0442, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/186\/518\/505\/186518505faf6c303dce81612a1d8675.png\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/186\/518\/505\/186518505faf6c303dce81612a1d8675.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/186\/518\/505\/186518505faf6c303dce81612a1d8675.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c \u044d\u0444\u0444\u0435\u043a\u0442 \u0441\u0438\u044f\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0434\u0435 \u0434\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0441\u0430\u043c\u0438\u0445 \u0447\u0430\u0441\u0442\u0438\u0446. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u043d \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0430\u043a \u0436\u0435, \u043d\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0431\u043e\u043b\u044c\u0448\u0435, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u043b\u044c\u0444\u044b \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f, \u043a\u0430\u043a \u0433\u0430\u0443\u0441\u0441\u0438\u0430\u043d\u0430:<\/p>\n<pre><code class=\"rust\">@vertex fn vertexGlow(@builtin(vertex_index) id : u32) -&gt; VertexOut {     let particle = particles[id \/ 6u];     let offset = offsets[id % 6u];     let position = vec2f(particle.x, particle.y) + 12.0 * offset;     return CircleVertexOut(         vec4f((position - camera.center) \/ camera.extent, 0.0, 1.0),         offset,         species[u32(particle.species)].color     ); }  @fragment fn fragmentGlow(in : VertexOut) -&gt; @location(0) vec4f {     let l = length(in.offset);     let alpha = exp(- 6.0 * l * l) \/ 64.0;     return in.color * vec4f(1.0, 1.0, 1.0, alpha); }<\/code><\/pre>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/303\/111\/9c5\/3031119c54d81a33fc5d5c0d163a9290.png\" alt=\"\u042d\u0444\u0444\u0435\u043a\u0442 \u0441\u0438\u044f\u043d\u0438\u044f, \u0443\u0441\u0438\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438\" title=\"\u042d\u0444\u0444\u0435\u043a\u0442 \u0441\u0438\u044f\u043d\u0438\u044f, \u0443\u0441\u0438\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438\" width=\"800\" height=\"450\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/303\/111\/9c5\/3031119c54d81a33fc5d5c0d163a9290.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/303\/111\/9c5\/3031119c54d81a33fc5d5c0d163a9290.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u042d\u0444\u0444\u0435\u043a\u0442 \u0441\u0438\u044f\u043d\u0438\u044f, \u0443\u0441\u0438\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0441\u0451 \u044d\u0442\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0430\u0434\u0434\u0438\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f (\u0430 \u043d\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e over blending!) \u0432 HDR-\u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443\u00a0<code>rgba16float<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0442\u0438\u043d\u0433\u043e\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043d\u0430 HTML canvas) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u0438 ACES \u0438 \u0434\u0438\u0437\u0435\u0440\u0438\u043d\u0433\u0430 \u0441\u0438\u043d\u0435\u0433\u043e \u0448\u0443\u043c\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u043b\u043e\u0441\u044b, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u0438\u0437-\u0437\u0430 \u0442\u0451\u043c\u043d\u044b\u0445 \u0446\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u043a\u0440\u0430\u044f\u0445 \u0441\u0438\u044f\u043d\u0438\u044f. \u042f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043a\u0440\u0438\u0432\u044b\u043c\u0438 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u0438 \u0438 \u0432\u044b\u0431\u0440\u0430\u043b \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u0440\u0443\u0433\u043e\u0432 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0451\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f: \u0441\u044d\u043c\u043f\u043b\u043e\u0432 \u043a\u0440\u0443\u0433\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u043e, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u043b\u044c\u0444\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438, \u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0446\u0435\u043b\u043e\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0440\u0446\u0430\u044e\u0449\u0438\u0439 \u0445\u0430\u043e\u0441. \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440, \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0434\u0438\u0443\u0441 \u0438\u0445 \u0447\u0430\u0441\u0442\u0438\u0446 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0435\u043d\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b, \u043d\u043e \u0432\u0435\u0440\u0448\u0438\u043d\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0438\u043c\u0435\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u0440\u043e\u0432\u043d\u043e 2&#215;2 \u043f\u0438\u043a\u0441\u0435\u043b\u044f:<\/p>\n<pre><code class=\"rust\">@vertex fn vertexPoint(@builtin(vertex_index) id : u32) -&gt; VertexOut {     let particle = particles[id \/ 6u];     let offset = 2.0 * offsets[id % 6u] \/ camera.pixelsPerUnit;     let position = vec2f(particle.x, particle.y) + offset;     return CircleVertexOut(         vec4f((position - camera.center) \/ camera.extent, 0.0, 1.0),         offset,         species[u32(particle.species)].color     ); }<\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043d\u044b\u0439 \u0448\u0435\u0439\u0434\u0435\u0440 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u0440\u0443\u0433\u0430 \u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0439 \u043a\u0440\u0443\u0433\u0430 \u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u044f \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e \u043a\u0440\u0443\u0433 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a min\/max \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442) \u0438 \u0443\u043c\u043d\u043e\u0436\u0430\u044e \u043d\u0430 <img decoding=\"async\" class=\"formula inline\" source=\"\\frac{\\pi}{4}\" alt=\"\\frac{\\pi}{4}\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e56\/2dc\/239\/e562dc23905dcfb58395297931aa58e8.svg\" width=\"18\" height=\"38\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e56\/2dc\/239\/e562dc23905dcfb58395297931aa58e8.svg 780w,&#10;       https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e56\/2dc\/239\/e562dc23905dcfb58395297931aa58e8.svg 781w\" loading=\"lazy\" decode=\"async\"\/>, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u0435\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u0438 \u043a\u0440\u0443\u0433\u0430:<\/p>\n<pre><code class=\"rust\">@fragment fn fragmentPoint(in : CircleVertexOut) -&gt; @location(0) vec4f {     let s = vec2f(camera.pixelsPerUnit);     let d = max(vec2f(0.0), min(in.offset * s + 0.5, s) - max(in.offset * s - 0.5, - s));     let alpha = (PI \/ 4.0) * d.x * d.y;     return vec4f(in.color.rgb, in.color.a * alpha); }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0445\u0430\u043a, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043c\u0435\u0440\u0446\u0430\u0435\u0442, \u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0440\u0435\u0436\u0438\u043c\u0430\u043c\u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u0435\u043d.<\/p>\n<h3>\u0413\u0430\u043b\u0435\u0440\u0435\u044f<\/h3>\n<p>\u042f \u0443\u0436\u0435 \u0434\u0430\u0432\u0430\u043b \u0441\u0441\u044b\u043b\u043a\u0443 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f, \u0442\u043e \u043a \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 <a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u0438\u043b\u0438 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0442\u044c \u043d\u0430 \u00abRandomize\u00bb. \u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 \u0444\u0430\u0439\u043b JSON \u0438\u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u041f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0436\u0430\u0432 \u043d\u0430 \u00abCopy link\u00bb.<\/p>\n<p>\u042f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u0447\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0442\u0438\u043f\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0446, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0443\u043f\u043d\u043e\u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u044b\u0435 \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f, \u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u0438\u043f\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0446 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0431\u043e\u043b\u0435\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0445\u0430\u043e\u0442\u0438\u0447\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c. \u0418\u043d\u043e\u0433\u0434\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Simulated_annealing\" rel=\"noopener noreferrer nofollow\"><em>\u0438\u043c\u0438\u0442\u0430\u0446\u0438\u044e \u043e\u0442\u0436\u0438\u0433\u0430<\/em><\/a>\u00a0\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0434\u0435\u0441\u044c, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430.<\/p>\n<p>\u041d\u043e, \u0447\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u0430\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u044d\u0442\u0438\u043c \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u043c, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0437\u0430 \u043f\u044f\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u0442. \u041f\u043e\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0435\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8af\/6d0\/3b3\/8af6d03b3e4ae8419e63553bc898b007.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/8af\/6d0\/3b3\/8af6d03b3e4ae8419e63553bc898b007.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8af\/6d0\/3b3\/8af6d03b3e4ae8419e63553bc898b007.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=1&amp;friction=10&amp;centralForce=0&amp;symmetricForces=true&amp;loopingBorders=true&amp;seed=1964178017\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7c0\/d11\/af1\/7c0d11af16cae3c6a434a676a06b8d61.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/7c0\/d11\/af1\/7c0d11af16cae3c6a434a676a06b8d61.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7c0\/d11\/af1\/7c0d11af16cae3c6a434a676a06b8d61.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=2&amp;friction=10&amp;centralForce=0&amp;symmetricForces=true&amp;loopingBorders=true&amp;seed=781562033\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/82e\/4c2\/2f6\/82e4c22f6e88817f9ab68a71dd0d07c8.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/82e\/4c2\/2f6\/82e4c22f6e88817f9ab68a71dd0d07c8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/82e\/4c2\/2f6\/82e4c22f6e88817f9ab68a71dd0d07c8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=2&amp;friction=10&amp;centralForce=0&amp;symmetricForces=true&amp;loopingBorders=true&amp;seed=470127870\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1be\/44d\/1cb\/1be44d1cb303ccdbe806537fd33e2931.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/1be\/44d\/1cb\/1be44d1cb303ccdbe806537fd33e2931.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1be\/44d\/1cb\/1be44d1cb303ccdbe806537fd33e2931.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=2&amp;friction=10&amp;centralForce=0&amp;symmetricForces=true&amp;loopingBorders=true&amp;seed=3856172604\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5f5\/969\/5f1\/5f59695f141c7463804d5f6b447bd364.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/5f5\/969\/5f1\/5f59695f141c7463804d5f6b447bd364.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5f5\/969\/5f1\/5f59695f141c7463804d5f6b447bd364.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=2&amp;friction=10&amp;centralForce=0&amp;symmetricForces=true&amp;loopingBorders=true&amp;seed=4037789242\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/14a\/245\/539\/14a2455392c561de72d6e53d8994cc66.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/14a\/245\/539\/14a2455392c561de72d6e53d8994cc66.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/14a\/245\/539\/14a2455392c561de72d6e53d8994cc66.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=3&amp;friction=10&amp;centralForce=0&amp;symmetricForces=true&amp;loopingBorders=true&amp;seed=2609318066\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/516\/3be\/fe2\/5163befe21a14604dd9581ef0d3a63b5.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/516\/3be\/fe2\/5163befe21a14604dd9581ef0d3a63b5.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/516\/3be\/fe2\/5163befe21a14604dd9581ef0d3a63b5.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=3&amp;friction=10&amp;centralForce=0&amp;symmetricForces=true&amp;loopingBorders=true&amp;seed=1940662796\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cc4\/20f\/55e\/cc420f55e9160964d9b3952c762c98fc.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/cc4\/20f\/55e\/cc420f55e9160964d9b3952c762c98fc.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cc4\/20f\/55e\/cc420f55e9160964d9b3952c762c98fc.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=3&amp;friction=10&amp;centralForce=0&amp;symmetricForces=false&amp;loopingBorders=true&amp;seed=3584546700\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ac9\/031\/4ca\/ac90314caafb697b9da979da467e1e42.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/ac9\/031\/4ca\/ac90314caafb697b9da979da467e1e42.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ac9\/031\/4ca\/ac90314caafb697b9da979da467e1e42.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=3&amp;friction=10&amp;centralForce=0&amp;symmetricForces=false&amp;loopingBorders=true&amp;seed=1876301519\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/86c\/239\/589\/86c239589cd3a4299815c852ca419337.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/86c\/239\/589\/86c239589cd3a4299815c852ca419337.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/86c\/239\/589\/86c239589cd3a4299815c852ca419337.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=4&amp;friction=10&amp;centralForce=0&amp;symmetricForces=false&amp;loopingBorders=true&amp;seed=3588165106\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7f8\/843\/cdc\/7f8843cdc08005f685557131459b59ec.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/7f8\/843\/cdc\/7f8843cdc08005f685557131459b59ec.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7f8\/843\/cdc\/7f8843cdc08005f685557131459b59ec.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=4&amp;friction=10&amp;centralForce=0&amp;symmetricForces=false&amp;loopingBorders=true&amp;seed=1007650884\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/411\/02f\/0c3\/41102f0c3173c7ad603d9e15d329c394.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430\" width=\"640\" height=\"360\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/411\/02f\/0c3\/41102f0c3173c7ad603d9e15d329c394.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/411\/02f\/0c3\/41102f0c3173c7ad603d9e15d329c394.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><a href=\"https:\/\/lisyarus.github.io\/webgpu\/particle-life.html?particleCount=65536&amp;speciesCount=8&amp;friction=10&amp;centralForce=0&amp;symmetricForces=false&amp;loopingBorders=true&amp;seed=958305330\" rel=\"noopener noreferrer nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a><\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u044f\u0442\u0441\u044f \u043c\u043e\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0438 \u0440\u0430\u0431\u043e\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043c\u043e\u0438 <a href=\"https:\/\/youtube.com\/@lisyarus\" rel=\"noopener noreferrer nofollow\">\u0434\u0435\u0432\u043b\u043e\u0433\u0438 \u043d\u0430 YouTube:<\/a><\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/683d5f651b6bd2ba7cfdc1b7\" data-style=\"\" id=\"683d5f651b6bd2ba7cfdc1b7\" width=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/914502\/\"> https:\/\/habr.com\/ru\/articles\/914502\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u042f <a href=\"https:\/\/lisyarus.github.io\/blog\/posts\/soft-body-physics.html\" rel=\"noopener noreferrer nofollow\">\u043b\u044e\u0431\u043b\u044e<\/a>\u00a0<a href=\"https:\/\/lisyarus.github.io\/blog\/posts\/structural-mechanics-2.html\" rel=\"noopener noreferrer nofollow\">\u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435<\/a>\u00a0<a href=\"https:\/\/lisyarus.github.io\/blog\/posts\/simulating-water-over-terrain.html\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438<\/a>, \u0430 \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 <a href=\"https:\/\/lisyarus.itch.io\/particle-simulator\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0447\u0430\u0441\u0442\u0438\u0446<\/a>. \u041e\u0431\u044b\u0447\u043d\u043e \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e \u0447\u0442\u043e-\u0442\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0438, \u043d\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0437\u0430\u0431\u0430\u0432\u043d\u0443\u044e \u043d\u0435\u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0449\u0435\u0435 <em>\u0436\u0438\u0437\u043d\u044c<\/em>.<\/p>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0430 C++ \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0434\u043b\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 WebGPU API. \u041e\u043d \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/683ec5adfec567ba65e5a77b\" data-style=\"\" id=\"683ec5adfec567ba65e5a77b\" width=\"\"><\/div>\n<p>\u0412 \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043e\u043d \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0432\u043d\u0443\u0442\u0440\u0438.<\/p>\n<h3>\u041c\u043e\u0434\u0435\u043b\u044c Particle Life<\/h3>\n<p>\u0412 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u044d\u0442\u043e \u0432\u0438\u0434\u0435\u043e), \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/www.youtube.com\/watch?v=4vk7YvBYpOs\" rel=\"noopener noreferrer nofollow\">1<\/a>,\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=p4YirERTVF0\" rel=\"noopener noreferrer nofollow\">2<\/a> \u0438 <a href=\"https:\/\/www.youtube.com\/watch?v=Z_zmZ23grXE\" rel=\"noopener noreferrer nofollow\">3<\/a>, \u0430 \u0432 <a href=\"https:\/\/www.youtube.com\/watch?v=scvuli-zcRc&amp;t=396s\" rel=\"noopener noreferrer nofollow\">\u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u043c<\/a> \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438. \u0418\u0437-\u0437\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0435\u0442\u0435\u043d\u0446\u0438\u043e\u0437\u043d\u043e\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e \u0438\u0437 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u043b\u043e\u0432, \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u00abparticle life\u00bb \u043d\u0435 \u0432\u0435\u0440\u043d\u0451\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0438\u0434\u0435\u043e \u043d\u0430 YouTube), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0432\u043e\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u0412\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=xiUpAeos168\" rel=\"noopener noreferrer nofollow\">\u043e\u0434\u043d\u043e\u043c \u0432\u0438\u0434\u0435\u043e<\/a>\u00a0\u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u0442\u0430\u043b\u0438 \u043c\u0438\u043a\u0440\u043e\u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0434\u043e\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0442\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0447\u043d\u044b\u043c\u0438 \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>\u042d\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0441\u0432\u043e\u0451 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u043a\u043e\u043d\u0432\u0435\u0435\u0432\u0441\u043a\u043e\u0439 \u0438\u0433\u0440\u043e\u0439 \u00ab\u0416\u0438\u0437\u043d\u044c\u00bb. \u041e\u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 <a href=\"https:\/\/google-research.github.io\/self-organising-systems\/particle-lenia\" rel=\"noopener noreferrer nofollow\">Particle Lenia<\/a>, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0438\u0434\u0435\u044f \u0442\u0430\u043a\u043e\u0432\u0430: \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0438\u043f\u0438\u0447\u043d\u0443\u044e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0441 \u0442\u043e\u0447\u0435\u0447\u043d\u044b\u043c\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438, \u043d\u043e \u0441\u0438\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c <em>\u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c\u0438<\/em>: \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u0410 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0411, \u043d\u043e \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u0411 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0410 (\u0438\u043b\u0438 \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0435\u0451 \u0441 \u0431\u043e\u043b\u044c\u0448\u0435\u0439\/\u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0441\u0438\u043b\u043e\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435). \u042d\u0442\u043e \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u0442\u0440\u0435\u0442\u0438\u0439 \u0437\u0430\u043a\u043e\u043d \u041d\u044c\u044e\u0442\u043e\u043d\u0430, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u0437\u0430\u043a\u043e\u043d\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f (\u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u0438, \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0438 \u0432\u0440\u0430\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430).<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c \u0438 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0430\u0449\u0438\u043c \u0444\u0438\u0437\u0438\u043a\u0435, \u043d\u043e<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0439 \u043c\u044b \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0437\u0430\u043a\u043e\u043d\u0430\u043c\u0438,<\/p>\n<\/li>\n<li>\n<p>\u042d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u044d\u043d\u0435\u0440\u0433\u0438\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0436\u0438\u0432\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043c\u044b.<\/p>\n<\/li>\n<\/ol>\n<p>\u0416\u0438\u0432\u044b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u043f\u0438\u0449\u0443 \u0438 \u043a\u0438\u0441\u043b\u043e\u0440\u043e\u0434 (\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0445\u0438\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0430), \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044f \u0438\u0445 \u0432 \u044d\u043d\u0435\u0440\u0433\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0438\u0441\u043a \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0410\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0435 \u0441\u0438\u043b\u044b Particle Life \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u043e, \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044f \u0446\u0438\u043a\u043b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0435\u0449\u0435\u0441\u0442\u0432 \u0432 \u044d\u043d\u0435\u0440\u0433\u0438\u044e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043d\u043e\u0432\u0443\u044e \u044d\u043d\u0435\u0440\u0433\u0438\u044e.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u0411 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0435\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0410, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0443\u0431\u0435\u0433\u0430\u0435\u0442 \u043e\u0442 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0411, \u0447\u0442\u043e \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u0445\u0438\u0449\u043d\u0438\u043a\u0430 \u0438 \u0436\u0435\u0440\u0442\u0432\u044b \u0438\u0437 \u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0438 \u043d\u0435 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0430\u044e\u0442\u0441\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u0411 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u00ab\u0441\u044a\u0435\u0441\u0442\u00bb \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0410.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e <em>\u0442\u0438\u043f\u043e\u0432<\/em> \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u044b \u0442\u0438\u043f\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0446. \u041b\u0438\u0447\u043d\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u044c, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u0432 <a href=\"https:\/\/www.youtube.com\/watch?v=xiUpAeos168\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0434\u0435\u043e<\/a>:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u0434\u0432\u0443\u0445 \u043b\u044e\u0431\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0447\u0430\u0441\u0442\u0438\u0446 \u0410 \u0438 \u0411 \u0441\u0438\u043b\u0430, \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u0438\u0446\u0435\u0439 \u0410 \u043e\u0442 \u0411, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439: <em>\u0441\u0438\u043b\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f <\/em>\u0438 <em>\u0441\u0438\u043b\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f<\/em>.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043b\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0449\u0435\u0439 \u0438\u043b\u0438 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0449\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043b\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0449\u0430\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0435 \u0441\u0438\u043b\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b. \u041f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u0435, \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u2014 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435. (\u0414\u043b\u044f \u0441\u0438\u043b\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435).<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0434\u0438\u0443\u0441 \u0441\u0438\u043b\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0440\u0430\u0434\u0438\u0443\u0441 \u0441\u0438\u043b\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (\u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u0431\u043b\u0438\u0437\u043a\u043e\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u2014 \u043d\u0430 \u0434\u0430\u043b\u0451\u043a\u043e\u043c).<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441\u0438\u043b\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0441\u0438\u043b\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0435 \u0441\u0438\u043b\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u0441 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0434\u0438\u0443\u0441\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0432\u043d\u044b \u043d\u0443\u043b\u044e.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0432\u0438\u0434\u0435 \u0444\u043e\u0440\u043c\u0443\u043b \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0438\u043b\u044b \u043e\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0442\u0430\u043a:<\/p>\n<p>\u0413\u0434\u0435 A \u2014 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441\u0438\u043b\u044b (\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u044f),\u00a0R\u00a0\u2014 \u0440\u0430\u0434\u0438\u0443\u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0438\u043b\u044b \u0430 r\u00a0\u2014 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438.<\/p>\n<p>\u0412\u043e\u0442 \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u0438\u043b\u044b \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0433\u0434\u0435 A=5 \u0438 R=10:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0410 \u0432\u043e\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u044f, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0444\u0438\u0437\u0438\u043a\u0430:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 <a href=\"https:\/\/www.desmos.com\/calculator\/ram14bkp1r\" rel=\"noopener noreferrer nofollow\">Desmos<\/a>\u00a0\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u0438\u043b\u0443 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u043b\u0443 \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u044f, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0441\u0438\u043b\u044b \u043e\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0418 \u0442\u0430\u043a\u0443\u044e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u044d\u043d\u0435\u0440\u0433\u0438\u044e:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041e\u043d\u0438 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 <a href=\"https:\/\/www.desmos.com\/calculator\/nebtb6ltme\" rel=\"noopener noreferrer nofollow\">Desmos<\/a>.<\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f + \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0435\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0433\u0434\u0435 \u0441\u0438\u043b\u0430 \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u0438\u0446, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u0438 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0438\u043b\u0430 (\u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u0438 \u044d\u043d\u0435\u0440\u0433\u0438\u044f) \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u043d\u0443\u043b\u044e, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u043c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u043e\u043c  \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0433\u0440\u0430\u0432\u0438\u0442\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043c\u0430\u0433\u043d\u0435\u0442\u0438\u0437\u043c\u0430. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0441\u0438\u043b\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443 \u0438 \u0435\u0451 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0438\u043b\u044b, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438\u043b\u0438 \u0440\u0430\u0434\u0438\u0443\u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0438\u0446 \u0441\u043b\u0438\u043b\u0438\u0441\u044c \u0432 \u043e\u0434\u043d\u0443:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u044d\u0442\u043e \u043d\u0430\u0441 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442, \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0448\u0438\u043c \u0441\u0438\u043b\u0430\u043c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f (\u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u0430 \u0441 ).<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0440\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438. \u041e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043e\u043d\u0430 \u0431\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0430 \u044d\u043d\u0435\u0440\u0433\u0438\u044e \u0438 \u0432\u0441\u0451 \u0431\u044b \u0443\u0441\u043a\u043e\u0440\u044f\u043b\u043e\u0441\u044c \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 WebGPU?<\/h3>\n<p>\u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043f\u0435\u0440\u0435\u043d\u0451\u0441 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u043d\u0430 GPU. \u042d\u0442\u043e \u0442\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b GPU. \u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e WebGPU?<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0447\u0438\u0442\u0430\u043b\u0438 \u043c\u043e\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u0442\u043e \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044f \u043e\u0431\u043e\u0436\u0430\u044e WebGPU. \u042f \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u043b\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 OpenGL, \u0438 \u043c\u0435\u043d\u044f \u043e\u0442 \u043d\u0435\u0433\u043e \u0442\u043e\u0448\u043d\u0438\u0442. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0430\u0440\u044b\u0439, \u0443\u0436\u0430\u0441\u043d\u043e \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 API \u0441 \u043a\u0443\u0447\u0435\u0439 \u043b\u0435\u0433\u0430\u0441\u0438-\u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0441\u0435\u043c\u044c \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434. \u041e\u0434\u043d\u0430\u043a\u043e Vulkan, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0441\u0442\u0430\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c API, \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u044b\u0441\u044f\u0447\u0443 \u0441\u0442\u0440\u043e\u043a \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, <em>\u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a<\/em>, \u0434\u0430\u0436\u0435 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0432\u0435\u0440\u0448\u0438\u043d \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u041d\u0435 \u043f\u043e\u0439\u043c\u0438\u0442\u0435 \u043c\u0435\u043d\u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, Vulkan \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0440\u0443\u0442, \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0442 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u0432 \u0441\u0432\u043e\u0438\u0445 \u0445\u043e\u0431\u0431\u0438-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u042d\u0442\u0443 \u043d\u0438\u0448\u0443 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043b \u0434\u043b\u044f \u043c\u0435\u043d\u044f WebGPU. \u042d\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0438 \u0447\u0438\u0441\u0442\u044b\u0439 API, \u0438 \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439. \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u042f \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0435\u0433\u043e \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 (\u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/github.com\/gfx-rs\/wgpu-native\" rel=\"noopener noreferrer nofollow\">wgpu-native<\/a>), \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0434\u043b\u044f <a href=\"https:\/\/github.com\/lisyarus\/webgpu-raytracer\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043b\u0443\u0447\u0435\u0439 \u041c\u043e\u043d\u0442\u0435-\u041a\u0430\u0440\u043b\u043e<\/a>\u00a0\u0438\u00a0<a href=\"https:\/\/github.com\/lisyarus\/webgpu-shallow-water\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0432\u043e\u0434\u044b \u043d\u0430\u0434 \u0440\u0435\u043b\u044c\u0435\u0444\u043e\u043c<\/a>, \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e \u0435\u0433\u043e \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u2014 <a href=\"https:\/\/www.youtube.com\/playlist?list=PLSGI94QoFYJwGaieAkqw5_qfoupdppxHN\" rel=\"noopener noreferrer nofollow\">\u0433\u0440\u0430\u0434\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0441\u0440\u0435\u0434\u043d\u0435\u0432\u0435\u043a\u043e\u0432\u043e\u0439 \u0434\u0435\u0440\u0435\u0432\u043d\u0438<\/a>. \u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u044d\u0442\u043e\u0442 API.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0431\u0443\u0434\u0443\u0447\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c API, \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a compute-\u0448\u0435\u0439\u0434\u0435\u0440\u044b \u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043d\u0438\u0436\u0435, \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438. \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, WebGL \u0438\u0445 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0438 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0431\u043e\u043d\u0443\u0441 \u2014 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435! \u0418\u043b\u0438, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0444\u043b\u0430\u0433\u0430\u043c\u0438, \u043d\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u0426\u0438\u043a\u043b \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e WebGPU? \u0421\u0430\u043c \u0446\u0438\u043a\u043b \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c:<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043f\u0430\u0443\u0437\u0443,<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0441\u0438\u043b\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0430 \u043d\u0435\u0451 \u0434\u0440\u0443\u0433\u0438\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u043a \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043d\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u0420\u0435\u043d\u0434\u0435\u0440\u0438\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u044b<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Semi-implicit_Euler_method\" rel=\"noopener noreferrer nofollow\">\u0441\u0438\u043c\u043f\u043b\u0435\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u042d\u0439\u043b\u0435\u0440\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438.<\/p>\n<p>\u042f \u0445\u0440\u0430\u043d\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 GPU. \u0427\u0430\u0441\u0442\u0438\u0446\u0430 \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f struct \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"rust\">struct Particle {     \/\/ \u041f\u043e\u0437\u0438\u0446\u0438\u044f     x : f32,     y : f32,      \/\/ \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c     vx : f32,     vy : f32,      \/\/ \u0422\u0438\u043f     species : f32, }<\/code><\/pre>\n<p><em>\u042f \u043d\u0435 \u0445\u0440\u0430\u043d\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 <\/em><code><em>vec2f<\/em><\/code><em>\u00a0\u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f, \u0430 \u0442\u0438\u043f \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0445\u0440\u0430\u043d\u044e, \u043a\u0430\u043a <\/em><code><em>f32<\/em><\/code><em>, \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u0438\u0437 JavaScript, \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 <\/em><code><em>Float32Array<\/em><\/code><em>.<\/em><\/p>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0430\u0441\u0442\u0438\u0446\u0430 \u2014 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043f\u044f\u0442\u044c float, \u0442\u043e \u0435\u0441\u0442\u044c 20 \u0431\u0430\u0439\u0442\u043e\u0432. \u0422\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 compute-\u0448\u0435\u0439\u0434\u0435\u0440\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u0438\u0446\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438\u0446\u044b, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0438\u043b\u044b \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044e. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043b \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0443\u0437\u043a\u0438\u043c \u043c\u0435\u0441\u0442\u043e\u043c: \u044d\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f , \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0440\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0438\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0432\u0441\u0435\u043c\u0438 \u0447\u0430\u0441\u0442\u0438\u0446\u0430\u043c\u0438. \u042d\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0430\u0441\u0442\u0438\u0446, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 CPU \u043c\u043e\u0433\u043b\u0430 \u0432\u044b\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e 4096 \u0447\u0430\u0441\u0442\u0438\u0446, \u0434\u0430\u0436\u0435 \u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0445\u0438\u0442\u0440\u0435\u0435 \u043f\u043e\u0434\u043e\u0439\u0442\u0438 \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044e \u0441\u0438\u043b; \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0435\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 compute-\u043f\u0440\u043e\u0445\u043e\u0434. \u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u0432\u0441\u0451 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e: \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 compute-\u0448\u0435\u0439\u0434\u0435\u0440\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u0446\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442 \u0435\u0451 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0441 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438:<\/p>\n<pre><code class=\"rust\">@group(0) @binding(0) var&lt;storage, read_write&gt; particles : array&lt;Particle&gt;;  @group(1) @binding(0) var&lt;uniform&gt; simulationOptions : SimulationOptions;  @compute @workgroup_size(64) fn particleAdvance(@builtin(global_invocation_id) id : vec3u) {     \/\/ \u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0430 \u043a\u043e\u043d\u0446\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430     if (id.x &gt;= arrayLength(&amp;particles)) {         return;     }      let width = simulationOptions.right - simulationOptions.left;     let height = simulationOptions.top - simulationOptions.bottom;      var particle = particles[id.x];      \/\/ \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u0440\u0435\u043d\u0438\u0435     particle.vx *= simulationOptions.friction;     particle.vy *= simulationOptions.friction;      \/\/ \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u0438\u0446\u0443 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438     particle.x += particle.vx * simulationOptions.dt;     particle.y += particle.vy * simulationOptions.dt;      \/\/ \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438\u0438 \u0441 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438     if (particle.x &lt; simulationOptions.left) {         particle.x = simulationOptions.left;         particle.vx *= -1.0;     }      if (particle.x &gt; simulationOptions.right) {         particle.x = simulationOptions.right;         particle.vx *= -1.0;     }      if (particle.y &lt; simulationOptions.bottom) {         particle.y = simulationOptions.bottom;         particle.vy *= -1.0;     }      if (particle.y &gt; simulationOptions.top) {         particle.y = simulationOptions.top;         particle.vy *= -1.0;     }      \/\/<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-461918","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/461918","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=461918"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/461918\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=461918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=461918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=461918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}