{"id":44927,"date":"2018-11-25T08:05:12","date_gmt":"2018-11-25T13:05:12","guid":{"rendered":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=44927"},"modified":"2018-11-25T08:06:27","modified_gmt":"2018-11-25T13:06:27","slug":"ray-tracing-is-here-apparently","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=44927","title":{"rendered":"Ray Tracing Is Here. Apparently."},"content":{"rendered":"<p>I just got done recording the Diecast. At one point Paul and I answered a question regarding where game engines might go next. On the show, I predicted that ray tracing was the next big thing, but we weren&#8217;t there yet.\u00a0 I was thinking of a couple of videos from a few years ago like <a href=\"https:\/\/www.youtube.com\/watch?v=BpT6MkCeP7Y\">this one<\/a> and <a href=\"https:\/\/www.youtube.com\/watch?v=aKqxonOrl4Q\">this one<\/a>. Those are from 2013 and 2014. It looked promising, but it was clear the technology wasn&#8217;t quite ready yet.<\/p>\n<p>But then I discovered that I was completely wrong. Ray tracing isn&#8217;t a couple of years off. It&#8217;s here. It&#8217;s happening right now. Check out this video, which shows off some footage from <em>Battlefield V<\/em> and <em>Metro: Exodus:<\/em><\/p>\n<p><table class='nomargin' cellspacing='0' width='100%' cellpadding='0' align='center' border='0'><tr><td><iframe loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/www.youtube.com\/embed\/VK7lL3E2LVc\" frameborder=\"0\" allowfullscreen class=\"embed\"><\/iframe><br\/><small><a href='http:\/\/www.youtube.com\/watch?v=VK7lL3E2LVc'>Link (YouTube)<\/a><\/small><\/td><\/tr><\/table><\/p>\n<p>To be fair, this isn&#8217;t full ray tracing. From what the devs have said, this is a sort of half-step between what we&#8217;ve been doing and full ray tracing.<\/p>\n<p>Here&#8217;s how it&#8217;s worked in the past&#8230;\u00a0<!--more--><\/p>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/hl2_wireframe.jpg' width=100% alt='Call me a graphics hipster, but Half-Life 2 still looks fantastic to me.' title='Call me a graphics hipster, but Half-Life 2 still looks fantastic to me.'\/><\/div><div class='mouseover-alt'>Call me a graphics hipster, but Half-Life 2 still looks fantastic to me.<\/div><\/p>\n<p>We used triangles. All the crap in the world is made out of triangles, and we draw them to the screen. It&#8217;s that simple. Well, not &#8220;simple&#8221;. It&#8217;s still a monumentally complex process that&#8217;s challenging even to people with genius-level IQs, so I guess calling it simple isn&#8217;t really fair. A lot of sorcery goes on between the point where the game loads all the polygons into a buffer and the moment where it shows up on your monitor. Still, it&#8217;s <em>conceptually<\/em> simple. You can think of those triangles like brush strokes on a canvas. Some of them are drawn over others, and the image is built up like this until it&#8217;s ready for your eyeballs.<\/p>\n<p>For contrast, ray tracing<span class='snote' title='1'>There&#8217;s ray tracing and\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Path_tracing\">path tracing<\/a>, but the differences between the two are too subtle for this discussion. (Also, I&#8217;m too lazy to research those differences right now.)<\/span> draws each pixel on the screen exactly once. For each pixel, it projects a ray outwards from the camera, seeing if that ray collides with any of the stuff in the scene. It bounces this ray from surface to surface, adding information to this particular pixel&#8217;s lighting calculation.<\/p>\n<p>Based on what the developers are saying in these presentations, it sounds like they&#8217;re combining these two methods. The <em>lighting<\/em> is ray traced, but the polygons&#8230; aren&#8217;t? I don&#8217;t know. I&#8217;m having trouble picturing how this is supposed to work because I&#8217;m so far out of my depth.<\/p>\n<p>I will say that while <em>Battlefield V<\/em> and <em>Metro: Exodus<\/em>\u00a0look impressive, they don&#8217;t have that same impact you get from fully ray traced scenes.\u00a0 This stuff looks cutting edge, but you can tell it&#8217;s not a photograph. I see two big improvements with this new system:<\/p>\n<ol>\n<li>The reflections are as sharp as the rest of the scene and aren&#8217;t approximations. I guess this means games might start giving us mirrors again.<\/li>\n<li>As the Metro demo showed, dark corners won&#8217;t be over-illuminated. The way we do things now, we have a system based on hard shadows. If you look under a bed, then the area hit by the room light will be bright and the area in shadow will be uniform. In the real world, areas directly under the bed should be very dark, while the area near the edge should be a little brighter due to secondary illumination. Light bounces off the walls and lights up those shadows, but the deeper you go the less of that secondary light will reach.This probably sounds like obsessing over a trivial detail, but this is one of those things that makes the lighting look a bit&#8230; odd. It also sucks the contrast out of the scene because you don&#8217;t get any deep dark corners. The spot of floor at the back of the closet is getting just as much ambient light as the spot on the wall where your hand is casting a tiny shadow.\u00a0Programmers have spent the last few years cooking up ways to hide this problem. If you&#8217;ve ever seen &#8220;ambient occlusion&#8221; in the graphics options, that&#8217;s what this was about. Between that and making shadows blurry, they&#8217;ve managed to make a system that looks pretty good.<\/li>\n<\/ol>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/render_radiosity.jpg' width=100% alt='On the left is the simple brute-force lighting system like we&apos;ve been using. (Except today programmers would fuzz the shadow edges a bit.) On the right is the more nuanced system that takes the environment into account.' title='On the left is the simple brute-force lighting system like we&apos;ve been using. (Except today programmers would fuzz the shadow edges a bit.) On the right is the more nuanced system that takes the environment into account.'\/><\/div><div class='mouseover-alt'>On the left is the simple brute-force lighting system like we&apos;ve been using. (Except today programmers would fuzz the shadow edges a bit.) On the right is the more nuanced system that takes the environment into account.<\/div><\/p>\n<p>Anyway, just a heads up that my talk during tomorrow&#8217;s podcast is going to be drawing from information that&#8217;s about 4 years out of date.<\/p>\n<p>Dear games industry: <em>Good job. That&#8217;s nice, but don&#8217;t make me upgrade my graphics card for this. It&#8217;s nice and all, but it&#8217;s not &#8220;five hundred and ninety-nine U.S. dollars&#8221; nice.<\/em><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just got done recording the Diecast. At one point Paul and I answered a question regarding where game engines might go next. On the show, I predicted that ray tracing was the next big thing, but we weren&#8217;t there yet.\u00a0 I was thinking of a couple of videos from a few years ago like [&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-44927","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\/44927","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=44927"}],"version-history":[{"count":9,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/44927\/revisions"}],"predecessor-version":[{"id":44938,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/44927\/revisions\/44938"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}