{"id":49740,"date":"2020-04-14T09:47:11","date_gmt":"2020-04-14T13:47:11","guid":{"rendered":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=49740"},"modified":"2020-04-16T03:20:03","modified_gmt":"2020-04-16T07:20:03","slug":"no-content-today-except-for-this","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=49740","title":{"rendered":"No content today. Except for this."},"content":{"rendered":"<p>This no-content post is brought to you by sloth, incompetence, and malfeasance. I have lots of content in the pipeline, but I recently got sidetracked by a project that I figured ought to take &#8220;a few hours&#8221;, and has now devoured much, much more than a few hours.<\/p>\n<p>It all started when my son Issac showed me a <a href=\"https:\/\/gmod.facepunch.com\/\">Garry&#8217;s Mod<\/a> level he was working on&#8230;<\/p>\n<p><!--more--><\/p>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/basalt2.jpg' width=100% alt='This is what it looks like in Garry&apos;s Mod.' title='This is what it looks like in Garry&apos;s Mod.'\/><\/div><div class='mouseover-alt'>This is what it looks like in Garry&apos;s Mod.<\/div><\/p>\n<p>I thought this looked really cool. We started talking about what you could do with this. Eventually I got the idea in my head to load this map in Unity. That seemed like a fun afternoon project. After all, Gmod uses the Source Engine 2 BSP format, which is based on the Source Engine format, which is based on, no kidding, <em>Quake 2<\/em>. That engine is literally older than Issac. Some of the games that use these maps are open source. It should be trivial<span class='snote' title='1'>Famous last words.<\/span> to load that into a modern setting and render it. I might need to flip some coordinates around or do a little scaling to get the map right-side-up and sized properly, but that&#8217;s easy. I can probably bash this out in a couple of hours.<\/p>\n<h3>Days Later&#8230;<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/basalt1.jpg' width=100% alt='Still Garry&apos;s Mod. ' title='Still Garry&apos;s Mod. '\/><\/div><div class='mouseover-alt'>Still Garry&apos;s Mod. <\/div><\/p>\n<p>So I underestimated this project by an order of magnitude or so. The main problems were:<\/p>\n<ol>\n<li>It&#8217;s been like 18 months or so since the last time I looked at Unity. I never fail to be amazed at how much you can forget in that span of time. I spent ages stumbling around, Googling things, and then slapping myself in the forehead saying, &#8220;Oh, right, right. THAT&#8217;S how that works.&#8221; It&#8217;s exactly like being a newbie where you don&#8217;t know what you&#8217;re doing, but then when you look it up you feel dumb because you realize you used to know this.<\/li>\n<li>Yes, it&#8217;s good when technology is old because that means the documents are mature and all the likely pitfalls have been documented and explained on StackOverflow. But that only helps up to a certain point. If something is TOO old, then modern knowledge-sharing sites won&#8217;t cover it and all the docs are 404 links. <a href=\"https:\/\/developer.valvesoftware.com\/wiki\/Source_BSP_File_Format\">This is the only document I could find<\/a>. It&#8217;s good, but it&#8217;s not detailed enough to work as a full spec. There are some very important details that it leaves out and that can&#8217;t be intuited or guessed.<\/li>\n<li>Yes, being old is good because graphics engines were simpler 23 years ago. They didn&#8217;t have to contend with shaders or any of the complex modern lighting systems. It was just a bunch of polygons that you shove over to the GPU. Kid&#8217;s stuff, by today&#8217;s standards. HOWEVER, those games were ALSO pushing up against the hardware limitations of later-90s devices and so they had lots of optimizations that would be pointless (or even counterproductive!) by today&#8217;s standards, but which make the code very hard to follow. Yes, a ground-up implementation of Quake 2 would be easy to do today, but the versions of yesteryear needed to be much more complex, and that complexity makes it seem very convoluted.<\/li>\n<\/ol>\n<p>This was all very clear after the first couple of hours. At that point a responsible man would shelve the project and get back to work on the blog. This was obviously turning into a boondoggle and I had more important things to work on. (Like, for example, content for this blog.) But at that point I just couldn&#8217;t let it go. I wasn&#8217;t working on it because I needed to see a BSP in Unity. I wasn&#8217;t working on it because I had a brilliant idea for a game. I was working on it because I couldn&#8217;t rest until I&#8217;d solved the problem.<\/p>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/basalt3.jpg' width=100% alt='Here is my re-creation of the source engine! Just kidding. This is still Garry&apos;s Mod. My results are... not this good.' title='Here is my re-creation of the source engine! Just kidding. This is still Garry&apos;s Mod. My results are... not this good.'\/><\/div><div class='mouseover-alt'>Here is my re-creation of the source engine! Just kidding. This is still Garry&apos;s Mod. My results are... not this good.<\/div><\/p>\n<p>I&#8217;m not going to do the math and figure out how much time I threw into this hole, but it was more than a reasonable person would spend on a project with no particular goal beyond, &#8220;It might be cool if I did this.&#8221; After $unreasonable_number of hours, I FINALLY managed to read the geometry, figure out how the polygons were formed, get them all facing the right way, and sort out the surface normals.<\/p>\n<p>The result?<\/p>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/basalt4.jpg' width=100% alt='This is the best I could do. Maybe if I throw more time at it, it could look slightly better.' title='This is the best I could do. Maybe if I throw more time at it, it could look slightly better.'\/><\/div><div class='mouseover-alt'>This is the best I could do. Maybe if I throw more time at it, it could look slightly better.<\/div><\/p>\n<p>The other thing that ate a bunch of time is that I was a fool and tried to use Unity&#8217;s new raytracing system. I&#8217;ve said before that Unity&#8217;s docs are always criminally incomplete. The docs will tell you 75% of what you need to know, but then that last 25% is folk knowledge that you can only obtain by pleading for help from other users.<\/p>\n<p>If that&#8217;s the state of their regular documents, then you can imagine what a patchwork the beta documentation is. I slammed my head against this problem for about half a day, just trying to render a simple box room with a few small objects and a couple of light sources. Everything the engine was doing claimed that it was raytracing, but it was very obviously still using current-gen shadow volumes and regular shaders. Also, sometimes the docs talked about &#8220;raytracing&#8221; and other times it talked about &#8220;path tracing&#8221;. Now, from the point of view of the gaming public, it&#8217;s 100% okay to use these terms interchangeably. That&#8217;s fine. I do it myself. You can&#8217;t afford to stop and explain to Joe and Jane gamer the difference between the two every time the topic comes up. But I feel strongly that if you&#8217;re making an engine for developers, then you should be 100% clear about what the engine is supposed to be doing.<\/p>\n<p>As an example of what a disaster area the docs \/ tutorials are. You get exactly one example project of raytracing \/ path tracing. If you open it in the latest version of Unity, then Unity will complain that it was built using an older version of the platform and might not work. (Which is true. It doesn&#8217;t render properly.) So then you download the previous version of Unity. That version claims the project is too NEW, and it won&#8217;t even compile. So the one example program they offer is for some in-between version of Unity that is no longer available. I&#8217;m sure you could fix the demo program, <strong>if you already knew how it was supposed to work<\/strong>. But since the point of this project is to teach you that, you wind up with a chicken vs. egg problem.<\/p>\n<p>In the end, I threw away all the raytracing stuff. It&#8217;s obviously not ready for casual inspection, even by hobbyists. I&#8217;m sure it&#8217;ll be ready for general use in another couple of months, and the documentation will be done in the next decade or so. Maybe I&#8217;ll try again if I live to be 60.<\/p>\n<p>Anyway. That&#8217;s why you didn&#8217;t get a post today.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This no-content post is brought to you by sloth, incompetence, and malfeasance. I have lots of content in the pipeline, but I recently got sidetracked by a project that I figured ought to take &#8220;a few hours&#8221;, and has now devoured much, much more than a few hours. It all started when my son Issac [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[],"class_list":["post-49740","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/49740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49740"}],"version-history":[{"count":8,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/49740\/revisions"}],"predecessor-version":[{"id":49748,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/49740\/revisions\/49748"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}