{"id":120572,"date":"2020-11-12T16:01:00","date_gmt":"2020-11-12T16:01:00","guid":{"rendered":"http:\/\/www.gamasutra.com\/view\/news\/373651"},"modified":"2020-11-12T16:01:00","modified_gmt":"2020-11-12T16:01:00","slug":"the-bright-side-of-ray-traced-global-illumination","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2020\/11\/12\/the-bright-side-of-ray-traced-global-illumination\/","title":{"rendered":"The bright side of ray-traced global illumination"},"content":{"rendered":"<p> <!-- Google Tag Manager --> <!-- End Google Tag Manager --> &lt;!&#8211;  &#8211;&gt;  <title>Gamasutra: Ruben Torres Bonet&#8217;s Blog &#8211; The Bright Side of Ray-Traced Global Illumination<\/title>   <!--[if lt IE 9]&gt; <a href=\"http:\/\/html5shim.googlecode.com\/svn\/trunk\/html5.js\">http:\/\/html5shim.googlecode.com\/svn\/trunk\/html5.js<\/a> &lt;![endif]--> <!-- CSS -->                    <!-- link href=\"https:\/\/twimgs.com\/gamasutra\/css\/minified.css\" rel=\"stylesheet\" type=\"text\/css\" \/ -->    <!-- Mobile Specific Metas -->  <!-- Start Visual Website Optimizer Asynchronous Code --> <!-- End Visual Website Optimizer Asynchronous Code --> <!-- Start HeatMap.me Code --> <!-- End HeatMap.me Code --> <!-- Start: GPT Sync --> <!-- End: GPT -->  <!-- Twitter universal website tag code --> <!-- End Twitter universal website tag code --> <!-- Facebook Pixel Code -->  <!-- DO NOT MODIFY --> <!-- End Facebook Pixel Code -->   <!-- Eloqua tracking code --> <!-- End Eloqua tracking code -->  <!-- Google Tag Manager (noscript) -->  <!-- End Google Tag Manager (noscript) --> <!--Cookie banner code starts here --> <!--Cookie banner code ends here --> <!-- Informa Branding code goes here--> <\/p>\n<div id=\"iribbon-container\" class=\"content-body-wrapper\"> <button id=\"iribbon-title\" title=\"show\/hide\" class=\"inactive\">Informa<\/button> <\/p>\n<div id=\"iribbon-detail\" class=\"ribbon-hide\">\n<div id=\"iribbon-left\">\n<p>Gamasutra is part of the Informa Tech Division of Informa PLC<\/p>\n<\/p><\/div>\n<div id=\"iribbon-right\">\n<p>This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC&#8217;s registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.<\/p>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p> <!-- Informa Branding code goes here--> <!-- Beginning Sync AdSlot 19 for Ad unit Gamasutra\/\/consolepc ### size: [[2,2]] --> <!-- End AdSlot 19 --> <!-- Beginning Sync AdSlot 20 for Ad unit Gamasutra\/\/consolepc ### size: [[7,7]] --> <!-- End AdSlot 20 --> <\/p>\n<div class=\"container\">\n<div id=\"container-main\" class=\"content-body-wrapper\"> <!-- Google Prestitial Ads start here--> <!-- Google Prestitial Ads end here--> <\/p>\n<div class=\"container bottom3\">\n<div class=\"span-7\"> <a href=\"https:\/\/www.gamasutra.com\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination.png\" alt=\"Gamasutra: The Art &amp; Business of Making Games\" width=\"243\" height=\"77\" border=\"0\"><\/a><img decoding=\"async\" alt=\"spacer\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination.gif\" width=\"27\"> <\/div>\n<\/p><\/div>\n<div class=\"span-20\"> <!--end show phone--> <!--end showphone--> <!--end nav--> <\/p>\n<div class=\"span-20 last content_bg\">\n<div class=\"hide-phone\">\n<div class=\"span-4\">\n<div class=\"content_box_left\">\n<div class=\"leftcol\"> <!--member login--> <!--end memberlogin--> <!--begin social icons--> <!--begin social icons--> <!--end social icons--> <!--end social icons--> <!--begin page numbers--> <!--end page numbers--> <!--begin leftnav--> <!--end leftnav--> <!-- Beginning Sync AdSlot 3 for Ad unit Gamasutra\/\/consolepc ### size: [[164,59]] --> <!-- End AdSlot 3 --> <!-- Beginning Sync AdSlot 4 for Ad unit Gamasutra\/\/consolepc ### size: [[164,59]] --> <!-- End AdSlot 4 --> <!-- Beginning Sync AdSlot 5 for Ad unit Gamasutra\/\/consolepc ### size: [[164,409]] --> <!-- End AdSlot 5 --> <!-- Beginning Sync AdSlot 9 for Ad unit Gamasutra\/\/consolepc ### size: [[164,177]] --> <!-- End AdSlot 9 --> <!-- Beginning Sync AdSlot 11 for Ad unit Gamasutra\/\/consolepc ### size: [[164,177]] --> <!-- End AdSlot 11 --> <!-- begin event tickers --> <!-- end event tickers --> <!--begin jobs--> <!--end jobs--> <!--begin blogs--> <!--end blogs--> <!--begin press releases--> <!--end press releases--> <!--begin calendar--> &lt;!&#8211; <\/p>\n<div class=\"header\"><img decoding=\"async\" alt=\"arrow\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-1.png\" width=\"22px\" height=\"20px\" \/><a href=\"http:\/\/www.gamasutra.com\/calendar\/calendar.php\">Calendar<\/a><\/div>\n<div class=\"leftnav bottom2\"> <a href=\"http:\/\/www.gamasutra.com\/calendar\/calendar.php\"><strong>View All<\/strong><\/a> &nbsp;&nbsp;&nbsp; <a href=\"http:\/\/www.gamasutra.com\/calendar\/calendar_submit.php\"><strong>Submit Event<\/strong><\/a> <\/p>\n<hr>\n<ul> <\/ul>\n<\/div>\n<p> &#8211;&gt; <!--end calendar--> <!--begin about--> <\/p>\n<div class=\"bottom2\"> <a href=\"https:\/\/www.gamasutra.com\/advertise\"> <img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination.jpg\" alt=\"Sponsor\" border=\"0\" class=\"whiteTop\" width=\"177px\" height=\"60px\"> <\/a>\n<\/div>\n<p> <!--end about--> <!--begin network--> <\/p>\n<div class=\"leftnav_network bottom2\"> If you enjoy reading this site, you might also want to check out these UBM Tech sites: <\/p>\n<hr>\n<hr>\n<p> <br class=\"clear\">\n<\/div>\n<p> <!--end network--> <!--begin store--> <!--end store--> <\/div>\n<p><!--end leftcol--> <\/div>\n<\/div><\/div>\n<div class=\"span-16 last\">\n<div class=\"content_box_middle\"> <!-- InstanceBeginEditable name=\"BodyContent\" --> <\/p>\n<div class=\"page_item\">\n<div><a name=\"twitter_share\" href=\"http:\/\/twitter.com?status=RT @gamasutra: The Bright Side of Ray-Traced Global Illumination http:\/\/www.gamasutra.com\/blogs\/RubenTorresBonet\/20201110\/373493\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-1.gif\" alt=\"Share on Twitter\" border=\"0\" height=\"20\"><\/a>  <span id=\"edit_post_link\"><\/span>&nbsp;&nbsp; <a href=\"https:\/\/www.gamasutra.com\/blogs\/rss\/\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-2.gif\" width=\"15\" height=\"15\" border=\"0\" alt=\"RSS\"><\/a> <\/div>\n<hr>\n<div class=\"item_body mobile_image_transform\"> <strong><i><small> The following blog post, unless otherwise noted, was written by a member of Gamasutra\u0092s community.<br \/>The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company. <\/small><\/i><\/strong> <\/p>\n<hr>\n<p data-css=\"tve-u-1758046d6be\"><strong>[Recommended: read the original&nbsp;blog post &#8220;<a href=\"https:\/\/go.thegamedev.guru\/rt-global-illumination\">Unity ray-traced global illumination<\/a>&#8221;&nbsp;for proper interactive content]<\/strong><\/p>\n<p data-css=\"tve-u-1758046d6be\">Let&#8217;s get back to ray tracing with global illumination in Unity. Discover what global illumination is and choose the better fit for your game:<\/p>\n<ul>\n<li><strong>Baked GI<\/strong><\/li>\n<li><strong>Screen-space Raster GI<\/strong><\/li>\n<li><strong>Screen-Space Ray-traced GI<\/strong><\/li>\n<\/ul>\n<p><img decoding=\"async\" alt data-height=\"439\" data-id=\"9723\" data-init-height=\"608\" data-init-width=\"1080\" data-width=\"780\" height=\"338\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-3.gif\" title=\"Unity-Ray-Tracing-Global-Illumination-Thumbnail\" width=\"600\"><\/p>\n<p><strong>TABLE OF CONTENTS<\/strong><\/p>\n<p>1&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#t-1604169170145\">Can You Guess What&#8217;s Missing in This Scene?<\/a><\/p>\n<p>2&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#t-1604169170146\">What&#8217;s Unity Global Illumination?<\/a><\/p>\n<p>3&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#t-1604169170147\">Your Options for Global Illumination in Unity<\/a><\/p>\n<p>&nbsp; 3.1&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#t-1604169170148\">Unity Baked Global Illumination<\/a><\/p>\n<p>&nbsp; 3.2&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#t-1604169170149\">Unity Screen-Space Global Illumination (SSGI)<\/a><\/p>\n<p>&nbsp; 3.3&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#t-1604169170150\">Ray-Traced Global Illumination in Unity<\/a><\/p>\n<p>4&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#t-1604169170151\">The Performance Cost of Ray-Traced Global Illumination in Unity<\/a><\/p>\n<p>5&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#t-1604169170152\">Next Steps<\/a><\/p>\n<h2 id=\"t-1604169170145\">Can You Guess What&#8217;s Missing in This Scene?<\/h2>\n<p>Take a second to have a look at the screenshot below.<\/p>\n<p>Can you guess what is this picture missing to be&#8230; visually &#8220;appealing&#8221;?<\/p>\n<p><img decoding=\"async\" alt data-height=\"439\" data-id=\"2075\" data-init-height=\"312\" data-init-width=\"300\" data-width=\"780\" height=\"338\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-2.png\" width=\"600\"><\/p>\n<p>It&#8217;s looking either too bright or too dark. That&#8217;s not an easy thing to see in real life.<\/p>\n<p>Why?<\/p>\n<p>Because light bounces between surfaces.<\/p>\n<p>These bounces soften the &#8220;transitions&#8221; between bright and dark areas. And you don&#8217;t see that happening in the screenshot above.&nbsp;<\/p>\n<p>Now, let&#8217;s see something more realistic.<\/p>\n<p>Have a look below. Use <a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi1\">the slider<\/a> to transition to a more &#8220;visually correct&#8221; scene:<\/p>\n<p data-css=\"tve-u-1757ff0e4e2\"><a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi1\"><strong>Is Global Illumination Overrated? (Answer: NO)<\/strong><\/a><\/p>\n<p><a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi1\"><img decoding=\"async\" height=\"338\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-3.png\" width=\"600\"><\/a><\/p>\n<p>What&#8217;s the difference?<\/p>\n<p>Global illumination (GI). To be more specific, indirect illumination.<\/p>\n<p>Let&#8217;s quickly explain how GI works.<\/p>\n<h2 id=\"t-1604169170146\">What&#8217;s Unity Global Illumination?<\/h2>\n<p>Like I said, light rays bounce off surfaces and lose energy in the process (e.g. brightness, a change in color, etc.). Eventually, light will reach your eyes from different surfaces.<\/p>\n<p>In graphics, we distinguish between:<\/p>\n<ul>\n<li><strong>Direct lighting<\/strong>: the sun light hits the floor and reflects into your eyes. That lets you see that specific fragment on the floor.<\/li>\n<li><strong>Indirect lighting<\/strong>: the sun light hits the floor, bounces to your hand watch&nbsp;<strong>and then<\/strong>&nbsp;bounces towards someone&#8217;s eyes. That person becomes temporarily stunned.<\/li>\n<\/ul>\n<p>The difference is that GI takes more bounces into account. Not just one.<\/p>\n<p>Direct lighting is easy and cheap to calculate. Indirect lighting, not so much.<\/p>\n<p>So, how do you do indirect lighting* in Unity?<\/p>\n<p>Here are your options.<\/p>\n<p><em>* I use the words indirect lighting and global illumination interchangeably. In theory, they&#8217;re not the same. But in practice, we treat them as if they were.<\/em><\/p>\n<h2 id=\"t-1604169170147\">Your Options for Global Illumination in Unity<\/h2>\n<p>Let&#8217;s build an ultra-simple scene to see and compare the different methods you have in Unity to do global illumination.<\/p>\n<p>Here&#8217;s the scene we are building:<\/p>\n<p><img decoding=\"async\" alt data-css=\"tve-u-1757ff684c6\" data-height=\"326\" data-id=\"2075\" data-init-height=\"312\" data-init-width=\"300\" data-tcb-events=\"__TCB_EVENT_[{&quot;t&quot;:&quot;click&quot;,&quot;a&quot;:&quot;thrive_zoom&quot;,&quot;config&quot;:{&quot;id&quot;:&quot;2075&quot;,&quot;size&quot;:&quot;full&quot;}}]_TNEVE_BCT__\" data-width=\"389\" height=\"504\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-4.png\" width=\"600\"><\/p>\n<p><em>Light Bounces Global Illumination Diagram<\/em><\/p>\n<p>First, take a deep breath and enjoy my drawing skills.<\/p>\n<p>Now, let&#8217;s explain it.<\/p>\n<p>A wall is covering\/occluding another wall, which in real-life would prevent light from reaching it.<\/p>\n<p>However, there&#8217;s a small gap below.<\/p>\n<p>This bottom gap will allow some sun rays to &#8220;escape&#8221; the big wall and reach the wall behind after these rays bounce off the floor.<\/p>\n<p>The diagram is clear, right?<\/p>\n<p>Here&#8217;s how our baseline (just direct lighting + shadows) looks in Unity.<\/p>\n<p><img decoding=\"async\" alt data-height=\"615\" data-id=\"2075\" data-init-height=\"312\" data-init-width=\"300\" data-width=\"780\" height=\"473\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-5.png\" width=\"600\"><\/p>\n<p>Global Illumination Scenario<\/p>\n<p>We won&#8217;t use that angle. It&#8217;s hard to see the effect of indirect lighting later on.<\/p>\n<p>Here&#8217;s a better angle.<\/p>\n<p><img decoding=\"async\" alt data-height=\"615\" data-id=\"2075\" data-init-height=\"312\" data-init-width=\"300\" data-width=\"780\" height=\"473\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-6.png\" width=\"600\"><\/p>\n<p>Global Illumination Baseline (No GI)<\/p>\n<p>The wall behind is quite dark.<\/p>\n<p>No global illumination means light is not bouncing. Our black shadow on that wall remains untouched with no secondary light rays coming in.<\/p>\n<p>Not what you want in your game. Nope.<\/p>\n<p>So let&#8217;s improve this scenario and add some GI with our first method:&nbsp;<strong>baked global illumination<\/strong>(Unity Lightmapper).<\/p>\n<h3 id=\"t-1604169170148\">Unity Baked Global Illumination<\/h3>\n<p>Baking global illumination is the&nbsp;<strong>cheapest way<\/strong>&nbsp;to do global illumination.<\/p>\n<p>We do all these expensive calculations offline (in the editor). That process produces textures that we later &#8220;<strong>paint on top<\/strong>&#8221; of our scene.<\/p>\n<p>It takes some effort to get the results you want with this method, as there are many settings to play with. And&nbsp;<strong>baking takes time<\/strong>.<\/p>\n<p>But once you get it right, it looks great.<\/p>\n<p>In fact, it&#8217;s probably the best-looking method out there to do (static) global illumination.<\/p>\n<p>The downsides?<\/p>\n<p>Well, it only works with static geometry.<\/p>\n<p>I mean, you can use light probes to add some indirect illumination to dynamic (moving) elements. But that also goes with many downsides.<\/p>\n<p>Anyway, let&#8217;s see how it looks.<\/p>\n<p>Use <a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi2\">the slider<\/a> to see the evolution from no GI to baked GI.<\/p>\n<p><a href=\"https:\/\/www.gamasutra.com\/blogs\/RubenTorresBonet\/20201110\/373493\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi2\"><img decoding=\"async\" height=\"473\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-7.png\" width=\"600\"><\/a>Just like I promised you, it looks more&#8230;&nbsp;<em>correct<\/em>*.<\/p>\n<p><em>* You know what I mean. Not the simplified scene per se, but the indirect lighting.<\/em><\/p>\n<p>However, did you ever play an&nbsp;<em>interactive<\/em>&nbsp;game with just&nbsp;<em>static&nbsp;<\/em>elements?<\/p>\n<p>No, you say?<\/p>\n<p>That&#8217;s why we need more options.<\/p>\n<p>One is to use&nbsp;<a href=\"https:\/\/docs.unity3d.com\/Manual\/LightProbes.html\" target=\"_blank\" rel=\"noopener noreferrer\">light probes<\/a>&nbsp;together with&nbsp;<a href=\"https:\/\/docs.unity3d.com\/Manual\/lighting-window.html\" target=\"_blank\" rel=\"noopener noreferrer\">baked GI<\/a>. The issue with light probes is that you need many of them to have smooth indirect lighting transitions. And guess what? That&#8217;s going to break batching for good.<\/p>\n<p>Let&#8217;s consider instead something else:&nbsp;<strong>Screen-space (Raster) Global Illumination<\/strong>.<\/p>\n<h3 id=\"t-1604169170149\">Unity Screen-Space Global Illumination (SSGI)<\/h3>\n<p>The idea with SSGI is simple. It&#8217;s execution is not.<\/p>\n<p>We analyze the rendered frame (G-buffer) and guesstimate the way light should bounce between surfaces that are within that frame.<\/p>\n<p>Again, we don&#8217;t do that for the whole scene. Just for the current rendered image.<\/p>\n<p>Doing this effect in screen-space makes this option affordable in terms of performance.<\/p>\n<p>Use <a href=\"http:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi3\">the slider below<\/a> to find out what&nbsp;<em>SSGI&nbsp;<\/em>paints on top of our baseline.<\/p>\n<p data-css=\"tve-u-1757ff0e4e2\"><strong>Screen-Space Global Illumination (SSGI)<\/strong><\/p>\n<p><a href=\"https:\/\/www.gamasutra.com\/blogs\/RubenTorresBonet\/20201110\/373493\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi3\"><img decoding=\"async\" height=\"473\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-8.png\" width=\"600\"><\/a><\/p>\n<p>A small tint of red.<\/p>\n<p>Not much else.<\/p>\n<p>Here is in detail the indirect lighting that we are adding to our baseline:<\/p>\n<p><img decoding=\"async\" alt data-height=\"438\" data-id=\"2075\" data-init-height=\"312\" data-init-width=\"300\" data-width=\"780\" height=\"337\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-9.png\" width=\"600\"><\/p>\n<p>Unity Global Illumination: Screen-Space Effect<\/p>\n<p>That&#8217;s a very shy effect. Quite different from baked GI, isn&#8217;t it?<\/p>\n<p>That&#8217;s one of the limitations of&nbsp;<em>SSGI<\/em>: accuracy. Two reasons for this:<\/p>\n<ul>\n<li>We have&nbsp;<strong>incomplete information<\/strong>&nbsp;(the G Buffer, information about our lights and that&#8217;s about it).<\/li>\n<li>We have a&nbsp;<strong>low performance budget<\/strong>: we need to keep this effect cheap.<\/li>\n<\/ul>\n<p>But hey, it works with dynamic elements. And in real-time&nbsp;<img loading=\"lazy\" decoding=\"async\" alt height=\"32\" role=\"img\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/13.0.0\/svg\/1f642.svg\" width=\"32\"><\/p>\n<p>Can we do better?<\/p>\n<p>Yes!<\/p>\n<p>What if we used&nbsp;<strong>ray-tracing<\/strong>&nbsp;for global illumination?<\/p>\n<p>After all, with ray-tracing we have&nbsp;<strong>access to off-screen data<\/strong>. And that removes a limitation of this method.<\/p>\n<p>Let&#8217;s check out&nbsp;<strong>ray-traced SSGI<\/strong>.<\/p>\n<h3 id=\"t-1604169170150\">Ray-Traced Global Illumination in Unity<\/h3>\n<p>This is getting exciting.<\/p>\n<p>If your project is ray-tracing-ready, you just need to click a checkbox in your screen-space global illumination effect:&nbsp;<em>enable ray-tracing<\/em>.<\/p>\n<p>The result?<\/p>\n<p>Use <a href=\"http:\/\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi4\">the slider below<\/a> to discover it.<\/p>\n<p data-css=\"tve-u-1757ff0e4e2\"><strong>Ray-Traced Global Illumination<\/strong><\/p>\n<p><a href=\"https:\/\/www.gamasutra.com\/blogs\/RubenTorresBonet\/20201110\/373493\/thegamedev.guru\/unity-ray-tracing\/global-illumination\/#gi4\"><img decoding=\"async\" height=\"473\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-10.png\" width=\"600\"><\/a>Juicy.<\/p>\n<p>Here&#8217;s the singled-out effect that ray-tracing GI is adding to our baseline:<\/p>\n<p><img decoding=\"async\" alt data-height=\"444\" data-id=\"2075\" data-init-height=\"312\" data-init-width=\"300\" data-width=\"780\" height=\"341\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-11.png\" width=\"600\"><\/p>\n<p>Unity Global Illumination: Ray Traced Effect<\/p>\n<p>Indeed, ray-tracing gets you good-looking indirect lighting. And it works with&nbsp;<strong>dynamic elements<\/strong>&#8230; in real-time.<\/p>\n<p>Huge deal.<\/p>\n<p>The question is,&nbsp;<strong>can you really afford ray-traced global illumination<\/strong>&nbsp;in Unity?<\/p>\n<p>Let&#8217;s analyze the performance cost of these effects.<\/p>\n<h2 id=\"t-1604169170151\">The Performance Cost of Ray-Traced Global Illumination in Unity<\/h2>\n<p>Here are some quick tests I ran with:<\/p>\n<ul>\n<li><strong>CPU<\/strong>: AMD Ryzen 2700X<\/li>\n<li><strong>GPU<\/strong>: TITAN RTX beefy edition<\/li>\n<li><strong>Dataset<\/strong>: 3000 frames taken on the editor<\/li>\n<li><strong>Scene<\/strong>: HDRP template<\/li>\n<li data-css=\"tve-u-1758049c76b\"><strong>Versions<\/strong>: Unity 2020.2.0b7 + HDRP 10.0.1<\/li>\n<\/ul>\n<p><img decoding=\"async\" alt data-height=\"439\" data-id=\"9711\" data-init-height=\"770\" data-init-width=\"1368\" data-width=\"780\" height=\"338\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-12.png\" width=\"600\"><\/p>\n<p data-css=\"tve-u-1758049d5fa\">Here are the average frame times at&nbsp;full-HD resolution:<\/p>\n<ul>\n<li>Baked GI: 27.64ms<\/li>\n<li>Baked GI + SSGI (low quality): 28.19 ms<\/li>\n<li>Baked GI + SSGI (medium quality): 30.36 ms<\/li>\n<li>Baked GI + SSGI (high quality): 32.96 ms<\/li>\n<li>Baked GI + Ray-Traced SSGI (performance mode \u2014 low quality): 32.07 ms<\/li>\n<li>Baked GI + Ray-Traced SSGI (performance mode \u2014 medium quality): 32.88 ms<\/li>\n<li>Baked GI + Ray-Traced SSGI (performance mode \u2014 high quality): 34.81 ms<\/li>\n<li>Baked GI + Ray-Traced SSGI (quality mode):&nbsp;<strong>107.91 ms<\/strong>&nbsp;(ouch)<\/li>\n<\/ul>\n<p>And here are some of these numbers at&nbsp;4K resolution:<\/p>\n<ul>\n<li>Baked GI: 106.21ms<\/li>\n<li>Baked GI + SSGI (medium quality): 114.56<\/li>\n<li>Baked GI + Ray-Traced SSGI (performance mode \u2014 medium quality): 119.77 ms<\/li>\n<li>Baked GI + Ray-Traced SSGI (quality mode):&nbsp;<strong>421 ms<\/strong>&nbsp;(OUCH)<\/li>\n<\/ul>\n<p data-css=\"tve-u-17580009ed7\"><em>Why did I take them all with baked GI, you might ask? Well, I removed the baked lightmaps and the entire scene broke for good. Like visually, all was pure white.<\/em><\/p>\n<p>Don&#8217;t take these times as absolute figures.<\/p>\n<p>After all, it&#8217;s a specific scene, a specific software\/hardware setup and within the editor.<\/p>\n<p>But you can compare the&nbsp;<strong>relative frame times&nbsp;<\/strong>and see how performance scales on this high-fidelity scene.<\/p>\n<p>You get the idea.<\/p>\n<p>Two interesting questions arise (and two subjective answers):<\/p>\n<ul>\n<li>Are we ready for 4K real-time ray-traced GI? Nope.<\/li>\n<li>Ok, and are we ready for 1080p real-time ray-traced GI? Yeah, maybe.<\/li>\n<\/ul>\n<p>It depends on your game.<\/p>\n<p>But if you put enough optimization effort into it,&nbsp;<strong>you can get real-time ray-tracing global illumination in. It&#8217;s feasible.<\/strong><\/p>\n<p>Just run it on performance mode at 1080p and you&#8217;ll be fine on most&nbsp;<em>NVIDIA 2000+<\/em>&nbsp;cards (and maybe even on the&nbsp;<em>NVIDIA 1000<\/em>&nbsp;series).<\/p>\n<p>And the importance of performance brings me to&#8230;<\/p>\n<p><a href=\"https:\/\/go.thegamedev.guru\/performance-checklist\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" alt data-css=\"tve-u-175800136b8\" data-height=\"197\" data-id=\"6536\" data-init-height=\"605\" data-init-width=\"747\" data-link-wrap=\"true\" data-width=\"243\" height=\"197\" loading=\"lazy\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-13.png\" width=\"243\"><\/a><\/p>\n<h2 id=\"t-1604169170152\">Next Steps<\/h2>\n<p>How much did you like real-time ray-traced global illumination?<\/p>\n<p>Well, you can get RTGI in your game if you&nbsp;<strong>make enough performance room<\/strong>&nbsp;(and&nbsp;<a href=\"https:\/\/thegamedev.guru\/unity-ray-tracing\/5-signs-you-need-ray-tracing\/\" target=\"_blank\" rel=\"noopener noreferrer\">all other Unity ray-tracing effects<\/a>&nbsp;as well).<\/p>\n<p>And&nbsp;<em>nothing better<\/em>* than my&nbsp;<a href=\"https:\/\/go.thegamedev.guru\/performance-checklist\" target=\"_blank\" rel=\"noopener noreferrer\">Unity Performance Optimization Checklist<\/a>&nbsp;for that.<\/p>\n<p><em>*&nbsp;<a href=\"https:\/\/go.thegamedev.guru\/consulting\" target=\"_blank\" rel=\"noopener noreferrer\">Unity performance consulting<\/a>&nbsp;is better (but not many can&#8217;t afford it).<\/em><\/p>\n<p>Till next time,<\/p>\n<p>Ruben<br \/>(The Gamedev Guru)<\/p>\n<\/p><\/div>\n<hr>\n<div class=\"hide-phone\">\n<h3>Related Jobs<\/h3>\n<div class=\"stories_item\">\n<div class=\"thumb\"><a href=\"https:\/\/jobs.gamasutra.com\/job\/senior-release-engineer-frisco-texas-34639\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-14.png\" alt=\"The Gearbox Entertainment Co.\" width=\"120\"><\/a><\/div>\n<\/p><\/div>\n<div class=\"stories_item\">\n<div class=\"thumb\"><a href=\"https:\/\/jobs.gamasutra.com\/job\/junior-programmer-cambridge-ma-cambridge-massachusetts-32982\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-15.png\" alt=\"Disbelief\" width=\"120\"><\/a><\/div>\n<\/p><\/div>\n<div class=\"stories_item\">\n<div class=\"thumb\"><a href=\"https:\/\/jobs.gamasutra.com\/job\/senior-programmer-chicago-chicago-illinois-32981\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-15.png\" alt=\"Disbelief\" width=\"120\"><\/a><\/div>\n<\/p><\/div>\n<div class=\"stories_item\">\n<div class=\"thumb\"><a href=\"https:\/\/jobs.gamasutra.com\/job\/junior-programmer-chicago-chicago-illinois-32983\"><img decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-15.png\" alt=\"Disbelief\" width=\"120\"><\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<hr><\/div>\n<p> <!-- InstanceEndEditable --> <\/div>\n<p><!--end contentbox-->\n<\/div>\n<p><!--end span-16--> <\/div>\n<p> <br class=\"clear\"> <\/div>\n<p><!--end span-21--> <!--begin right sidebar--> <!--end right sidebar--> &lt;!&#8211; <\/div>\n<p> Extra Div &#8211;&gt; <!-- Beginning Sync AdSlot 21 for Ad unit Gamasutra\/\/consolepc ### size: [[8,2]] --> <!-- End AdSlot 21 --> <!-- Beginning Sync AdSlot 22 for Ad unit Gamasutra\/\/consolepc ### size: [[8,4]] --> <!-- End AdSlot 22 --> <!-- Beginning Sync AdSlot 23 for Ad unit Gamasutra\/\/consolepc ### size: [[4,4]] --> <!-- End AdSlot 23 --> <br class=\"clear\"><\/p><\/div>\n<p><!--end content-body-wrapper--> <\/div>\n<p><!--end container--><br \/>\n<!--begin footer--> <!--end footer--> <!-- SiteCatalyst code version: H.21.\nCopyright 1996-2010 Adobe, Inc. All Rights Reserved\nMore info available at http:\/\/www.omniture.com --> <a href=\"http:\/\/www.omniture.com\" title=\"Web Analytics\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/11\/the-bright-side-of-ray-traced-global-illumination-4.gif\" height=\"1\" width=\"1\" border=\"0\" alt><\/a><!--\/DO NOT REMOVE\/--><br \/>\n<!-- End SiteCatalyst code version: H.21. --> <!-- Begin ADSNATIVE Code --> <!-- End ADSNATIVE Code --> <!--Begin Ad script for pixel --> <!--END Ad script for pixel -->  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;!&#8211; &#8211;&gt; Gamasutra: Ruben Torres Bonet&#8217;s Blog &#8211; The Bright Side of Ray-Traced Global Illumination Informa Gamasutra is part of the Informa Tech Division of Informa PLC This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC&#8217;s registered office is 5 Howick Place, London [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":120573,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-120572","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/120572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=120572"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/120572\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media\/120573"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=120572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=120572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=120572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}