{"id":3303,"date":"2013-01-01T09:02:54","date_gmt":"2013-01-01T15:02:54","guid":{"rendered":"http:\/\/www.realtimerendering.com\/blog\/?p=3303"},"modified":"2014-01-26T19:17:05","modified_gmt":"2014-01-27T01:17:05","slug":"new-years-teapot","status":"publish","type":"post","link":"https:\/\/www.realtimerendering.com\/blog\/new-years-teapot\/","title":{"rendered":"New Year&#8217;s Teapot"},"content":{"rendered":"<p>I&#8217;ve been beavering away on my part of the <a href=\"https:\/\/www.udacity.com\/course\/cs291\">Interactive Rendering course<\/a> for Udacity and Autodesk. It&#8217;s a free <a href=\"http:\/\/en.wikipedia.org\/wiki\/Mooc\">MOOC<\/a> &#8211; massive open online course &#8211; and I&#8217;ll talk more about what I learned from doing it when the course nears completion. For now, the main takeaway I have is &#8220;<a href=\"http:\/\/www.khronos.org\/webgl\/\">WebGL<\/a> plus <a href=\"http:\/\/mrdoob.github.com\/three.js\/\">three.js<\/a> is a pretty good combination for teaching graphics on the web.&#8221; The fact that WebGL is built into most browsers (sad slow head-shake to Microsoft Internet Explorer at this point) means you can point a student to an URL and they can immediately see and play with an interactive demo. Three.js is a scene graph library which simplifies for the student the mass of initialization and whatnot that WebGL requires, while also not hiding a lot of functionality from the programmer (like some scene graphs do). Bonus bit is that the Chrome browser has a JavaScript debugger built in (just hit F12 or ctrl-shift-I to toggle it on), so students can always look at the underlying code.<\/p>\n<p>So, here&#8217;s my New Year&#8217;s thingy for you to try out:<\/p>\n<p><strong><a href=\"http:\/\/www.realtimerendering.com\/teapot\/index_new.html\">The Teapot<\/a><\/strong> &#8211; nicer controller, not currently working on mobile<\/p>\n<p><strong><a href=\"http:\/\/www.realtimerendering.com\/teapot\/\" target=\"_blank\">The Teapot<\/a>\u00a0&#8211;\u00a0<\/strong>semi-mobile friendly, annoying trackball<\/p>\n<p>[Mac\/Safari users: follow <a href=\"http:\/\/www.khronos.org\/webgl\/wiki\/Implementations\/WebKit\" target=\"_blank\">these simple instructions<\/a> to enable WebGL on your machine. Other users: if stuck, try <a href=\"http:\/\/get.webgl.org\/\">this site<\/a>.]<\/p>\n<p>Nothing deep, as it&#8217;s meant for teaching about Gouraud vs. Phong shading: the mouse changes the view (left: trackball, right: pan, middle: zoom), there are a few keyboard controls to switch from vertex to pixel shading and change the tessellation, a GUI for messing with the model and scene, and a little FPS counter in the corner. If the mouse or GUI doesn&#8217;t work the first time, hit refresh (and if anyone knows a fix for this glitch, speak!). If you see the FPS counter consistently below 60 FPS for your machine, please <a href=\"mailto:erich@acm.org\" target=\"_blank\">let me know<\/a> your hardware configuration. The heresies I commit in this program:<\/p>\n<ul>\n<li>You can add a bottom to the teapot (<a href=\"http:\/\/www.sjbaker.org\/wiki\/index.php?title=The_History_of_The_Teapot\" target=\"_blank\">SJ Baker&#8217;s excellent page<\/a> considers this a major sin).<\/li>\n<li>You can expand the lid 7.7% horizontally to give a solid seal between the teapot and the lid (this gap looks goofy to unbelievers).<\/li>\n<li>You can scale the model up by 30% so it actually looks more like the real teapot (read <a href=\"http:\/\/www.sjbaker.org\/wiki\/index.php?title=The_History_of_The_Teapot#The_Teapot_DataSet\" target=\"_blank\">the end of this section<\/a> for one explanation of why the model was changed &#8211; short version: Blinn hack to adjust for non-square pixels).<\/li>\n<\/ul>\n<div>Comments appreciated!<\/div>\n<div><\/div>\n<p><a href=\"http:\/\/www.realtimerendering.com\/teapot\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-large wp-image-3325\" title=\"teapot demo\" alt=\"\" src=\"http:\/\/www.realtimerendering.com\/blog\/wp-content\/uploads\/2013\/01\/teapot_demo1-1024x550.jpg\" width=\"1024\" height=\"550\" srcset=\"https:\/\/www.realtimerendering.com\/blog\/wp-content\/uploads\/2013\/01\/teapot_demo1-1024x550.jpg 1024w, https:\/\/www.realtimerendering.com\/blog\/wp-content\/uploads\/2013\/01\/teapot_demo1-300x161.jpg 300w, https:\/\/www.realtimerendering.com\/blog\/wp-content\/uploads\/2013\/01\/teapot_demo1.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been beavering away on my part of the Interactive Rendering course for Udacity and Autodesk. It&#8217;s a free MOOC &#8211; massive open online course &#8211; and I&#8217;ll talk more about what I learned from doing it when the course nears completion. For now, the main takeaway I have is &#8220;WebGL plus three.js is a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[420,547,523],"class_list":["post-3303","post","type-post","status-publish","format-standard","hentry","category-resources","tag-teapot","tag-three-js","tag-webgl"],"_links":{"self":[{"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/posts\/3303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/comments?post=3303"}],"version-history":[{"count":25,"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/posts\/3303\/revisions"}],"predecessor-version":[{"id":3773,"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/posts\/3303\/revisions\/3773"}],"wp:attachment":[{"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/media?parent=3303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/categories?post=3303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.realtimerendering.com\/blog\/wp-json\/wp\/v2\/tags?post=3303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}