<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Unreal Engine Code Analysis]]></title><description><![CDATA[Exposing Unreal Engine's internal cogs. Covering low-level implementation details for programmers reveling in the details - beyond what the official documentation offers.]]></description><link>https://www.unrealdoc.com</link><image><url>https://substackcdn.com/image/fetch/$s_!6ZGX!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf8b04f9-c87f-4ce0-9ea3-293018528e48_256x256.png</url><title>Unreal Engine Code Analysis</title><link>https://www.unrealdoc.com</link></image><generator>Substack</generator><lastBuildDate>Tue, 05 May 2026 14:00:12 GMT</lastBuildDate><atom:link href="https://www.unrealdoc.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Hussein Khalil]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[unrealdoc@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[unrealdoc@substack.com]]></itunes:email><itunes:name><![CDATA[Hussein Khalil]]></itunes:name></itunes:owner><itunes:author><![CDATA[Hussein Khalil]]></itunes:author><googleplay:owner><![CDATA[unrealdoc@substack.com]]></googleplay:owner><googleplay:email><![CDATA[unrealdoc@substack.com]]></googleplay:email><googleplay:author><![CDATA[Hussein Khalil]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Static NavMesh Generation]]></title><description><![CDATA[NavMesh Series - Part 2]]></description><link>https://www.unrealdoc.com/p/navigation-mesh-static-gen</link><guid isPermaLink="false">https://www.unrealdoc.com/p/navigation-mesh-static-gen</guid><dc:creator><![CDATA[Hussein Khalil]]></dc:creator><pubDate>Tue, 25 Jul 2023 06:26:05 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/246e857e-4942-4c97-a641-fb20e0988be7_1280x853.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p></p><p>In <a href="https://www.unrealdoc.com/p/navigation-mesh">Part 1</a>, we explored <a href="https://github.com/recastnavigation/recastnavigation">Recast &amp; Detour</a>, the library used by Unreal Engine for NavMesh generation.</p><p>Building upon that foundation, we now delve into the implementation details within Unreal for <em><strong>static</strong></em> NavMesh generation. As a reminder, a <em><strong>static</strong></em> NavMesh does not support runtime modifications to its geometry (in contrast to a <em><strong>dynamic</strong> </em>NavMesh).</p><p>Topics covered in this article:</p><ul><li><p>Overview of systems and configuration options involved in the generation process.</p></li><li><p>Code analysis <em>(UE 5.2)</em>.</p></li></ul><p>While extensive, this article will not cover <em><strong>dynamic</strong></em> NavMeshes, world partitioning, runtime pathfinding, and other important topics. These areas will be addressed in subsequent posts, giving them the focus they deserve.</p><p>For now, let&#8217;s focus on static NavMesh generation, from which all future topics will build upon.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.unrealdoc.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Unreal Engine Code Analysis! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h1>Overview</h1><h3>Agents</h3><p>An <em><strong>agent</strong> </em>defines an entity that will navigate a NavMesh. </p><p>Navigation data is generated for each agent you configure.</p><p>You can configure as many agents as your project requires, each represented by a set of characteristics such as a<em> <strong>radius</strong>, <strong>height</strong></em> and <em><strong>max step height</strong>. </em>These properties are used as part of the generation process, such as for eroding walkable areas.</p><p>Each agent configuration sets a <em><strong>navigation data type</strong>,</em> with <em><strong>RecastNavMesh</strong> </em>being the default (hence <a href="https://www.unrealdoc.com/p/navigation-mesh">Part 1</a> discussing <em><strong>Recast &amp; Detour</strong></em>). Unreal gives you the flexibility of implementing your own type (e.g., navigation data not generated using Recast), though that is outside the scope of this series.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sD8k!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sD8k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png 424w, https://substackcdn.com/image/fetch/$s_!sD8k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png 848w, https://substackcdn.com/image/fetch/$s_!sD8k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png 1272w, https://substackcdn.com/image/fetch/$s_!sD8k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sD8k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png" width="990" height="1010" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1010,&quot;width&quot;:990,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:87277,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sD8k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png 424w, https://substackcdn.com/image/fetch/$s_!sD8k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png 848w, https://substackcdn.com/image/fetch/$s_!sD8k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png 1272w, https://substackcdn.com/image/fetch/$s_!sD8k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30b495e2-0bab-41c7-9898-dd56e665b812_990x1010.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Project settings: configuration of supported agents</figcaption></figure></div><h3>Boundaries</h3><p>A <em><strong>NavMeshBoundsVolume</strong></em> defines the boundaries where NavMesh data is generated.</p><p>By mapping <a href="https://www.unrealdoc.com/i/132416769/agents">agents</a> to a <em><strong>NavMeshBoundsVolume</strong></em>, we define what navigation data type is generated within its boundaries. A volume can support multiple agents. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lU2r!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lU2r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png 424w, https://substackcdn.com/image/fetch/$s_!lU2r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png 848w, https://substackcdn.com/image/fetch/$s_!lU2r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png 1272w, https://substackcdn.com/image/fetch/$s_!lU2r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lU2r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png" width="1104" height="757" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/deb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:757,&quot;width&quot;:1104,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:859664,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lU2r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png 424w, https://substackcdn.com/image/fetch/$s_!lU2r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png 848w, https://substackcdn.com/image/fetch/$s_!lU2r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png 1272w, https://substackcdn.com/image/fetch/$s_!lU2r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdeb6b0f9-778b-4156-a481-2219fef6e71f_1104x757.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">NavMeshBoundsVolume configured to generate navigation data tailored for the MainCharacter agent type.</figcaption></figure></div><h3>Navigation Data</h3><p>With agents and boundaries defined, the NavMesh generation process is able to generate navigation data. </p><p>The process takes into account the intersecting geometry within the defined boundaries, the agent&#8217;s generation parameters (e.g., agent radius, height, etc.), and the chosen navigation data type (e.g., Recast library).</p><p>For each supported agent, a unique instance of <em><strong>ARecastNavMesh</strong> </em>stores the navigation data tailored to their characteristics.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5pRI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5pRI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 424w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 848w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 1272w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5pRI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png" width="1456" height="581" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:581,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1066757,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5pRI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 424w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 848w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 1272w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><em>NavMeshBoundsVolumes</em> supporting various agents.</figcaption></figure></div><h3>Tiles and Layers</h3><p>The 3D boundaries of a <em><strong>NavMeshBoundsVolume</strong></em> are made up of tiles of a fixed size, with each tile storing a portion of the navigation data. These tiles are further categorized into <em><strong>layers</strong></em> based on the height range they cover.</p><p>This subdivision allows for Unreal to leverage its <strong><a href="https://docs.unrealengine.com/5.0/en-US/tasks-systems-in-unreal-engine/">Task system</a></strong>, a mechanism specifically designed for asynchronous work. This enables concurrent processing of tiles, effectively reducing generation runtime.</p><p>Within the Recast library, <em><strong><a href="https://github.com/recastnavigation/recastnavigation/blob/main/Detour/Include/DetourNavMesh.h#L281">dtMeshTile</a></strong> </em>represents a tile and holds the <a href="https://github.com/recastnavigation/recastnavigation/blob/main/Detour/Include/DetourNavMesh.h#L287">polygons and vertices</a> of the NavMesh area they cover<em>. </em>They are stored as a <a href="https://github.com/recastnavigation/recastnavigation/blob/main/Detour/Include/DetourNavMesh.h#L308">linked list</a> within a parent<em> <strong><a href="https://github.com/recastnavigation/recastnavigation/blob/main/Detour/Include/DetourNavMesh.h#L668">dtNavMesh</a></strong></em>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yh-e!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yh-e!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png 424w, https://substackcdn.com/image/fetch/$s_!yh-e!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png 848w, https://substackcdn.com/image/fetch/$s_!yh-e!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png 1272w, https://substackcdn.com/image/fetch/$s_!yh-e!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yh-e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png" width="838" height="626" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:626,&quot;width&quot;:838,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:591975,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yh-e!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png 424w, https://substackcdn.com/image/fetch/$s_!yh-e!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png 848w, https://substackcdn.com/image/fetch/$s_!yh-e!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png 1272w, https://substackcdn.com/image/fetch/$s_!yh-e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78e2ccd1-3913-47ef-96da-d8610544c98c_838x626.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Layered tiles and their respective coordinates.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GzeJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GzeJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png 424w, https://substackcdn.com/image/fetch/$s_!GzeJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png 848w, https://substackcdn.com/image/fetch/$s_!GzeJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png 1272w, https://substackcdn.com/image/fetch/$s_!GzeJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GzeJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png" width="838" height="681" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:681,&quot;width&quot;:838,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:805693,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GzeJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png 424w, https://substackcdn.com/image/fetch/$s_!GzeJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png 848w, https://substackcdn.com/image/fetch/$s_!GzeJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png 1272w, https://substackcdn.com/image/fetch/$s_!GzeJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dbf75ed-f3ca-4df1-bb35-d0903b84083a_838x681.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Color-graded layered tiles and their polygons, showcasing coverage over a height range (inclined ramp).</figcaption></figure></div><h3>Resolution</h3><p>The NavMesh generation process, as explained in <a href="https://www.unrealdoc.com/p/navigation-mesh">Part 1</a>, starts with the generation of a heightmap (used for voxelization), with its <em>cell size</em> assuming a crucial role. All subsequent steps rely on this initial step.</p><p>Unreal provides <em><strong>low</strong></em>, <em><strong>default</strong></em>, and <em><strong>high </strong></em>resolution presets for configuring the heightmap&#8217;s cell dimensions. </p><p>The resolution presets are configured in the project settings and are applied <em><strong>per-tile</strong></em> during the NavMesh generation process. </p><p>Resolution selection at runtime is determined by <em><strong>NavModifierVolumes</strong></em> overlapping generation boundaries, e.g., <em><strong>NavMeshBoundsVolume</strong></em>.</p><p>The choice of resolution depends on gameplay and performance requirements. Opting for higher resolutions, achieved by using smaller cells, results in more detailed and precise NavMeshes. However, they also lead to increased memory usage, generation time, impacted runtime performance (due to having more data to process), and overfitting (e.g., minor geometry details are considered, yet are not necessarily relevant for navigation).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Xc9n!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Xc9n!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png 424w, https://substackcdn.com/image/fetch/$s_!Xc9n!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png 848w, https://substackcdn.com/image/fetch/$s_!Xc9n!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png 1272w, https://substackcdn.com/image/fetch/$s_!Xc9n!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Xc9n!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png" width="902" height="963" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:963,&quot;width&quot;:902,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:76759,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Xc9n!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png 424w, https://substackcdn.com/image/fetch/$s_!Xc9n!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png 848w, https://substackcdn.com/image/fetch/$s_!Xc9n!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png 1272w, https://substackcdn.com/image/fetch/$s_!Xc9n!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45cad7db-1d1d-4199-ba92-5459b4f70c9c_902x963.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Project settings: configuration of NavMesh resolutions.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6Byt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6Byt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png 424w, https://substackcdn.com/image/fetch/$s_!6Byt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png 848w, https://substackcdn.com/image/fetch/$s_!6Byt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png 1272w, https://substackcdn.com/image/fetch/$s_!6Byt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6Byt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png" width="1456" height="922" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:922,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1172497,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6Byt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png 424w, https://substackcdn.com/image/fetch/$s_!6Byt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png 848w, https://substackcdn.com/image/fetch/$s_!6Byt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png 1272w, https://substackcdn.com/image/fetch/$s_!6Byt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9662fd02-5206-43e7-90ae-95e8692f8e6a_1575x997.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><em>NavModifierVolumes</em> and <em>Resolution</em> selection. The yellow squares represent the tiles within the designated boundaries of NavMesh generation.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Cy_J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Cy_J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif 424w, https://substackcdn.com/image/fetch/$s_!Cy_J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif 848w, https://substackcdn.com/image/fetch/$s_!Cy_J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif 1272w, https://substackcdn.com/image/fetch/$s_!Cy_J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Cy_J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif" width="600" height="500" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:500,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:568317,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Cy_J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif 424w, https://substackcdn.com/image/fetch/$s_!Cy_J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif 848w, https://substackcdn.com/image/fetch/$s_!Cy_J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif 1272w, https://substackcdn.com/image/fetch/$s_!Cy_J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344624b0-cde9-4a56-87cd-323c490b78e3_600x500.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Impact of resolution change on heightfield generation within the NavMesh construction process.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JRNi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JRNi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif 424w, https://substackcdn.com/image/fetch/$s_!JRNi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif 848w, https://substackcdn.com/image/fetch/$s_!JRNi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif 1272w, https://substackcdn.com/image/fetch/$s_!JRNi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JRNi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif" width="590" height="500" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:500,&quot;width&quot;:590,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:520275,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JRNi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif 424w, https://substackcdn.com/image/fetch/$s_!JRNi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif 848w, https://substackcdn.com/image/fetch/$s_!JRNi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif 1272w, https://substackcdn.com/image/fetch/$s_!JRNi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95db148e-3d7a-4894-9d77-6f9ed271931f_590x500.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Impact of resolution change on generated NavMesh.</figcaption></figure></div><h1>Code Analysis (UE 5.2)</h1><h3>Class Overview</h3><p><em><strong>UNavigationSystemV1</strong></em></p><ul><li><p>Oversees the entire navigation system within Unreal, including all instances of <em>ARecastNavMesh</em>.</p></li></ul><p><em><strong>FNavDataConfig</strong></em></p><ul><li><p>Describes an agent for which NavMesh data can be generated.</p><ul><li><p>Name, radius, height, navigation data type, etc.</p></li></ul></li><li><p>Owned by <em>UNavigationSystemV1</em>.</p></li></ul><p><em><strong>ARecastNavMesh</strong></em></p><ul><li><p>High-level manager class serving as a bridge between Unreal and the Recast library.</p></li><li><p>Provides access to generated Recast data, accessible from its owned <em>FPImplRecastNavMesh </em>instance.</p></li><li><p>Offers utility functions for various navigation-related operations. </p><ul><li><p>ex:<em> GetPolyNeighbors(), GetPolyEdges(), </em>etc.</p></li></ul></li><li><p>Owned by <em>UNavigationSystemV1</em>.</p></li></ul><p><em><strong>FPImplRecastNavMesh</strong></em></p><ul><li><p>Handles the private implementation details of <em>ARecastNavMesh</em>. </p></li><li><p>Wraps access to NavMesh data through owned pointers to Recast types (e.g., <em>dtNavMesh, dtMeshTile<strong>)</strong></em>.</p></li><li><p>Owned by <em>ARecastNavMesh</em>.</p></li></ul><p><em><strong>FRecastNavMeshGenerator</strong></em></p><ul><li><p>Manages the tile-based generation process by overseeing instances of <em>FRecastTileGenerator</em>. It leverages Unreal's <strong><a href="https://docs.unrealengine.com/5.0/en-US/tasks-systems-in-unreal-engine/">Task system</a></strong> to parallelize the execution of all <em>FRecastTileGenerator</em> instances, maximizing performance during the generation process.</p></li><li><p>Owned by <em>ARecastNavMesh</em>.</p></li></ul><p><em><strong>FRecastTileGenerator</strong></em></p><ul><li><p>Responsible for generating navigation data for layered tiles within specific boundaries using the Recast library</p></li><li><p>Owns an array of <em>FNavMeshTileData</em>, which stores the navigation data for all layered tiles corresponding to the position covered by this generator.</p></li><li><p>Owned by <em>FRecastNavMeshGenerator</em>.</p></li></ul><p><em><strong>FNavMeshTileData</strong></em></p><ul><li><p>Holds the data generated by Recast for a single layered tile.</p></li><li><p>Owned by <em>FRecastTileGenerator</em>.</p></li></ul><p><em><strong>dtNavMesh</strong></em></p><ul><li><p>A low-level Recast type holding a NavMesh&#8217;s entire data set, including all layered tiles (e.g., <em>dtMeshTile</em>)<em>.</em></p></li><li><p>Owned by <em>FPImplRecastNavMesh.</em></p></li></ul><p><em><strong>dtMeshTile</strong></em></p><ul><li><p>A low-level Recast type that stores all the polygons and vertices for a layered tile. It utilizes a header (e.g., <em>dtMeshHeader</em>) to store metadata that uniquely identifies its corresponding tile (e.g., x/y position, layer index, etc.).</p></li><li><p>Holds a pointer to the next layered tile.</p></li><li><p>Owned by <em>dtNavMesh.</em></p></li></ul><h3>Logic &amp; Data Flow</h3><blockquote><p>Non-essential statements have been excluded from code snippets to highlight only statements that facilitate the comprehension of the static NavMesh generation logic. </p><p>Function names remain unchanged and can serve as references to the original code accessible from <a href="https://github.com/EpicGames/UnrealEngine">Epic's Git repository</a> (v5.2).</p><p>The goal is not to provide a per-statement analysis of the code, but rather describe the overall logic and data flow.</p><p>The <em><strong>(x) </strong></em>syntax references a numbered statement in the code snippet being discussed.</p></blockquote><h4>Entry Point</h4><p><em><strong>UNavigationSystemV1::Build() </strong></em>serves as the entry point to the generation process.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Uk4m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Uk4m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png 424w, https://substackcdn.com/image/fetch/$s_!Uk4m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png 848w, https://substackcdn.com/image/fetch/$s_!Uk4m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png 1272w, https://substackcdn.com/image/fetch/$s_!Uk4m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Uk4m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png" width="1260" height="981" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:981,&quot;width&quot;:1260,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:132074,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Uk4m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png 424w, https://substackcdn.com/image/fetch/$s_!Uk4m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png 848w, https://substackcdn.com/image/fetch/$s_!Uk4m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png 1272w, https://substackcdn.com/image/fetch/$s_!Uk4m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7d049cfc-a32e-4b0e-87b5-2cd34e3f14e6_1260x981.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Generation entry point - UNavigationSystemV1::Build()</figcaption></figure></div><p>First, the function checks if there are any <em>ANavMeshBoundsVolume</em> instances with valid boundaries <em><strong>(1)</strong></em>. These volumes define areas where NavMesh data will be generated.</p><p>If at least one valid boundary exists, <em>SpawnMissingNavigationData()</em> <em><strong>(2) </strong></em>creates an <em>ARecastNavMesh</em> instance <strong>per supported agent type</strong>. An agent type is considered <em>supported</em> if a <em>ANavMeshBoundsVolume</em> is configured with support for it.</p><p><em>ARecastNavMesh </em>is a high-level manager class that functions as a bridge between Unreal and Recast. To facilitate quick lookup, a mapping is maintained between agent types and their corresponding <em>ARecastNavMesh</em> instance <em><strong>(3)</strong></em>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5pRI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5pRI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 424w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 848w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 1272w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5pRI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png" width="1456" height="581" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:581,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1066757,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!5pRI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 424w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 848w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 1272w, https://substackcdn.com/image/fetch/$s_!5pRI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdae4ca2c-8402-404e-afb2-51a623a6bc28_1891x755.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">NavMeshBoundsVolumes supporting various agents.</figcaption></figure></div><p><em>ARecastNavMesh</em> does not directly interact with the Recast library. Instead, it delegates this responsibility to its unique instance of <em>FRecastNavMeshGenerator</em>, which is constructed by invoking the <em>RebuildAll() </em>function <em><strong>(4, 5)</strong></em>.</p><p>We&#8217;ll cover the <em>EnsureBuildCompletion()</em> function <em><strong>(6) </strong></em>when we discuss <em>FRecastTileGenerator</em>. </p><h4>FRecastNavMeshGenerator</h4><p><em>FRecastNavMeshGenerator </em>is unique to each instance of <em>ARecastNavMesh <strong>(7, 8)</strong></em>. Its primary purpose is to coordinate the parallelization of agent-specific work for all tiles within the boundaries where NavMesh data should be generated.</p><blockquote><p>Reminder: Each supported agent type has its own dedicated <em>ARecastNavMesh</em>. As <em>FRecastNavMeshGenerator</em> is owned by an instance of <em>ARecastNavMesh</em>, the data produced by the generator is also specific to that particular agent.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4wG8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4wG8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png 424w, https://substackcdn.com/image/fetch/$s_!4wG8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png 848w, https://substackcdn.com/image/fetch/$s_!4wG8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png 1272w, https://substackcdn.com/image/fetch/$s_!4wG8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4wG8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png" width="868" height="705" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:705,&quot;width&quot;:868,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65298,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4wG8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png 424w, https://substackcdn.com/image/fetch/$s_!4wG8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png 848w, https://substackcdn.com/image/fetch/$s_!4wG8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png 1272w, https://substackcdn.com/image/fetch/$s_!4wG8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff86954-1f91-47ae-a884-c912bbe408fe_868x705.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Construction and initialization of FRecastNavMeshGenerator.</figcaption></figure></div><p>The generator&#8217;s <em>Init()</em> function <em><strong>(9) </strong></em>configures the properties that will be used during the generation process. It also defines the boundaries within which navigation data will be generated. Finally, it determines the maximum number of <a href="https://docs.unrealengine.com/5.2/en-US/tasks-systems-in-unreal-engine/">Tasks</a> that will execute parallel work.</p><p>Following initialization, the <em>RebuildAll() </em>function is invoked <em><strong>(10)</strong></em>:</p><ul><li><p><em><strong>(11) </strong>ConstructTiledNavMesh():</em></p><ul><li><p>Allocates memory for low-level Recast objects (e.g., <em>dtNavMesh</em>, <em>dtMeshTile) </em>to store generated NavMesh data. </p></li><li><p>These objects will be used by Unreal at runtime to execute navigation-related queries.</p></li></ul></li><li><p><em><strong>(12) </strong>MarkNavBoundsDirty():</em></p><ul><li><p>Creates an <em>FPendingTileElement</em> for each tile requiring NavMesh data generation. </p></li><li><p>Those instances are stored in the <em><strong>PendingDirtyTiles</strong> </em>array.</p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4bWk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4bWk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png 424w, https://substackcdn.com/image/fetch/$s_!4bWk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png 848w, https://substackcdn.com/image/fetch/$s_!4bWk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png 1272w, https://substackcdn.com/image/fetch/$s_!4bWk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4bWk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png" width="958" height="452" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:452,&quot;width&quot;:958,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40129,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4bWk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png 424w, https://substackcdn.com/image/fetch/$s_!4bWk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png 848w, https://substackcdn.com/image/fetch/$s_!4bWk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png 1272w, https://substackcdn.com/image/fetch/$s_!4bWk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c4a0cc2-bade-4baf-8c3d-17baa464988e_958x452.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>All that&#8217;s left is to run asynchronously the generation of navigation data for all dirty tiles.</p><h4>Tile Generators</h4><p>At this stage, all the necessary <em>ARecastNavMesh</em> and <em>FRecastNavMeshGenerator</em> instances have been created, with each generator<em> </em>holding a collection of tiles to process (e.g., <em>PendingDirtyTiles)</em>.</p><p>The execution flow now returns to the entry point of the generation process, <em>UNavigationSystem::Build()</em>, where <em>EnsureBuildCompletion()</em> is called on each <em>ARecastNavMesh</em> instance <em><strong>(6)</strong></em>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GxEa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GxEa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png 424w, https://substackcdn.com/image/fetch/$s_!GxEa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png 848w, https://substackcdn.com/image/fetch/$s_!GxEa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png 1272w, https://substackcdn.com/image/fetch/$s_!GxEa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GxEa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png" width="728" height="532.5806451612904" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/461c80af-371c-4f86-b415-374be6a45195_868x635.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:false,&quot;imageSize&quot;:&quot;normal&quot;,&quot;height&quot;:635,&quot;width&quot;:868,&quot;resizeWidth&quot;:728,&quot;bytes&quot;:49722,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GxEa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png 424w, https://substackcdn.com/image/fetch/$s_!GxEa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png 848w, https://substackcdn.com/image/fetch/$s_!GxEa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png 1272w, https://substackcdn.com/image/fetch/$s_!GxEa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F461c80af-371c-4f86-b415-374be6a45195_868x635.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>ARecastNavMesh</em> forwards the call to its <em>FRecastNavMeshGenerator</em>,<em> </em>which starts processing its <em>PendingDirtyTiles</em> collection by invoking <em>ProcessTileTasksAndGetUpdatedTiles() <strong>(13). </strong></em></p><p>Since there might be more tiles to process than the maximum number of tasks permitted to run in parallel (<em>NumTasksToProcess</em>), this function is invoked as many times as needed until data generation is completed for all tiles.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1bQ6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1bQ6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png 424w, https://substackcdn.com/image/fetch/$s_!1bQ6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png 848w, https://substackcdn.com/image/fetch/$s_!1bQ6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png 1272w, https://substackcdn.com/image/fetch/$s_!1bQ6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1bQ6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png" width="961" height="463" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:463,&quot;width&quot;:961,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:53115,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1bQ6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png 424w, https://substackcdn.com/image/fetch/$s_!1bQ6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png 848w, https://substackcdn.com/image/fetch/$s_!1bQ6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png 1272w, https://substackcdn.com/image/fetch/$s_!1bQ6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9eb41b4c-4377-42df-bd44-a6f154146792_961x463.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>ProcessTileTasksAndGetUpdatedTiles()</em> creates a unique instance of <em>FRecastTileGenerator</em> per tile requiring generation <em><strong>(14)</strong></em>.</p><blockquote><p><em>FRecastTileGenerator</em> will interface directly with the Recast library.</p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!N-py!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!N-py!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png 424w, https://substackcdn.com/image/fetch/$s_!N-py!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png 848w, https://substackcdn.com/image/fetch/$s_!N-py!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png 1272w, https://substackcdn.com/image/fetch/$s_!N-py!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!N-py!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png" width="1284" height="687" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:687,&quot;width&quot;:1284,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:215700,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!N-py!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png 424w, https://substackcdn.com/image/fetch/$s_!N-py!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png 848w, https://substackcdn.com/image/fetch/$s_!N-py!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png 1272w, https://substackcdn.com/image/fetch/$s_!N-py!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f6b3244-9604-480f-a88a-ab3592d4d454_1284x687.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each <em>FRecastTileGenerator</em> is then wrapped within an <em>FRecastTileGeneratorTask</em> to handle its asynchronous execution <em><strong>(15)</strong></em>. </p><p>Launching the task is done through <em>StartBackgroundTask()</em>, with progress monitored by adding an <em>FRunningTileElement</em> entry to the <em>RunningDirtyTiles</em> collection <em><strong>(16)</strong></em>. After processing, the corresponding tile entries are removed from <em>PendingDirtyTiles</em> <em><strong>(17)</strong></em>.</p><blockquote><p>For debugging purposes, the global variable <em>GNavmeshSynchronousTileGeneration</em> can be set to force synchronous execution of tile generators.</p></blockquote><p>To understand how navigation data is generated by <em>FRecastTileGenerator</em> you can examine its <em><strong>DoWork()</strong></em> function. The code interfaces with the Recast library and largely follows the same steps discussed in <a href="https://www.unrealdoc.com/p/navigation-mesh">Part 1</a>:</p><ul><li><p>Rasterization of geometry triangles into a 3D grid of voxels (e.g., <em>heightfield</em>).</p></li><li><p>Filtering of generated heightfield and conversion into a <em>compact heightfield.</em></p></li><li><p>Creation of a <em>distance field</em> from heightfield data.</p></li><li><p>Generation of layered data, e.g., <em>rcBuildHeightfieldLayers()</em></p></li></ul><p>With generation completed, <em>FRecastTileGenerator</em> stores the navigation data of each layered tile within instances of <em>FNavMeshTileData</em>. These are stored in its <em><strong>NavigationData</strong></em> array. </p><p>The final step involves <em>FRecastNavMeshGenerator</em> retrieving the content of the <em><strong>NavigationData</strong></em> array from all of its completed <em>FRecastTileGeneratorTask</em> instances. This data is then used to populate the <em>dtNavMesh</em> Recast object previously created in step <em><strong>(11)</strong></em>.</p><p>The <em>dtNavMesh</em> object will be utilized by Unreal at runtime to execute navigation-related queries.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gTwy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gTwy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png 424w, https://substackcdn.com/image/fetch/$s_!gTwy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png 848w, https://substackcdn.com/image/fetch/$s_!gTwy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png 1272w, https://substackcdn.com/image/fetch/$s_!gTwy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gTwy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png" width="1038" height="747" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c90513aa-678a-4877-9c3c-6253a0070011_1038x747.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:747,&quot;width&quot;:1038,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:86956,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gTwy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png 424w, https://substackcdn.com/image/fetch/$s_!gTwy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png 848w, https://substackcdn.com/image/fetch/$s_!gTwy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png 1272w, https://substackcdn.com/image/fetch/$s_!gTwy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc90513aa-678a-4877-9c3c-6253a0070011_1038x747.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>This article has provided a comprehensive overview of static NavMesh generation in Unreal Engine. We've explored the key components and processes involved, from defining <em>agents,</em> <em>boundaries</em> and <em>resolutions</em> to the coordination of asynchronous tile-based generation using <em>ARecastNavMesh</em>, <em>FRecastNavMeshGenerator and FRecastTileGenerator</em>.</p><p>Through detailed code analysis and logic flow, we've gained insight into how Unreal leverages its Task system to efficiently generate navigation data tailored to each agent's characteristics.</p><p>While this article focused on static NavMesh generation, it's only the beginning of our journey into Unreal Engine's navigation capabilities. </p><p>In the next installment, we will delve into the dynamic NavMesh generation process, where we'll tackle real-time modifications, obstacles, and other dynamic aspects essential for responsive navigation in dynamic game environments.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.unrealdoc.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Unreal Engine Code Analysis! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Recast & Detour]]></title><description><![CDATA[NavMesh Series - Part 1]]></description><link>https://www.unrealdoc.com/p/navigation-mesh</link><guid isPermaLink="false">https://www.unrealdoc.com/p/navigation-mesh</guid><dc:creator><![CDATA[Hussein Khalil]]></dc:creator><pubDate>Wed, 21 Jun 2023 23:07:16 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!SntL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Other articles in the series:</p><ul><li><p><a href="https://www.unrealdoc.com/p/navigation-mesh-static-gen">Part 2 - Static Generation</a></p></li></ul><div><hr></div><p>A navigation mesh (<em>NavMesh</em>) is a set of interconnected polygons that are generated through an analysis of the environment. They represent the walkable surfaces.</p><p>The NavMesh serves as a guiding tool for AI-controlled entities, allowing them to navigate the game world while avoiding obstacles. It provides spatial information about the environment, such as the type of walkable surfaces, height and elevation data, and other relevant attributes. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.unrealdoc.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Unreal Engine Code Analysis! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>This information can be used by AI systems to make informed decisions, such as determining the nearest cover location or planning optimal paths.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SntL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SntL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png 424w, https://substackcdn.com/image/fetch/$s_!SntL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png 848w, https://substackcdn.com/image/fetch/$s_!SntL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png 1272w, https://substackcdn.com/image/fetch/$s_!SntL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SntL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png" width="1207" height="536" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:536,&quot;width&quot;:1207,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1323426,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SntL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png 424w, https://substackcdn.com/image/fetch/$s_!SntL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png 848w, https://substackcdn.com/image/fetch/$s_!SntL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png 1272w, https://substackcdn.com/image/fetch/$s_!SntL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff382c67b-7eba-4893-b4c1-e4aa766c783f_1207x536.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A NavMesh made up of interconnected polygons</figcaption></figure></div><p>Unreal Engine supports two types of NavMeshes:</p><ul><li><p><em>Global</em> (also known as <em>Unified</em>)</p></li><li><p><em>World-Partitioned</em> (experimental as of UE 5.2)</p></li></ul><p>The topic of <em>world partitioning</em> will be tackled in a follow-up article.</p><p>A <em>Global</em> NavMesh fully covers an area, it is not divided into smaller parts (i.e.: <em>partitioned</em>).</p><p>In order to reduce memory usage and improve performance, the polygons that make up the NavMesh are grouped together to form <em>tiles</em><strong>, </strong>which provide additional granular control over which polygons are loaded or unloaded at runtime based on the proximity of the player or AI agents.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3xcL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3xcL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png 424w, https://substackcdn.com/image/fetch/$s_!3xcL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png 848w, https://substackcdn.com/image/fetch/$s_!3xcL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png 1272w, https://substackcdn.com/image/fetch/$s_!3xcL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3xcL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png" width="906" height="330" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:330,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:652813,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3xcL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png 424w, https://substackcdn.com/image/fetch/$s_!3xcL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png 848w, https://substackcdn.com/image/fetch/$s_!3xcL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png 1272w, https://substackcdn.com/image/fetch/$s_!3xcL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1483e073-3f56-4640-bf9c-d989c1a161fa_906x330.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">NavMesh polygons grouped to form tiles (black boundaries)</figcaption></figure></div><p>The quantity of <em>tiles</em> and <em>polygons</em> generated is determined by several factors, including the dimensions of the covered area, the complexity of the environment, and the generation configuration.</p><p>Before delving deeper into the NavMesh generation process within Unreal Engine (a topic for the next article), it is essential to grasp the inner workings of the library on which it relies: <em>Recast &amp; Detour</em>.</p><blockquote><p>The <em>Recast &amp; Detour</em> library shipping with UE had modifications made to it.</p><p>We will be covering &#8220;vanilla&#8221; v1.6.0 of Recast (latest version as of this writing).</p><p>The next article will discuss the modifications made by Epic, as well as how the library is integrated within UE.</p></blockquote><h3>Recast &amp; Detour</h3><p>Generating a NavMesh in Unreal creates an actor of type <em>ARecastNavMesh. </em>The <em>Recast</em> prefix originates from Epic&#8217;s use of the <a href="https://github.com/recastnavigation/recastnavigation">Recast &amp; Detour</a> open source library. </p><p>The library is made up of two toolsets: <em>Recast</em>, which handles the generation of the NavMesh, and <em>Detour</em> for pathfinding using the data generated with <em>Recast</em>.</p><p>The Recast generation pipeline consists of several steps. Initially, triangles within the NavMesh's generation boundaries are classified as walkable or non-walkable based on their slope, with the maximum slope angle being adjustable.</p><pre><code>// Source: https://github.com/recastnavigation/recastnavigation
// File: Recast/Source/Recast.cpp

/* ========================================================================
   Triangle Categorization (i.e.: walkable or not)
   ======================================================================== */

void rcMarkWalkableTriangles(rcContext* context, 
                             const float walkableSlopeAngle,
                             const float* verts, const int numVerts,
                             const int* tris, const int numTris,
                             unsigned char* triAreaIDs)
{
&#9;(...)

&#9;const float walkableThr = cosf(walkableSlopeAngle / 180.0f * RC_PI);

&#9;float norm[3];

&#9;for (int i = 0; i &lt; numTris; ++i)
&#9;{
&#9;&#9;const int* tri = &amp;tris[i * 3];
&#9;&#9;calcTriNormal(&amp;verts[tri[0] * 3], &amp;verts[tri[1] * 3], &amp;verts[tri[2] * 3], norm);
&#9;&#9;// Check if the face is walkable.
&#9;&#9;if (norm[1] &gt; walkableThr)
&#9;&#9;{
&#9;&#9;&#9;triAreaIDs[i] = RC_WALKABLE_AREA;
&#9;&#9;}
&#9;}
}</code></pre><p>The triangles are converted (<em>rasterized</em>) into a 3D grid of <em><a href="https://en.wikipedia.org/wiki/Voxel">voxels</a></em>. This 3D grid, known as a <em>heightfield</em>, represents the environment by capturing both the ground surface and other structures or objects within it.</p><ul><li><p>A heightfield is composed of <em>cells</em>, which are square units on the XZ plane. The dimensions of a cell can be configured. The smaller the cell, the higher the resolution of the heightfield.</p></li><li><p>As we iterate over all cells, we determine their overlap with the triangles making up the environment&#8217;s mesh - this overlap represents obstructed space. This is accomplished by taking a cell on the XZ plane and projecting it upwards. Anything that overlaps does so for a certain Y range. This range is used to create <em>spans</em>, representing the height variations where obstructions exist within the cells.</p></li><li><p>A cell contains [0, X] spans.</p></li><li><p>Based on the slope of the triangles overlapping with the cells, spans are marked as <em>walkable</em> or <em>non-walkable</em>.</p></li><li><p>The elevation data from the spans, along with the position of the cells on the XZ plane, enables the construction of the 3D grid of voxels, accurately representing the terrain and obstacles within the environment.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DQnX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DQnX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png 424w, https://substackcdn.com/image/fetch/$s_!DQnX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png 848w, https://substackcdn.com/image/fetch/$s_!DQnX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png 1272w, https://substackcdn.com/image/fetch/$s_!DQnX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DQnX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png" width="838" height="697" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:697,&quot;width&quot;:838,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31367,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DQnX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png 424w, https://substackcdn.com/image/fetch/$s_!DQnX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png 848w, https://substackcdn.com/image/fetch/$s_!DQnX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png 1272w, https://substackcdn.com/image/fetch/$s_!DQnX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F173e0e2e-fcd0-40c4-bce9-c456cb836e01_838x697.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="pullquote"><p><em>Spans</em> represent the height variations where obstructions exist within a heightfield cell.</p></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ajtP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ajtP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png 424w, https://substackcdn.com/image/fetch/$s_!ajtP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png 848w, https://substackcdn.com/image/fetch/$s_!ajtP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png 1272w, https://substackcdn.com/image/fetch/$s_!ajtP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ajtP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png" width="1419" height="609" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:609,&quot;width&quot;:1419,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:234106,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ajtP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png 424w, https://substackcdn.com/image/fetch/$s_!ajtP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png 848w, https://substackcdn.com/image/fetch/$s_!ajtP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png 1272w, https://substackcdn.com/image/fetch/$s_!ajtP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4aa14e4-c98a-47d3-a6c9-1c95a3aded31_1419x609.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Environment mesh</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!koa5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!koa5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png 424w, https://substackcdn.com/image/fetch/$s_!koa5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png 848w, https://substackcdn.com/image/fetch/$s_!koa5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png 1272w, https://substackcdn.com/image/fetch/$s_!koa5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!koa5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png" width="1428" height="605" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:605,&quot;width&quot;:1428,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:185002,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!koa5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png 424w, https://substackcdn.com/image/fetch/$s_!koa5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png 848w, https://substackcdn.com/image/fetch/$s_!koa5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png 1272w, https://substackcdn.com/image/fetch/$s_!koa5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F094fb33b-2e54-497f-862c-eac572c1299e_1428x605.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Rasterization into a 3D grid of voxels from large heightfield cells. Voxels were created from heightfield data (the position of cells on the XZ plane and their spans)</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Wif-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Wif-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png 424w, https://substackcdn.com/image/fetch/$s_!Wif-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png 848w, https://substackcdn.com/image/fetch/$s_!Wif-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png 1272w, https://substackcdn.com/image/fetch/$s_!Wif-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Wif-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png" width="1432" height="598" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:598,&quot;width&quot;:1432,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:296202,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Wif-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png 424w, https://substackcdn.com/image/fetch/$s_!Wif-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png 848w, https://substackcdn.com/image/fetch/$s_!Wif-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png 1272w, https://substackcdn.com/image/fetch/$s_!Wif-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce941cf4-26b9-49c2-a21c-d41ac95e4cd4_1432x598.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">&#8230; and with smaller heightfield cells. Notice the increased resolution</figcaption></figure></div><pre><code>// Source: https://github.com/recastnavigation/recastnavigation
// File: Recast/Source/RecastRasterization.cpp

bool rcRasterizeTriangles(...)
{
    // Invokes rasterizeTri()
}

static bool rasterizeTri(...)
{
    // Invokes dividePoly() and addSpan()
}

static void dividePoly(...)
{
}

static bool addSpan(...)
{ 
}</code></pre><p>The heightfield is subjected to a series of filtering operations which aim to refine its data, removing any artifacts or noise, as well as enhance its accuracy.</p><pre><code><code>// Source: https://github.com/recastnavigation/recastnavigation
// File: Recast/Source/RecastFilter.cpp

void rcFilterLowHangingWalkableObstacles(...)
{
    // If an unwalkable span has a walkable span directly under it, and the 
    // height difference (climb) between them is under a configured threshold, 
    // the unwalkable span is marked as walkable.
}

void rcFilterLedgeSpans(...)
{
    // Marks spans as unwalkable if close to a ledge or on a steep slope.
}

void rcFilterWalkableLowHeightSpans(...)
{
    // Remove walkable flag from spans which do not have enough
    // space above them for the agent to stand there.
}</code></code></pre><p>Next, the heightfield undergoes a conversion process to become a <em>compact heightfield</em>, aimed at optimizing processing speed. As part of this optimization, the dynamically allocated memory used by the non-compact heightfield is reorganized into blocks of sequential memory.</p><p>By arranging the data to fit in blocks of memory that the computer's processor can retrieve at once from main memory (i.e.: <a href="http://www.nic.uoregon.edu/~khuck/ts/acumem-report/manual_html/ch03s02.html">cache lines</a>), <a href="https://en.wikipedia.org/wiki/Locality_of_reference">cache locality</a> is improved. Improved locality reduces the occurrence of cache misses, where data needs to be fetched from main memory because it is not found in the CPU's caches (L1/L2/L3). This results in faster memory access times and overall improved performance, as the CPU spends less time waiting for data from main memory.</p><pre><code><code>// Source: https://github.com/recastnavigation/recastnavigation
// File: Recast/Source/Recast.cpp

bool rcBuildCompactHeightfield(...)
{
}</code></code></pre><p>Walkable areas are then eroded based on a <em>walkable radius</em> config. This ensures that the data takes into account the physical constraints of the entities that will eventually make use of the NavMesh. A larger walkable radius is used to accommodate larger entities, ensuring they have enough room to navigate the environment.</p><pre><code><code>// Source: https://github.com/recastnavigation/recastnavigation
// File: Recast/Source/RecastArea.cpp

bool rcErodeWalkableArea(rcContext* ctx, int radius, rcCompactHeightfield&amp; chf)
{
    // Any spans that are closer to a boundary or obstruction than the 
    // specified radius are marked as unwalkable.
}</code></code></pre><p>With filtering complete, a <em>distance field</em> is created from the heightfield data. </p><p>The algorithm operates in two passes. In the first pass, it traverses the heightfield from the top left to the bottom right, calculating the walkable distance for each spans of a cell. The value is determined by considering the number of neighboring spans that are walkable. To ensure complete coverage, the process is repeated in a second pass, this time traversing the heightfield from the bottom right to the top left. </p><p>The distances are then &#8220;blurred&#8221; to smooth the transitions between values.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1ZF0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1ZF0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif 424w, https://substackcdn.com/image/fetch/$s_!1ZF0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif 848w, https://substackcdn.com/image/fetch/$s_!1ZF0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif 1272w, https://substackcdn.com/image/fetch/$s_!1ZF0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1ZF0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif" width="1306" height="897" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:897,&quot;width&quot;:1306,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1751391,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1ZF0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif 424w, https://substackcdn.com/image/fetch/$s_!1ZF0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif 848w, https://substackcdn.com/image/fetch/$s_!1ZF0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif 1272w, https://substackcdn.com/image/fetch/$s_!1ZF0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1f128cb2-9ce3-4b21-a122-51b520f1640e_1306x897.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The distance field depicts non-walkable areas in black. The impact of adjusting the walkable radius is also demonstrated. A walkable radius defines the spatial limitations of entities in your game. A larger walkable radius is used to accommodate larger entities, ensuring they have enough room to navigate the environment.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VBHM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VBHM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif 424w, https://substackcdn.com/image/fetch/$s_!VBHM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif 848w, https://substackcdn.com/image/fetch/$s_!VBHM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif 1272w, https://substackcdn.com/image/fetch/$s_!VBHM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VBHM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif" width="1202" height="803" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:803,&quot;width&quot;:1202,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2903654,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VBHM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif 424w, https://substackcdn.com/image/fetch/$s_!VBHM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif 848w, https://substackcdn.com/image/fetch/$s_!VBHM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif 1272w, https://substackcdn.com/image/fetch/$s_!VBHM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53268b7-e6f8-4ec6-8516-cc881e842b15_1202x803.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Illustrating the influence of varying heightfield cell sizes on the resulting distance field. Adjusting the cell size affects voxel dimensions and overall resolution</figcaption></figure></div><pre><code><code>// Source: https://github.com/recastnavigation/recastnavigation
// File: Recast/Source/RecastRegion.cpp

bool rcBuildDistanceField(...)
{
}

static unsigned short* boxBlur(...)
{
}</code></code></pre><p>The heightfield is then partitioned into <em>regions</em>. Recast offers three different partitioning algorithms: <em>Watershed</em>, <em>Monotone</em> and <em>Layer</em>. Only <em>Watershed</em> relies on the previously described distance field. For all algorithms, the goal is to create simple regions by grouping cells based on their walkable property and environment connectivity.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dB3K!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dB3K!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png 424w, https://substackcdn.com/image/fetch/$s_!dB3K!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png 848w, https://substackcdn.com/image/fetch/$s_!dB3K!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png 1272w, https://substackcdn.com/image/fetch/$s_!dB3K!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dB3K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png" width="1456" height="923" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:923,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:420302,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dB3K!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png 424w, https://substackcdn.com/image/fetch/$s_!dB3K!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png 848w, https://substackcdn.com/image/fetch/$s_!dB3K!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png 1272w, https://substackcdn.com/image/fetch/$s_!dB3K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F220f285d-8cf7-4670-b9e0-9811c00387a7_1551x983.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Regions obtained using the Watershed partitioning algorithm, the arrows demonstrate the connectivity between them</figcaption></figure></div><p>Each algorithm has it&#8217;s advantages and disadvantages, detailing them is outside the scope of this article.</p><pre><code><code>// Source: https://github.com/recastnavigation/recastnavigation
// File: Recast/Source/RecastRegion.cpp

bool rcBuildRegions(...)
{
}

bool rcBuildRegionsMonotone(...)
{
}

bool rcBuildLayerRegions(...)
{
}</code></code></pre><p>Next, <em>contours</em> are extracted from the regions by identifying boundaries.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Kww3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Kww3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png 424w, https://substackcdn.com/image/fetch/$s_!Kww3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png 848w, https://substackcdn.com/image/fetch/$s_!Kww3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png 1272w, https://substackcdn.com/image/fetch/$s_!Kww3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Kww3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png" width="1456" height="1013" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1013,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:345661,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Kww3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png 424w, https://substackcdn.com/image/fetch/$s_!Kww3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png 848w, https://substackcdn.com/image/fetch/$s_!Kww3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png 1272w, https://substackcdn.com/image/fetch/$s_!Kww3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa0bde17-c079-4a53-b4cf-4cede466e94c_1484x1032.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Contours created from region partitioning</figcaption></figure></div><pre><code><code>// Source: https://github.com/recastnavigation/recastnavigation
// File: Recast/Source/RecastRegion.cpp

bool rcBuildContours(...)
{
}</code></code></pre><p>Finally, polygons are generated from the contours to form the NavMesh.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qefJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qefJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png 424w, https://substackcdn.com/image/fetch/$s_!qefJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png 848w, https://substackcdn.com/image/fetch/$s_!qefJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png 1272w, https://substackcdn.com/image/fetch/$s_!qefJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qefJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png" width="1456" height="997" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:997,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:472436,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qefJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png 424w, https://substackcdn.com/image/fetch/$s_!qefJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png 848w, https://substackcdn.com/image/fetch/$s_!qefJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png 1272w, https://substackcdn.com/image/fetch/$s_!qefJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4af2c051-bc33-40dd-a25c-aa39d41c7bf6_1471x1007.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Simple polygon mesh</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!V2t1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!V2t1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png 424w, https://substackcdn.com/image/fetch/$s_!V2t1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png 848w, https://substackcdn.com/image/fetch/$s_!V2t1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png 1272w, https://substackcdn.com/image/fetch/$s_!V2t1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!V2t1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png" width="1456" height="1006" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1006,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:510525,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!V2t1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png 424w, https://substackcdn.com/image/fetch/$s_!V2t1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png 848w, https://substackcdn.com/image/fetch/$s_!V2t1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png 1272w, https://substackcdn.com/image/fetch/$s_!V2t1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0d7e0a1-6b0f-4089-9ed9-03ce55e81b4f_1469x1015.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Detailed polygon mesh</figcaption></figure></div><p>We&#8217;ve covered quite a few things today and while certain details were briefly mentioned, we will delve further into them in the <a href="https://www.unrealdoc.com/p/navigation-mesh-static-gen">next post</a>, which will focus on how Unreal Engine leverages the Recast library. This upcoming article will provide a more comprehensive exploration of the topic.</p><p>I hope you found this post informative, and I look forward to sharing more insights in the next installment.</p><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.unrealdoc.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Unreal Engine Code Analysis! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Introduction]]></title><description><![CDATA[Unraveling complex codebases: navigating Unreal Engine from a programmer's perspective]]></description><link>https://www.unrealdoc.com/p/introduction</link><guid isPermaLink="false">https://www.unrealdoc.com/p/introduction</guid><dc:creator><![CDATA[Hussein Khalil]]></dc:creator><pubDate>Sat, 03 Jun 2023 21:33:14 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/8395848c-fbcf-42c7-9ac0-c810ba3b2e43_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome to the Unreal Engine Code Analysis Substack.</p><p>My name is Hussein - I&#8217;ve been working in the gaming industry for over a decade as a <a href="https://www.linkedin.com/in/husseink/">programmer</a> for studios such as Eidos, Ubisoft and Gearbox.</p><p>Codebases, regardless of their size, often have complex logic and interdependencies that may not be immediately evident. This is compounded by code frequently switching hands, with the original developer often not involved in subsequent changes. As the initial vision evolves and new ideas are integrated, the complexity of the architecture can grow, sometimes stretching beyond its original design intentions.</p><p>This led me over the years to develop my own approach for delving into unfamiliar (and sometimes unwelcoming) code and trying to make sense of it all.</p><p>It starts with documenting systems in manageable pieces that we can always go back to in order to get a quick refresher. The goal is not to understand everything from the get-go, but rather to establish a foothold within the codebase which slowly expands, one step at a time, to eventually cover as much as possible. </p><p>This leads to understanding the overall logic, runtime data flow, and technical limitations. This in turn helps us recognize the impact of our changes, how to interface with the systems, as well as schedule work with a higher degree of confidence in estimates.</p><p>The official Unreal Engine documentation, while certainly useful, is not geared towards programmers and doesn&#8217;t provide that level of detail which I find important. The exercise of opening the codebase and analyzing it remains a requirement to understanding what makes the engine tick under the hood.</p><p>As such, I will be going through that exercise and documenting my own journey - hoping that some of my findings prove useful to you.</p><p>Join me as we uncover everything Unreal Engine has to offer.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.unrealdoc.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.unrealdoc.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item></channel></rss>