News - Blog: Softening polygon intersections in Blightbound - Printable Version +- Sick Gaming (https://www.sickgaming.net) +-- Forum: Sick Gaming Community (https://www.sickgaming.net/forum-1.html) +--- Forum: Lounge (https://www.sickgaming.net/forum-8.html) +--- Thread: News - Blog: Softening polygon intersections in Blightbound (/thread-98745.html) |
News - Blog: Softening polygon intersections in Blightbound - xSicKxBot - 12-15-2020 Blog: Softening polygon intersections in Blightbound <div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound.png" width="243" height="77" title="" alt="" /></div><div><p> <!-- Google Tag Manager --> <!-- End Google Tag Manager --> <!– –> <title>Gamasutra: Joost van Dongen’s Blog – Softening polygon intersections in Blightbound</title> <!--[if lt IE 9]> <a href="http://html5shim.googlecode.com/svn/trunk/html5.js">http://html5shim.googlecode.com/svn/trunk/html5.js</a> <![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 --> <!-- 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> <div id="iribbon-container" class="content-body-wrapper"> <button id="iribbon-title" title="show/hide" class="inactive">Informa</button> </p> <div id="iribbon-detail" class="ribbon-hide"> <div id="iribbon-left"> <p>Gamasutra is part of the Informa Tech Division of Informa PLC</p> </p></div> <div id="iribbon-right"> <p>This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC’s registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.</p> </p></div> </p></div> </p></div> <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> <div class="container"> <div id="container-main" class="content-body-wrapper"> <!-- Google Prestitial Ads start here--> <!-- Google Prestitial Ads end here--> </p> <div class="container bottom3"> <div class="span-7"> <a href="https://www.gamasutra.com"><img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound.png" alt="Gamasutra: The Art & Business of Making Games" width="243" height="77" border="0"></a><img alt="spacer" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound.gif" width="27"> </div> </p></div> <div class="span-20"> <!--end show phone--> <!--end showphone--> <!--end nav--> </p> <div class="span-20 last content_bg"> <div class="hide-phone"> <div class="span-4"> <div class="content_box_left"> <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--> <!– </p> <div class="header"><img loading="lazy" alt="arrow" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-1.png" width="22px" height="20px" /><a href="http://www.gamasutra.com/calendar/calendar.php">Calendar</a></div> <div class="leftnav bottom2"> <a href="http://www.gamasutra.com/calendar/calendar.php"><strong>View All</strong></a> <a href="http://www.gamasutra.com/calendar/calendar_submit.php"><strong>Submit Event</strong></a> </p> <hr> <ul> </ul> </div> <p> –> <!--end calendar--> <!--begin about--> </p> <div class="bottom2"> <a href="https://www.gamasutra.com/advertise"> <img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound.jpg" alt="Sponsor" border="0" class="whiteTop" width="177px" height="60px"> </a> </div> <p> <!--end about--> <!--begin network--> </p> <div class="leftnav_network bottom2"> If you enjoy reading this site, you might also want to check out these UBM Tech sites: </p> <hr> <hr> <p> <br class="clear"> </div> <p> <!--end network--> <!--begin store--> <!--end store--> </div> <p><!--end leftcol--> </div> </div></div> <div class="span-16 last"> <div class="content_box_middle"> <!-- InstanceBeginEditable name="BodyContent" --> </p> <div class="page_item"> <div><a name="twitter_share" href="http://twitter.com?status=RT @gamasutra: Softening polygon intersections in Blightbound http://www.gamasutra.com/blogs/JoostVanDongen/20201210/375058/" target="_blank" rel="noopener noreferrer"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-1.gif" alt="Share on Twitter" border="0" height="20"></a> <span id="edit_post_link"></span> <a href="https://www.gamasutra.com/blogs/rss/"><img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-2.gif" width="15" height="15" border="0" alt="RSS"></a> </div> <hr> <div class="item_body mobile_image_transform"> <strong><i><small> The following blog post, unless otherwise noted, was written by a member of Gamasutras community.<br />The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company. </small></i></strong> </p> <hr> <p>Our new game <a href="https://www.blightbound.com/" target="_top" rel="noopener noreferrer">Blightbound</a> features many types of foggy effects: mist, dust, smoke and more. Such effects are often made with planes and particles, allowing us to draw fog and effect textures by hand and giving us maximum artistic control. However, one issue with this is that the place where fog planes intersect with geometry creates a hard edge, which looks very fake and outdated. My solution was to implement <em>depth fade</em>. This is a commonly used technique for soft particles, but we use it on lots of objects, not just on particles.</p> <p>In today’s blogpost I’ll explain how depth fade rendering works. I’ll also show just how widely this technique can be applied, by going through a bunch of examples from Blightbound.</p> <p>First, let’s have a look at what problem we’re trying to solve here. When putting partially transparent planes in the world, the place where they intersect with other objects creates a straight cut-off line. Sometimes that’s desired, but often those transparent planes represent volumetric effects. They’re not supposed to look like flat planes, but that’s just the easiest and most efficient way of rendering them. This is fine when there are no intersections, but when there are then the hard lines where they touch other objects break the volumetric illusion.</p> <p>There’s a simple solution for this that’s used in a lot of games: depth fade. The idea is to simply fade out the plane near the intersection. This produces an effect similar to how real fog works: objects that go into the fog seem to smoothly fade out. However, actually figuring out all polygon intersections takes too much performance, so we want a rendering trick instead.</p> <p><img alt border="0" data-original-height="531" data-original-width="501" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-1.jpg"><br /><em>This screenshot from Blightbound shows a fog plane just above the ground. In the top image it is rendered in the standard way, resulting in hard intersections with the characters, rocks and cart. At the bottom the intersections are smoothened by depth fade.</em></p> <p>The trick to rendering with depth fade is to first render all normal geometry, excluding any transparent objects. This fills the depth buffer, so for every pixel we know what distance it has from the camera. Then when rendering the objects that need depth fade, the pixel shader looks up the distance in the depth buffer and compares that to its own distance. If these are close to each other, then we assume that we’re near an intersection and fade out this pixel. The nearer, the stronger the fade out, until the object is entirely invisible at the point of intersection.</p> <p>This technique has a few neat bonus features on top of just smoothing out intersections. By simply setting the distance over which the fade occurs, we can modify the density of the mist. Also, objects don’t need to actually intersect with the fog plane to get depth fade applied. Being just beneath the fog plane also makes the effect visible. Thus depth fade is more than just a way to smoothen intersections.</p> <p><img alt border="0" data-original-height="263" data-original-width="500" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-2.jpg"><br /><em>The fog’s density setting determines the width of the smoothing of the intersections. At a very high density the smoothing is almost lost. At a very low density the fog almost disappears because the ground is now also considered ‘close’ to the fog plane.</em></p> <p>While this technique is traditionally mostly used for particles, it can easily be used for all objects with transparency. Since the world of Blightbound is covered by the blight (a thick, corrupting fog) we have a lot of types of fog in our game, including many fog planes and particles, as well as smoke and special effects. Our artists can apply depth fade rendering to all of those, not just to particles.</p> <p>[embedded content]<br /><em>Depth fade is also great for hiding the seams of moving objects, like this fog wall.</em></p> <p>A nice property of depth fade is that it doesn’t cost all that much performance compared to traditional alpha blending. For each pixel of a particle or fog plane that we render, it costs one extra texture look-up (in the depth buffer) and a distance calculation. Compared to more advanced volumetric techniques, like voxel ray marching, that’s a very low price. Since the performance impact of depth fade is low, our artists can use this technique on many objects, not just on the few that really, really need it.</p> <p><img alt border="0" data-original-height="359" data-original-width="218" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-3.gif"><br /><em>Depth fade can also solve problems with camera facing glow planes. The glow on this torch is always oriented towards the camera, but that makes it intersect with the wall behind it under certain angles. Using depth fade, the intersection can be hidden. This animation shows alternating with and without depth fade.</em></p> <p>When I implemented depth fade, I thought I was being pretty clever: I had only ever seen this technique used for soft particles, not for generic object rendering. However, while searching the web a bit to write this blogpost, I found out it’s actually a standard feature in the Unreal engine. For Unity I only found the option on particles, but it might exist in a more generic form there as well.</p> <p>Now that we know how depth fade works, let’s have a look at a bunch of example uses from Blightbound. Special thanks to my colleague Ralph Rademakers, who made most of the levels and is thus the prime user of depth fade in Blightbound. Ralph gave me a nice list of cool spots to show:</p> <p>[embedded content]<br /><em>A compilation of examples from Blightbound where depth fade is used to great effect, showing both with and without depth fade.</em></p> <p><img alt border="0" data-original-height="558" data-original-width="500" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-3.jpg"><br /><em>Another application of depth fade is to hide seams of VFX with the world. In this example the smoke effect intersects with a black ground plane.</em></p> <p>When I initially implemented depth fade in Blightbound, I thought it would mostly be used on fog planes that float just above the ground, to give the impression of heroes walking through a low hanging, milky fog. As soon as our artists got hold of this technique however they started using it on tons of other objects. This is to me one of the most fun parts of building graphics tech: seeing how much more artists can do with it than I had originally imagined!</p> <p><em>For more blogposts on development of Blightbound, Awesomenauts, Swords & Soldiers, Cello Fortress, Proun, procedural music, my cello album and any of the other stuff I work on, check my dev blog at <a href="http://www.joostvandongen.com/">www.joostvandongen.com</a>.</em></p> </p></div> <hr> <div class="hide-phone"> <h3>Related Jobs</h3> <div class="stories_item"> <div class="thumb"><a href="https://jobs.gamasutra.com/job/technical-artist-all-genders-hamburg-34678"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-2.png" alt="New Moon Production " width="120"></a></div> </p></div> <div class="stories_item"> <div class="thumb"><a href="https://jobs.gamasutra.com/job/experienced-game-developer-tokyo-31908"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-4.jpg" alt="Square Enix Co., Ltd." width="120"></a></div> </p></div> <div class="stories_item"> <div class="thumb"><a href="https://jobs.gamasutra.com/job/junior-to-mid-programmer-austin-texas-34488"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-5.jpg" alt="Airship Syndicate" width="120"></a></div> </p></div> <div class="stories_item"> <div class="thumb"><a href="https://jobs.gamasutra.com/job/-senior-qa-automation-engineer-berlin-34663"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-3.png" alt="Wooga GmbH" width="120"></a></div> </p></div> </p></div> <hr></div> <p> <!-- InstanceEndEditable --> </div> <p><!--end contentbox--> </div> <p><!--end span-16--> </div> <p> <br class="clear"> </div> <p><!--end span-21--> <!--begin right sidebar--> <!--end right sidebar--> <!– </div> <p> Extra Div –> <!-- 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> <p><!--end content-body-wrapper--> </div> <p><!--end container--><br /> <!--begin footer--> <!--end footer--> <!-- SiteCatalyst code version: H.21. Copyright 1996-2010 Adobe, Inc. All Rights Reserved More info available at http://www.omniture.com --> <a href="http://www.omniture.com" title="Web Analytics"><img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/blog-softening-polygon-intersections-in-blightbound-4.gif" height="1" width="1" border="0" alt></a><!--/DO NOT REMOVE/--><br /> <!-- End SiteCatalyst code version: H.21. --> <!-- Begin ADSNATIVE Code --> <!-- End ADSNATIVE Code --> <!--Begin Ad script for pixel --> <!--END Ad script for pixel --> </p> </div> https://www.sickgaming.net/blog/2020/12/11/blog-softening-polygon-intersections-in-blightbound/ |