{"id":467125,"date":"2025-07-16T03:00:11","date_gmt":"2025-07-16T03:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=467125"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=467125","title":{"rendered":"<span>ThreeJs \u2014 \u043e\u0441\u043d\u043e\u0432\u044b<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u0443 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 3d \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u0443 \u0442\u0435\u0431\u044f \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f js, \u0430 \u0442\u0430\u043a\u0436\u0435 react. \u0422\u0430\u043a\u0436\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c \u0447\u0442\u043e \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f.<\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<ul>\n<li>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 threejs<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>Threejs \u0438 React<\/p>\n<\/li>\n<\/ul>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Three.js<\/h2>\n<p>Three.js \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <strong>\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439<\/strong>. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0438\u0445 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<p><strong>\u0421\u0446\u0435\u043d\u0430<\/strong> \u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 (\u043e\u0431\u044a\u0435\u043a\u0442), \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0448\u044c \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b: \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044e, \u0441\u0432\u0435\u0442, \u043c\u043e\u0434\u0435\u043b\u0438, \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0438 \u0442.\u043f. <\/p>\n<pre><code class=\"javascript\">const scene = new THREE.Scene(); scene.background = new THREE.Color(0x222222); \/\/ \u0442\u0451\u043c\u043d\u043e-\u0441\u0435\u0440\u044b\u0439 \u0444\u043e\u043d<\/code><\/pre>\n<p><strong>\u041a\u0430\u043c\u0435\u0440\u0430<\/strong> \u2014 \u044d\u0442\u043e \u0433\u043b\u0430\u0437 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0438\u0434\u0438\u0442 \u0441\u0446\u0435\u043d\u0443. \u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0432\u043d\u0435 \u043f\u043e\u043b\u044f \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u0430\u043c\u0435\u0440\u044b.<\/p>\n<pre><code class=\"javascript\">const camera = new THREE.PerspectiveCamera(   75,                             \/\/ \u0443\u0433\u043e\u043b \u043e\u0431\u0437\u043e\u0440\u0430 (FOV)   window.innerWidth \/ window.innerHeight, \/\/ \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d   0.1,                            \/\/ \u0431\u043b\u0438\u0436\u043d\u044f\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f   1000                            \/\/ \u0434\u0430\u043b\u044c\u043d\u044f\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f ); camera.position.set(0, 1, 5); \/\/ \u043a\u0430\u043c\u0435\u0440\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0441 \u0442\u043e\u0447\u043a\u0438 (0, 1, 5)<\/code><\/pre>\n<p><strong>\u0420\u0435\u043d\u0434\u0435\u0440\u0435\u0440<\/strong> \u2014 \u044d\u0442\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0441\u0446\u0435\u043d\u0443 \u0438 \u043a\u0430\u043c\u0435\u0440\u0443 \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u0442.\u0435. \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 HTML-\u044d\u043a\u0440\u0430\u043d\u0435. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u043e 2 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<pre><code class=\"javascript\">const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setSize(window.innerWidth, window.innerHeight); \/\/ \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0432\u044c\u044e\u043f\u043e\u0440\u0442\u0430 document.body.appendChild(renderer.domElement); \/\/ &lt;canvas&gt; \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0432 DOM<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 ? <\/p>\n<p>\u0422\u044b \u2192 \u0441\u043e\u0437\u0434\u0430\u0451\u0448\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u2192 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0448\u044c \u0438\u0445 \u0432 \u0441\u0446\u0435\u043d\u0443<br \/> \u041a\u0430\u043c\u0435\u0440\u0430 \u2192 \u201c\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u201d \u043d\u0430 \u0441\u0446\u0435\u043d\u0443<br \/> \u0420\u0435\u043d\u0434\u0435\u0440\u0435\u0440 \u2192 \u0440\u0438\u0441\u0443\u0435\u0442 \u044d\u0442\u043e \u0432  \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<\/p>\n<p>\u0422\u0430\u043a \u0430 \u0447\u0442\u043e \u0436\u0435 \u043d\u0430 \u0441\u0447\u0435\u0442 3d \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0440\u0430\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0438 \u0441\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c? \u0414\u0430\u0432\u0430\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0438\u0445 \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0427\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0434\u0435\u043b\u044c ? <\/p>\n<p><strong>3D-\u043c\u043e\u0434\u0435\u043b\u044c<\/strong> \u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0444\u043e\u0440\u043c\u0443, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b, \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>\u041a\u0430\u043a \u0442\u044b \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u043b \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0414\u0430\u0432\u0430\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0432 \u043d\u0438\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p><strong>\u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f (Geometry) <\/strong>&#8212; \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430 \u043c\u043e\u0434\u0435\u043b\u0438: \u0432\u0435\u0440\u0448\u0438\u043d\u044b, \u0433\u0440\u0430\u043d\u0438, \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438.<\/p>\n<ul>\n<li>\n<p><strong>\u0412\u0435\u0440\u0448\u0438\u043d\u044b (vertices)<\/strong> \u2014 \u0442\u043e\u0447\u043a\u0438 \u0432 3D-\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0440\u0430\u043d\u0438 (faces)<\/strong> \u2014 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u043e\u0440\u043c\u0430\u043b\u0438<\/strong> \u2014 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u201c\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u201d \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p><strong>UV<\/strong> \u2014 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u043e 2 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<p><strong>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b (Materials) <\/strong>&#8212; \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c: \u0446\u0432\u0435\u0442, \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0412 Threejs \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0443\u0436\u0430\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u043b\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 MeshStandardMaterial:<\/p>\n<pre><code class=\"javascript\">const standardMaterial = new THREE.MeshStandardMaterial({   color: 0xffffff,   metalness: 0.8,   roughness: 0.2 });<\/code><\/pre>\n<p><code>MeshStandardMaterial<\/code>, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>color<\/p>\n<\/li>\n<li>\n<p>roughness<\/p>\n<\/li>\n<li>\n<p>metalness<\/p>\n<\/li>\n<li>\n<p>emissive<\/p>\n<\/li>\n<li>\n<p>alpha (\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c)<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 <code>MeshPhysicalMaterial<\/code>, \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 threejs, \u043a \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u0422\u0435\u043a\u0441\u0442\u0443\u0440\u044b (Textures)<\/strong> &#8212; \u044d\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0422\u0438\u043f\u044b \u0442\u0435\u043a\u0441\u0442\u0443\u0440:<\/p>\n<ul>\n<li>\n<p><code>diffuse<\/code> \/ <code>baseColor<\/code> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0432\u0435\u0442<\/p>\n<\/li>\n<li>\n<p><code>normalMap<\/code> \u2014 \u0444\u0435\u0439\u043a\u043e\u0432\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u043b\u044c\u0435\u0444\u0430<\/p>\n<\/li>\n<li>\n<p><code>metalnessMap<\/code>, <code>roughnessMap - \u0431\u043b\u0435\u0441\u043a<\/code><\/p>\n<\/li>\n<li>\n<p><code>aoMap<\/code> \u2014 ambient occlusion (\u0442\u0435\u043d\u0438)<\/p>\n<\/li>\n<li>\n<p><code>emissiveMap<\/code> \u2014 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0430<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">const textureLoader = new THREE.TextureLoader(); const texture = textureLoader.load('\/textures\/wood.jpg'); const material = new THREE.MeshStandardMaterial({ map: texture });<\/code><\/pre>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0441\u0430\u043c\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 <code>GLTFLoader<\/code>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u0435\u0435 \u044d\u043a\u0437\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Loader<\/code> \u0441 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c<\/p>\n<pre><code class=\"javascript\"> import { GLTFLoader } from 'three\/examples\/jsm\/loaders\/GLTFLoader';  const loader = new GLTFLoader(); loader.load('\/models\/robot.glb', (gltf) =&gt; {   scene.add(gltf.scene); }); <\/code><\/pre>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/h2>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u0430 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 3d-\u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u043e\u043c.<\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 threejs \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 (<code>gltf.animations.length &gt; 0<\/code>), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 <code>THREE.AnimationMixer<\/code>:<\/p>\n<pre><code class=\"javascript\">let mixer; const clock = new THREE.Clock();  loader.load('\/models\/fox.glb', (gltf) =&gt; {   const model = gltf.scene;   scene.add(model);    mixer = new THREE.AnimationMixer(model);    \/\/ \u041f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e   const action = mixer.clipAction(gltf.animations[0]);   action.play(); });  function animate() {   requestAnimationFrame(animate);   const delta = clock.getDelta();   mixer?.update(delta);   renderer.render(scene, camera); } <\/code><\/pre>\n<h2>Threejs \u0438 React<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Three.js \u0432 React \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<p><strong>@react-three\/fiber<\/strong> &#8212; \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 Three.js \u0447\u0435\u0440\u0435\u0437 JSX (\u0430\u043d\u0430\u043b\u043e\u0433 react-dom, \u043d\u043e \u0434\u043b\u044f WebGL)<\/p>\n<p><strong>@react-three\/drei <\/strong>&#8212; \u041d\u0430\u0431\u043e\u0440 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432: OrbitControls, Stage, Text, Gizmo, Loader \u0438 \u0442.\u0434.<\/p>\n<p><strong>@react-three\/postprocessing &#8212; <\/strong>\u042d\u0444\u0444\u0435\u043a\u0442\u044b \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (bloom, depth of field, glitch \u0438 \u043f\u0440.)<\/p>\n<pre><code class=\"javascript\">import { Canvas } from '@react-three\/fiber'; import { OrbitControls, Stage } from '@react-three\/drei';  export default function App() {   return (     &lt;Canvas&gt;       &lt;Stage environment=\"city\" intensity={0.6}&gt;         &lt;mesh&gt;           &lt;boxGeometry args={[1, 1, 1]} \/&gt;           &lt;meshStandardMaterial color=\"skyblue\" \/&gt;         &lt;\/mesh&gt;       &lt;\/Stage&gt;       &lt;OrbitControls \/&gt;     &lt;\/Canvas&gt;   ); } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>OrbitControls <\/code>\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043a\u0430\u043c\u0435\u0440\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0446\u0435\u043d\u044b. \u0410 <code>Stage<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0441\u0435\u0442 \u0437\u0430\u0434\u043d\u0435\u0433\u043e \u0444\u043e\u043d\u0430 \u0441 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435\u043c. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u0442\u0430\u043a\u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0430 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 mesh \u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0445\u0443\u043a \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 &#8212; <code>useGLTF<\/code><\/p>\n<pre><code class=\"javascript\">\/\/ ModelViewer.jsx import { useGLTF } from '@react-three\/drei';  export default function ModelViewer(props) {   const { scene } = useGLTF('\/models\/robot.glb');   return &lt;primitive object={scene} scale={1.5} {...props} \/&gt;; }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u043f\u0440\u044f\u043c\u043e \u0432 \u0441\u0446\u0435\u043d\u0443 \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c react \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0445\u0443\u043a \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440 &#8212; <code>useTextures<\/code><\/p>\n<pre><code class=\"javascript\">\/\/ CrateModel.jsx import { useGLTF, useTexture } from '@react-three\/drei'; import * as THREE from 'three';  export default function CrateModel(props) {   \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c   const { nodes } = useGLTF('\/models\/crate.glb');    \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b   const textureProps = useTexture({     map: '\/textures\/crate_diffuse.jpg',     roughnessMap: '\/textures\/crate_roughness.jpg',     normalMap: '\/textures\/crate_normal.jpg',   });    \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440 (\u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e)   Object.values(textureProps).forEach((tex) =&gt; {     tex.wrapS = tex.wrapT = THREE.RepeatWrapping;     tex.repeat.set(1, 1);   });    return (     &lt;mesh       geometry={nodes.Crate.geometry}       {...props}       castShadow       receiveShadow     &gt;       &lt;meshStandardMaterial         {...textureProps}         metalness={0.1}         roughness={1}       \/&gt;     &lt;\/mesh&gt;   ); } <\/code><\/pre>\n<p>\u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0431\u0430\u0437\u0443, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0438\u043a\u0443\u0434\u0430. \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438\u0437\u0431\u0430\u0432\u0438\u043b \u0442\u0435\u0431\u044f \u043e\u0442 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0439, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u044d\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u0436\u0430\u043d\u0440\u0430 \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0438 \u0438 \u0432\u0441\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0447\u0435\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043f\u043d\u0451\u043c \u0433\u043b\u0443\u0431\u0436\u0435: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0430\u043c WebGL \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 Three.js \u0438 \u043a\u0430\u043a \u0432\u0441\u0451 \u044d\u0442\u043e \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0446\u0435\u043d\u0430 \u043d\u0435 \u043b\u0430\u0433\u0430\u043b\u0430 \u0434\u0430\u0436\u0435 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u043a\u0430\u0445. \u0411\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\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\/928072\/\"> https:\/\/habr.com\/ru\/articles\/928072\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u0443 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 3d \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u0443 \u0442\u0435\u0431\u044f \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f js, \u0430 \u0442\u0430\u043a\u0436\u0435 react. \u0422\u0430\u043a\u0436\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c \u0447\u0442\u043e \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f.<\/p>\n<h2>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h2>\n<ul>\n<li>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 threejs<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>Threejs \u0438 React<\/p>\n<\/li>\n<\/ul>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Three.js<\/h2>\n<p>Three.js \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <strong>\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439<\/strong>. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0438\u0445 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<p><strong>\u0421\u0446\u0435\u043d\u0430<\/strong> \u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 (\u043e\u0431\u044a\u0435\u043a\u0442), \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u044b \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0448\u044c \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b: \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044e, \u0441\u0432\u0435\u0442, \u043c\u043e\u0434\u0435\u043b\u0438, \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0438 \u0442.\u043f. <\/p>\n<pre><code class=\"javascript\">const scene = new THREE.Scene(); scene.background = new THREE.Color(0x222222); \/\/ \u0442\u0451\u043c\u043d\u043e-\u0441\u0435\u0440\u044b\u0439 \u0444\u043e\u043d<\/code><\/pre>\n<p><strong>\u041a\u0430\u043c\u0435\u0440\u0430<\/strong> \u2014 \u044d\u0442\u043e \u0433\u043b\u0430\u0437 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0438\u0434\u0438\u0442 \u0441\u0446\u0435\u043d\u0443. \u041e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0432\u043d\u0435 \u043f\u043e\u043b\u044f \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u0430\u043c\u0435\u0440\u044b.<\/p>\n<pre><code class=\"javascript\">const camera = new THREE.PerspectiveCamera(   75,                             \/\/ \u0443\u0433\u043e\u043b \u043e\u0431\u0437\u043e\u0440\u0430 (FOV)   window.innerWidth \/ window.innerHeight, \/\/ \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d   0.1,                            \/\/ \u0431\u043b\u0438\u0436\u043d\u044f\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f   1000                            \/\/ \u0434\u0430\u043b\u044c\u043d\u044f\u044f \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c \u043e\u0442\u0441\u0435\u0447\u0435\u043d\u0438\u044f ); camera.position.set(0, 1, 5); \/\/ \u043a\u0430\u043c\u0435\u0440\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0441 \u0442\u043e\u0447\u043a\u0438 (0, 1, 5)<\/code><\/pre>\n<p><strong>\u0420\u0435\u043d\u0434\u0435\u0440\u0435\u0440<\/strong> \u2014 \u044d\u0442\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0441\u0446\u0435\u043d\u0443 \u0438 \u043a\u0430\u043c\u0435\u0440\u0443 \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u0442.\u0435. \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 HTML-\u044d\u043a\u0440\u0430\u043d\u0435. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u043e 2 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<pre><code class=\"javascript\">const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setSize(window.innerWidth, window.innerHeight); \/\/ \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0432\u044c\u044e\u043f\u043e\u0440\u0442\u0430 document.body.appendChild(renderer.domElement); \/\/ &lt;canvas&gt; \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0432 DOM<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 ? <\/p>\n<p>\u0422\u044b \u2192 \u0441\u043e\u0437\u0434\u0430\u0451\u0448\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u2192 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0448\u044c \u0438\u0445 \u0432 \u0441\u0446\u0435\u043d\u0443<br \/> \u041a\u0430\u043c\u0435\u0440\u0430 \u2192 \u201c\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u201d \u043d\u0430 \u0441\u0446\u0435\u043d\u0443<br \/> \u0420\u0435\u043d\u0434\u0435\u0440\u0435\u0440 \u2192 \u0440\u0438\u0441\u0443\u0435\u0442 \u044d\u0442\u043e \u0432  \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435<\/p>\n<p>\u0422\u0430\u043a \u0430 \u0447\u0442\u043e \u0436\u0435 \u043d\u0430 \u0441\u0447\u0435\u0442 3d \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0440\u0430\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0438 \u0441\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c? \u0414\u0430\u0432\u0430\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0438\u0445 \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0427\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0434\u0435\u043b\u044c ? <\/p>\n<p><strong>3D-\u043c\u043e\u0434\u0435\u043b\u044c<\/strong> \u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0444\u043e\u0440\u043c\u0443, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b, \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>\u041a\u0430\u043a \u0442\u044b \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u043b \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u0414\u0430\u0432\u0430\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0432 \u043d\u0438\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p><strong>\u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f (Geometry) <\/strong>&#8212; \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u0430 \u043c\u043e\u0434\u0435\u043b\u0438: \u0432\u0435\u0440\u0448\u0438\u043d\u044b, \u0433\u0440\u0430\u043d\u0438, \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u0438.<\/p>\n<ul>\n<li>\n<p><strong>\u0412\u0435\u0440\u0448\u0438\u043d\u044b (vertices)<\/strong> \u2014 \u0442\u043e\u0447\u043a\u0438 \u0432 3D-\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0440\u0430\u043d\u0438 (faces)<\/strong> \u2014 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u043e\u0440\u043c\u0430\u043b\u0438<\/strong> \u2014 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u201c\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u201d \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p><strong>UV<\/strong> \u2014 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0443\u0440<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u043e 2 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/p>\n<p><strong>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b (Materials) <\/strong>&#8212; \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c: \u0446\u0432\u0435\u0442, \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>\u0412 Threejs \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u0443\u0436\u0430\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u043b\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 MeshStandardMaterial:<\/p>\n<pre><code class=\"javascript\">const standardMaterial = new THREE.MeshStandardMaterial({   color: 0xffffff,   metalness: 0.8,   roughness: 0.2 });<\/code><\/pre>\n<p><code>MeshStandardMaterial<\/code>, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>color<\/p>\n<\/li>\n<li>\n<p>roughness<\/p>\n<\/li>\n<li>\n<p>metalness<\/p>\n<\/li>\n<li>\n<p>emissive<\/p>\n<\/li>\n<li>\n<p>alpha (\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c)<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 <code>MeshPhysicalMaterial<\/code>, \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 threejs, \u043a \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u0422\u0435\u043a\u0441\u0442\u0443\u0440\u044b (Textures)<\/strong> &#8212; \u044d\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0422\u0438\u043f\u044b \u0442\u0435\u043a\u0441\u0442\u0443\u0440:<\/p>\n<ul>\n<li>\n<p><code>diffuse<\/code> \/ <code>baseColor<\/code> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0432\u0435\u0442<\/p>\n<\/li>\n<li>\n<p><code>normalMap<\/code> \u2014 \u0444\u0435\u0439\u043a\u043e\u0432\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u043b\u044c\u0435\u0444\u0430<\/p>\n<\/li>\n<li>\n<p><code>metalnessMap<\/code>, <code>roughnessMap - \u0431\u043b\u0435\u0441\u043a<\/code><\/p>\n<\/li>\n<li>\n<p><code>aoMap<\/code> \u2014 ambient occlusion (\u0442\u0435\u043d\u0438)<\/p>\n<\/li>\n<li>\n<p><code>emissiveMap<\/code> \u2014 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0430<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">const textureLoader = new THREE.TextureLoader(); const texture = textureLoader.load('\/textures\/wood.jpg'); const material = new THREE.MeshStandardMaterial({ map: texture });<\/code><\/pre>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0441\u0430\u043c\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 <code>GLTFLoader<\/code>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u0435\u0435 \u044d\u043a\u0437\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Loader<\/code> \u0441 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c<\/p>\n<pre><code class=\"javascript\"> import { GLTFLoader } from 'three\/examples\/jsm\/loaders\/GLTFLoader';  const loader = new GLTFLoader(); loader.load('\/models\/robot.glb', (gltf) =&gt; {   scene.add(gltf.scene); }); <\/code><\/pre>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438<\/h2>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u0430 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 3d-\u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u043e\u043c.<\/p>\n<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 threejs \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 (<code>gltf.animations.length &gt; 0<\/code>), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439 <code>THREE.AnimationMixer<\/code>:<\/p>\n<pre><code class=\"javascript\">let mixer; const clock = new THREE.Clock();  loader.load('\/models\/fox.glb', (gltf) =&gt; {   const model = gltf.scene;   scene.add(model);    mixer = new THREE.AnimationMixer(model);    \/\/ \u041f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u0443\u044e \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e   const action = mixer.clipAction(gltf.animations[0]);   action.play(); });  function animate() {   requestAnimationFrame(animate);   const delta = clock.getDelta();   mixer?.update(delta);   renderer.render(scene, camera); } <\/code><\/pre>\n<h2>Threejs \u0438 React<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Three.js \u0432 React \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<p><strong>@react-three\/fiber<\/strong> &#8212; \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 Three.js \u0447\u0435\u0440\u0435\u0437 JSX (\u0430\u043d\u0430\u043b\u043e\u0433 react-dom, \u043d\u043e \u0434\u043b\u044f WebGL)<\/p>\n<p><strong>@react-three\/drei <\/strong>&#8212; \u041d\u0430\u0431\u043e\u0440 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432: OrbitControls, Stage, Text, Gizmo, Loader \u0438 \u0442.\u0434.<\/p>\n<p><strong>@react-three\/postprocessing &#8212; <\/strong>\u042d\u0444\u0444\u0435\u043a\u0442\u044b \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (bloom, depth of field, glitch \u0438 \u043f\u0440.)<\/p>\n<pre><code class=\"javascript\">import { Canvas } from '@react-three\/fiber'; import { OrbitControls, Stage } from '@react-three\/drei';  export default function App() {   return (     &lt;Canvas&gt;       &lt;Stage environment=\"city\" intensity={0.6}&gt;         &lt;mesh&gt;           &lt;boxGeometry args={[1, 1, 1]} \/&gt;           &lt;meshStandardMaterial color=\"skyblue\" \/&gt;         &lt;\/mesh&gt;       &lt;\/Stage&gt;       &lt;OrbitControls \/&gt;     &lt;\/Canvas&gt;   ); } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>OrbitControls <\/code>\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043a\u0430\u043c\u0435\u0440\u0443 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0446\u0435\u043d\u044b. \u0410 <code>Stage<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0441\u0435\u0442 \u0437\u0430\u0434\u043d\u0435\u0433\u043e \u0444\u043e\u043d\u0430 \u0441 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435\u043c. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u0442\u0430\u043a\u0436\u0435 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0430 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 mesh \u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0445\u0443\u043a \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 &#8212; <code>useGLTF<\/code><\/p>\n<pre><code class=\"javascript\">\/\/ ModelViewer.jsx import { useGLTF } from '@react-three\/drei';  export default function ModelViewer(props) {   const { scene } = useGLTF('\/models\/robot.glb');   return &lt;primitive object={scene} scale={1.5} {...props} \/&gt;; }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u043f\u0440\u044f\u043c\u043e \u0432 \u0441\u0446\u0435\u043d\u0443 \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c react \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0445\u0443\u043a \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440 &#8212; <code>useTextures<\/code><\/p>\n<pre><code class=\"javascript\">\/\/ CrateModel.jsx import { useGLTF, useTexture } from '@react-three\/drei'; import * as THREE from 'three';  export default function CrateModel(props) {   \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c   const { nodes } = useGLTF('\/models\/crate.glb');    \/\/ \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u044b   const textureProps = useTexture({     map: '\/textures\/crate_diffuse.jpg',     roughnessMap: '\/textures\/crate_roughness.jpg',     normalMap: '\/textures\/crate_normal.jpg',   });    \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0443\u0440 (\u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e)   Object.values(textureProps).forEach((tex) =&gt; {     tex.wrapS = tex.wrapT = THREE.RepeatWrapping;     tex.repeat.set(1, 1);   });    return (     &lt;mesh       geometry={nodes.Crate.geometry}       {...props}       castShadow       receiveShadow     &gt;       &lt;meshStandardMaterial         {...textureProps}         metalness={0.1}         roughness={1}       \/&gt;     &lt;\/mesh&gt;   ); } <\/code><\/pre>\n<p>\u041c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0431\u0430\u0437\u0443, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0438\u043a\u0443\u0434\u0430. \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438\u0437\u0431\u0430\u0432\u0438\u043b \u0442\u0435\u0431\u044f \u043e\u0442 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0439, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u044d\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u0436\u0430\u043d\u0440\u0430 \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0438 \u0438 \u0432\u0441\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0447\u0435\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043f\u043d\u0451\u043c \u0433\u043b\u0443\u0431\u0436\u0435: \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0430\u043c WebGL \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 Three.js \u0438 \u043a\u0430\u043a \u0432\u0441\u0451 \u044d\u0442\u043e \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0446\u0435\u043d\u0430 \u043d\u0435 \u043b\u0430\u0433\u0430\u043b\u0430 \u0434\u0430\u0436\u0435 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u043a\u0430\u0445. \u0411\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\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\/928072\/\"> https:\/\/habr.com\/ru\/articles\/928072\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-467125","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/467125","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=467125"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/467125\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=467125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=467125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=467125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}