<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kathy Pangtay on Medium]]></title>
        <description><![CDATA[Stories by Kathy Pangtay on Medium]]></description>
        <link>https://medium.com/@kpangtay?source=rss-eca20fa89701------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_ZQ1Yn4LHd-tIath</url>
            <title>Stories by Kathy Pangtay on Medium</title>
            <link>https://medium.com/@kpangtay?source=rss-eca20fa89701------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 02:06:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kpangtay/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[An Introduction to three.js]]></title>
            <link>https://medium.com/@kpangtay/an-introduction-to-three-js-499b9926e2b0?source=rss-eca20fa89701------2</link>
            <guid isPermaLink="false">https://medium.com/p/499b9926e2b0</guid>
            <category><![CDATA[3d-models]]></category>
            <category><![CDATA[threejs]]></category>
            <category><![CDATA[introduction]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[rendering]]></category>
            <dc:creator><![CDATA[Kathy Pangtay]]></dc:creator>
            <pubDate>Tue, 14 Aug 2018 01:46:56 GMT</pubDate>
            <atom:updated>2018-08-14T03:20:58.050Z</atom:updated>
            <content:encoded><![CDATA[<p>The JavaScript library <a href="https://threejs.org/">three.js</a> allows you to create in 3D without having to know how to use a modeling software like Maya or Blender on the web. It allows the user to access WebGL in a more intuitive way. WebGL is a JavaScript API for rendering interactive 3D and 2D graphics within a web browser on a<strong>&lt;canvas&gt;</strong> element.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F4yApij9x6qdri%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fthreejs-4yApij9x6qdri&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F4yApij9x6qdri%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="329" frameborder="0" scrolling="no"><a href="https://medium.com/media/099d8ddb339bd2d31da0d95a9ac4469d/href">https://medium.com/media/099d8ddb339bd2d31da0d95a9ac4469d/href</a></iframe><h4>The Basics:</h4><p>A basic three.js project is made up of a scene, camera, and renderer.</p><p>But first we need to add some HTML to a file in order to display your project.</p><pre>&lt;!DOCTYPE html&gt; <br>&lt;html&gt;  <br>   &lt;head&gt;   <br>       &lt;meta charset=utf-8&gt;   <br>       &lt;title&gt;My first three.js app&lt;/title&gt;   <br>       &lt;style&gt;    <br>           body { margin: 0; }    <br>           canvas { width: 100%; height: 100% }   <br>       &lt;/style&gt;  <br>   &lt;/head&gt;  <br>   &lt;body&gt;   <br>       &lt;script src=&quot;js/three.js&quot;&gt;&lt;/script&gt;   <br>       &lt;script&gt;    <br>          // Our Javascript will go here.   <br>       &lt;/script&gt;  <br>   &lt;/body&gt; <br>&lt;/html&gt;</pre><p><strong>Setting up a scene</strong></p><ul><li>Creating an empty scene, which will be similar to a container that will hold every object you want to render in Three.js.</li><li>The camera selection is dependent on whether the camera needs to be static or is meant to move with the object. The <strong>PerspectiveCamera</strong> takes multiple parameters which are the field of view, the aspect ratio, and the near and far clipping plane.</li><li>Three.js supports multiple renderers but the most commonly used is the <strong>WebGLRenderer</strong>. It is passed the size of the window as a parameter and then appended to the DOM.</li></ul><pre>var scene = new THREE.Scene(); </pre><pre>var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );  </pre><pre>var renderer = new THREE.WebGLRenderer(); <br>renderer.setSize( window.innerWidth, window.innerHeight ); document.body.appendChild( renderer.domElement );</pre><p><strong>Adding an object</strong></p><p>Three.js has a great amount of ready to use objects like a cube, sphere, a torus, a cylinder, and a plane. Triangles are the base for almost everything that is modeled or created. It is created by grouping three vertices together to create a face.</p><p>For an easy example on how to add an object. Let’s just create a basic cube mesh. A mesh is made up of geometry and a material. To create a cube’s geometry we need to use <strong>BoxGeometry </strong>which takes three parameters of the three dimensions of the box. For the material which can be either a <strong>MeshBasicMaterial, MeshLambertMaterial, MeshPhongMaterial, or MeshNormalMaterial </strong>for our code we want to use the <strong>MeshBasicMaterial </strong>which draws an un-shaded single color.</p><pre>var geometry = new THREE.BoxGeometry( 1, 1, 1 ); <br>var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); var cube = new THREE.Mesh( geometry, material ); <br>scene.add( cube );  </pre><pre>camera.position.z = 5;</pre><p>All the code snippets come directly from the three.js documentation.</p><p><strong>Conclusion</strong></p><p>I think that three.js is a great tool to accomplish some pretty interesting projects. I hope this blogpost helped at least some of you make the first step towards starting a fun and new project.</p><p><strong>If you need some inspiration for you first project</strong></p><ul><li><a href="https://tympanus.net/Tutorials/TheAviator/">The Aviator: The Game | Codrops</a></li><li><a href="https://paperplanes.world/">Paper Planes</a></li><li><a href="https://throughthedark.withgoogle.com/">Hilltop Hoods and Google Play Music present Through the Dark.</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=499b9926e2b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>