{"id":848,"date":"2024-01-04T18:18:54","date_gmt":"2024-01-04T18:18:54","guid":{"rendered":"https:\/\/www.katsbits.com\/site\/?p=848"},"modified":"2024-01-04T18:18:54","modified_gmt":"2024-01-04T18:18:54","slug":"baking-ambient-occlusion-maps-for-terrain-advanced","status":"publish","type":"post","link":"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/","title":{"rendered":"Terrain &#038; Baking Ambient Occlusion &#8211; Optimising"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/#Modelling_the_Terrain_Mesh\" >Modelling the Terrain Mesh<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/#Terrain_Texture_Density\" >Terrain &amp; Texture Density<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/#Terrain_Splitting_UVW_Single_Textures\" >Terrain, Splitting UVW &amp; Single Textures<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/#Terrain_Split_UVWs_Multiple_Textures\" >Terrain, Split UVW&#8217;s &amp; Multiple Textures<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/#Breaking_Large_UVWs_into_Smaller_Sections\" >Breaking Large UVW&#8217;s into Smaller Sections<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<p>In the first part of the tutorial the basic procedure for baking a terrains ambient occlusion map was discussed, how the mesh should be prepared and materials applied. Whilst this is not that different to baking ambient occlusion for other types of objects, there are a number of important factors that should be considered or kept in mind because they directly influence the resulting maps.<\/p>\n<p>The following &#8220;<i><a href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/\">Advanced Ambient Occlusion for Terrain<\/a><\/i>&#8221; is broken into two general topics of discussion; &#8220;Materials&#8221; and &#8220;UVW&#8217;s&#8221;, and how they can be utilised to gain better baking results on meshes that are, more-often-than-not, extremely large.<\/p>\n<p><a id=\"meshsize\" name=\"meshsize\"><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Modelling_the_Terrain_Mesh\"><\/span>Modelling the Terrain Mesh<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The physical size of a terrain mesh has a direct affect on the outcome of texture baking Ambient Occlusion maps, it&#8217;s important to understand this critical concern as most &#8216;errors&#8217; or &#8216;bad&#8217; bakes can be attributed to this single fact. Because Blender expects content to be made relative to a scenes default scale and objects contained there-in (the &#8216;camera&#8217;, &#8216;lamp&#8217; and &#8216;cube&#8217; items), any significant deviation from this tends to cause problems that cannot, generally, be fixed by changing Blenders &#8216;Unit&#8217; properties; which do not have a direct influence on the texture baking sub-system. In other words, if objects are overly large they fall outside the capabilities of the renderer and its ability to read mesh data as that relates to the structure of a mesh, the locations of individual elements (faces and objects) and the lighting system used specifically for Ambient Occlusion bakes. The &#8216;fix&#8217; for this problem tends to require that terrain meshes be reduced down to a more manageable size, relative to Blenders default scale so the baking system can produce better results; this should be done before continuing on with any texture baking.<\/p>\n<blockquote><p><b>Design note<\/b>: much of what follows is best done to a &#8216;duplicate\/copy&#8217; of the original terrain being baked, which can remain intact &#8211; when scaling meshes use &#8220;<b>Transform<\/b>&#8221; properties, available in &#8220;<b>View Properties<\/b>&#8221; (&#8220;<b>N<\/b>&#8220;), this helps with regards to keeping track of Objects size and scale. This can also be aided holding &#8220;<b>Ctrl<\/b>&#8221; when scaling to snap to the grid.<\/p><\/blockquote>\n<div class=\"content_images\">\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/mesh-scale-relative-to-ref-when-baking-ao.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Original size of terrain mesh relative to NPC helper\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/mesh-scale-relative-to-ref-when-baking-ao_med.jpg\" alt=\"Original size of terrain mesh relative to NPC helper\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>Original size of the terrain mesh to be baked relative to an NPC helper (the relatively small red entity marker highlighted). Extremely large mesh objects tend to cause proportionally poor texture bakes &#8211; the larger the mesh size, the greater the potential for problems to occur<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/mesh-scale-when-baking-ao.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Rescaling a mesh to produce better texture bakes\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/mesh-scale-when-baking-ao_med.jpg\" alt=\"Rescaling a mesh to produce better texture bakes\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>Terrain mesh rescaled to a much smaller size relative to an NPC helper &#8211; used as a fixed reference point, the NPC helper is a game related indicator of game character sizes, ideally these should be used as part of the design process when making terrain<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-mesh-scale-small.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Ambient Occlusion from a relatively small scaled mesh\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-mesh-scale-small_med.jpg\" alt=\"Ambient Occlusion from a relatively small scaled mesh\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>Re-scaling the terrain mesh to a smaller size relative to Blenders scene default, baking ambient occlusion will produce &#8216;maps&#8217; with a more natural and evenly distributed spread between &#8216;lights&#8217; and &#8216;darks&#8217; based on the objects physical characteristics<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-mesh-scale-medium.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Terrain mesh starts to 'bleech' due to it's size\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-mesh-scale-medium_med.jpg\" alt=\"Terrain mesh starts to 'bleech' due to it's size\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>The same object scaled up 100x starts to exhibit problems. Relative to the scenes lighting, because the renderer can&#8217;t determine shapes and distance properly at this scale &#8211; it is literally seeing distance as being either too far, or too close with nothing in between &#8211; the results of baking tend to &#8216;flatten&#8217; out&#8230;<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-mesh-scale-large.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Extremely large mesh causes problems for ambient occlusion\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-mesh-scale-large_med.jpg\" alt=\"Extremely large mesh causes problems for ambient occlusion\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>&#8230; until making the mesh 1000x larger results in only the very obvious of features being baked to ambient occlusion because the render engine is only seeing the mesh in terms of everything being either too far or too close. Currently there isn&#8217;t a workable way around this problem except to temporarily rescale the mesh (a duplicate) too a smaller size before baking<\/p>\n<\/div>\n<p><a id=\"texturedensity\" name=\"texturedensity\"><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Terrain_Texture_Density\"><\/span>Terrain &amp; Texture Density<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Aside from the scale of a terrain mesh effecting how well shading is represented as ambient occlusion, generally speaking the primary concern with baking such an object is its relative &#8220;<b>Texture Density<\/b>&#8220;. Put simply this relates to too small a texture being mapped to too large an area (or object), resulting in said image pixelating when assigned. There isn&#8217;t really a way around this when using standard, &#8216;static&#8217; meshes for terrain; the inherent nature of baking textures requires the use of &#8216;unique&#8217; assets generally mapped on a 1:1 basis (the entire object is mapped within the bounds of available &#8220;Texture Space&#8221;). Invariably then, this means there will be pixelation to some degree when using this technique on terrain (or any type of model for that matter).<\/p>\n<p>In the images below for example, if the terrain mesh is UVW mapped and textured on a 1:1 scale (<i>assuming for the sake of argument that 1 &#8220;pixel&#8221; equates to 1 &#8220;unit&#8221; of measurement<\/i>), it will result is pixelation because a 1024&#215;1024 image is being used to cover an object that&#8217;s perhaps four or five time larger than the image itself &#8211; a 1:4+ ratio difference between &#8216;terrain&#8217;, &#8220;1:&#8221;, and &#8216;texture&#8217;, &#8220;:4&#8221; (1024:4096+). Conversely, mapping an image to too small a ratio, 4+:1 perhaps, means that whilst a much better texture density can be had, the mesh can no longer be baked; because the image repeats (tiles) over the object it ceases to be unique, and for all intents and purposes, is thus unbakeable.<\/p>\n<p>This presents something of a problem that can be expressed by a simple question; &#8220;<i>how can a terrain be baked so as to use unique assets, without risking the decrease in clarity due to low pixel density?<\/i>&#8220;. Whilst the answer is <b><i>always<\/i><\/b> one of compromise, and based firmly in the capabilities of a given technology (game or interactive engine), the general solution is to either <b>split the UVW map into sections<\/b>, <b>use more textures\/materials<\/b>, and\/or do a combination of the two.<\/p>\n<div class=\"content_images\">\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/texture-density-low-ratio.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Texture mapped with'low' density leading to pixelation\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/texture-density-low-ratio_med.jpg\" alt=\"Texture mapped with'low' density leading to pixelation\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>The initial and basic UVW map has the texture applied to the terrain mesh on a 1:1 ratio &#8211; UVW&#8217;s are mapped within the &#8216;bounds&#8217; of available &#8220;<b>Texture Space<\/b>&#8221; &#8211; making it appear relatively low resolution<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/texture-density-high-ratio.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Texture 'tiled' over mesh with 'high' density\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/texture-density-high-ratio_med.jpg\" alt=\"Texture 'tiled' over mesh with 'high' density\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>On the other hand, increasing the apparent resolution of the UVW map\/texture relationship now means that, whilst the image has much better &#8216;density&#8217;, it cannot be baked because the texture mapping is no longer &#8216;unique&#8217;<\/p>\n<\/div>\n<p><a id=\"splituvw\" name=\"splituvw\"><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Terrain_Splitting_UVW_Single_Textures\"><\/span>Terrain, Splitting UVW &amp; Single Textures<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Splitting a UVW map into sections is determined by how many, and how large a given texture asset is. However, it&#8217;s not as simple-a-matter as mapping the UVW&#8217;s to whatever assets are available and &#8216;job&#8217;s done&#8217;, to use an colloquialism; terrains are typically very awkward shapes, which means it&#8217;s often difficult to capitalise on their respective layout such that UVW seam placement is unobtrusive and logically advantageous at the same time. As there isn&#8217;t a shortcut to this process a certain degree of trial-and-error will be necessitated with respect to marking edges for the best layout of the map relative to the object and texture assigned to it.<\/p>\n<p>Being mindful of the two main points raised above then &#8211; 1) hiding seams and 2) taking advantage of any natural shapes for their placement &#8211; use &#8220;<b>Mark Seam<\/b>&#8221; to split the layout and then &#8220;<b>Unwrap<\/b>&#8221; everything again. This time Blender will do its best to redistribute the sections more efficiently relative to the texture and the size of each UVW segment. Some minor editing may be necessary but the end result should be a map with better clarity (to varying degrees) than previous attempts, when the UVW was a single &#8216;lump&#8217;.<\/p>\n<blockquote><p><b>Design note<\/b>: when using this approach to mapping large terrains it&#8217;s important that, had the mesh been physically split into separate objects as an aid to the process, any loose or separated parts be reconnected (select each object and press &#8220;<b>J<\/b>&#8221; to &#8220;<b>Join<\/b>&#8220;) and &#8220;<b>Remove Doubles<\/b>&#8221; used, else texture bake will interpret splits as &#8216;hard&#8217; edges (effectively &#8216;mesh smoothing&#8217;), baking them as such (hard lines) into the resulting ambient occlusion texture.<\/p><\/blockquote>\n<div class=\"content_images\">\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-uvw-mark-seam-spllits.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Using &quot;Mark Seam&quot; to split UVW map\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-uvw-mark-seam-spllits_med.jpg\" alt=\"Using &quot;Mark Seam&quot; to split UVW map\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>Using &#8220;<b>Mark Seam<\/b>&#8220;, split the terrain UVW into a series of smaller isolated &#8216;islands&#8217; as a means to &#8216;optimise the overall layout and better the texture density and distribution of UVW&#8217;s over large object<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-uvw-islands-wire.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Wire view of the terrain with 'Seams' marked\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-uvw-islands-wire_med.jpg\" alt=\"Wire view of the terrain with 'Seams' marked\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>&#8220;<b>Wire<\/b>&#8221; view of the same mesh showing the layout of &#8216;seams&#8217; marked around the mesh, each one will form an separate area within the overall UVW map<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-remapped-uvws.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Re-mapping the UVW's after 'seam' splitting\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-remapped-uvws_med.jpg\" alt=\"Re-mapping the UVW's after 'seam' splitting\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>Re-mapping the terrains UVW&#8217;s after using seams to split the map. Note that Blender will try a &#8216;best fit&#8217; approach to distributing the newly created islands into available texture space whilst keeping UVW&#8217;s relative to each other (ensures texture density is approximately equal for each segment)<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-rebaked-ao-split-uv-single-texture.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Re-baked ambient occlusion based on split UVW maps\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-rebaked-ao-split-uv-single-texture_med.jpg\" alt=\"Re-baked ambient occlusion based on split UVW maps\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>Depending on the distribution of the UVW&#8217;s after being split, it may not be immediately apparent any improvements have been made, as in the example above, when compared to the original, single UVW map baked below<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-original-single-uvw-map-bake.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Original AO bake based on Blender default UVW unwrap\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-original-single-uvw-map-bake_med.jpg\" alt=\"Original AO bake based on Blender default UVW unwrap\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>The original default UVW unwrap<\/p>\n<\/div>\n<p><a id=\"multipletextures\" name=\"multipletextures\"><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Terrain_Split_UVWs_Multiple_Textures\"><\/span>Terrain, Split UVW&#8217;s &amp; Multiple Textures<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Although splitting a terrain UVWs and mapping them to a single texture is relatively straightforward, for very large or complex objects that particular approach generally doesn&#8217;t provide the kind of quality typically needed for terrain. In these situations the alternative is to map the overall UVW to a number of separate textures, the advantage being that the general distribution ratio of <i>UVW texture space<\/i> to <i>texture density<\/i> can be better controlled and equalised to ensure each segment of the terrain uses proportionately the same or similar density as other sections. To make using this approach easier to manage it&#8217;s best to use a number of separate Materials, each assigned to a specific section of the mesh &#8211; depending on texture availability this may also means each having its own texture image assignment.<\/p>\n<blockquote><p><b>Design note<\/b>: breaking the UVW into sections and using separate textures also means being able to control density better from the point of view of what the player can see, increasing it where they directly interact with their surroundings, i.e. the ground underfoot, versus less detail for distant elements, i.e. hills along the horizon.<\/p><\/blockquote>\n<p>In Edit mode create a number of additional Materials and assign each to a specific part of the mesh. Then using the &#8220;<b>UV\/Image Editor<\/b>&#8220;, &#8216;map&#8217; the UVW associated with each section to their respective texture image. Repeat the entire process per separate material\/image\/mesh section. The end result should be a terrain with several Materials and UVW&#8217;s mapped to separate textures.<\/p>\n<blockquote><p><b>Design note<\/b>: before creating and assigning any additional materials, select the entire mesh and click the &#8220;<b>Assign<\/b>&#8221; button under the <b>Material List<\/b>, this ensures the active entry is set as &#8216;default&#8217;, else any new material upon assignment may inadvertently over-ride what&#8217;s already present on the mesh. To create a new material entry click the &#8220;<b>+<\/b>&#8221; button to the right of the <b>Material List<\/b> and then the &#8220;<b>+ New<\/b>&#8221; button below once the new data becomes available. Select a group of faces around the mesh, make sure to select the new Material from the Material List and then click the &#8220;<b>Assign<\/b>&#8221; button to make the material\/mesh association. For clarity change the &#8220;<b>Diffuse<\/b>&#8221; property where necessary to distinguish the additional Material entries from each other. Finish up by adding a new set of &#8220;<b>Texture<\/b>&#8221; and &#8220;<b>Image<\/b>&#8221; properties per each subsequent Material, then finally add either an available <b>bitmap image<\/b> or a <b>generated texture<\/b>.<\/p><\/blockquote>\n<div class=\"content_images\">\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-multiple-materials-textures.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Using multiple textures on a terrain\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-multiple-materials-textures_med.jpg\" alt=\"Using multiple textures on a terrain\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>Using additional materials the terrain mesh is broken down into a number of sub-sections, each remapped to its own texture &#8211; note that re-mapping the UVW&#8217;s and using the default &#8220;<b>Unwrap<\/b>&#8221; produces disproportionate mapping; the pixel density differs between each as Blender attempts to use as much texture space as possible per UVW<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-1.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Default UVW mapping assigned to Material '1'\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-1_med.jpg\" alt=\"Default UVW mapping assigned to Material '1'\" width=\"640\" height=\"393\" border=\"0\" \/><\/a><\/p>\n<p>Ground plain section separated into it&#8217;s own UVW\/texture assignment<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-2.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Default UVW mapping assigned to Material '2'\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-2_med.jpg\" alt=\"Default UVW mapping assigned to Material '2'\" width=\"640\" height=\"393\" border=\"0\" \/><\/a><\/p>\n<p>Hillocks separated and mapped<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-3.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Default UVW mapping assigned to Material '3'\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-3_med.jpg\" alt=\"Default UVW mapping assigned to Material '3'\" width=\"640\" height=\"393\" border=\"0\" \/><\/a><\/p>\n<p>Surrounding cliff section separated and UVW mapped<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-4.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Default mapping assigned to Material '4'\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-4_med.jpg\" alt=\"Default mapping assigned to Material '4'\" width=\"640\" height=\"393\" border=\"0\" \/><\/a><\/p>\n<p>Plateaux separated and UVW mapped<\/p>\n<\/div>\n<p><a id=\"smalleruvws\" name=\"smalleruvws\"><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Breaking_Large_UVWs_into_Smaller_Sections\"><\/span>Breaking Large UVW&#8217;s into Smaller Sections<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In splitting the UVW&#8217;s up as discussed above, a problem occurs which relates to the way Blenders mapping defaults to a &#8216;best-fit&#8217; assignment which causes texture density to differ across the objects as a group. Usually the fix for this is to simply rescale the UVW&#8217;s. However, this can further result in smaller areas having a disproportionately lower texture density (assuming all textures are 1024&#215;1024, the larger UVW segments are being mapped to the same sized image as smaller ones). To address this problem the large UVW maps are broken down further still into smaller units that can then be better re-mapped and redistributed within the allotted texture space (whilst still mapped to the same image).<\/p>\n<p>Shown below for example, the default mapping for the &#8216;ground&#8217; plain means it&#8217;s disproportionate to other areas of the terrain, leading to uneven texture density issues across the set of elements (or objects if each mesh area were detached). To get around this problem the area is split into a number of smaller sections that, when remapped, will have a better distribution which should increasing texture density.<\/p>\n<div class=\"content_images\">\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-1.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Single large UVW has low texture density\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-material-1_med.jpg\" alt=\"Single large UVW has low texture density\" width=\"640\" height=\"393\" border=\"0\" \/><\/a><\/p>\n<p>The default mapping of the ground plain (shown with other sections) results in different texture densities for each part of the mesh due to Blenders &#8216;best fit&#8217; scaling of UVWs within the bounds of a texture<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-segmented-uvw-map.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Segmenting the UVW map of a section further for better texture density\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-segmented-uvw-map_med.jpg\" alt=\"Segmenting the UVW map of a section further for better texture density\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>Larger UVW map sections will need to be further broken down into smaller parts for better unwrapping &#8211; splitting the UVW like this usually allows each section to be repositioned using a larger area of texture than otherwise would be had if still attached to the larger mapping<\/p>\n<\/div>\n<p>Do this to all the sections with the aim of evenly distributing the UVW&#8217;s and texture density so each is approximate to the other, or in other words making sure to produce an overall mapping that&#8217;s more uniform across each component of the terrain as that relates to the group of materials\/sections. Once the UVW mapping has been corrected, ambient occlusion can then be baked as normal, this time producing a series of images each of which belongs to one section of the mesh. These will then need to be saved.<\/p>\n<blockquote><p><b>Design note<\/b>: when using this approach it&#8217;s important the mesh remain intact and whole else the bake process will interpret splits and division as &#8216;hard&#8217; edges, baking them to any subsequent maps. In addition, attention needs to be paid, where-ever possible, the the &#8216;joints&#8217; between UVW maps; it&#8217;s more-or-less inevitable that due to the way UVW mapping works, there will be a slight differences in texture density between sections &#8211; because of UVW distortions &#8211; which will manifest in bakes as lines or differences in pixelation.<\/p><\/blockquote>\n<div class=\"content_images\">\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-uvw-redistribution.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Terrain UVW map after being properly prepared\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-uvw-redistribution_med.jpg\" alt=\"Terrain UVW map after being properly prepared\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>The end result of using several textures each with their own re-mapped area of the terrain is a much more evenly distributed density and\/or one that can be better optimised by changing density depending on how or where the player will be or what they can see<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-uvw-redistribution-ao-baked.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" title=\"Final rebaked ambient occlusion after adjustments\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/blender_ao_terrain_bake\/optimise-terrain-uvw-redistribution-ao-baked_med.jpg\" alt=\"Final rebaked ambient occlusion after adjustments\" width=\"640\" height=\"360\" border=\"0\" \/><\/a><\/p>\n<p>An ambient occlusion map baked from this type of set-up is usually of much better quality because of the increased texture density attributed to each segment of the overall terrain UVW map<\/p>\n<\/div>\n<p><a id=\"conclusion\" name=\"conclusion\"><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Terrain is generally quite tricky to work with because its often composed of awkward shapes and forms. The challenge here is to unwrap these shapes whilst at the same time as keeping the pixelation associated with such large models down to a minimum. However, other tricks and techniques can be used to obscure this fact; breaking terrains into blocks (1024&#215;1024 &#8216;unit&#8217; models for example); adding a &#8216;detail&#8217; stage to an in-game material or shader to mask relatively low resolution images; using additional UVW layers which specifically hold light or ambient occlusion maps, freeing up the main UVW layer for tiled texturing, and so on. Each approach, having it&#8217;s own &#8216;Pros and Cons&#8217;, needs to be considered alongside any limitations or criteria set in place by a given game engine or real-time technology. With a bit of forethought and\/or pre-planning, baking ambient occlusion shouldn&#8217;t present too many problems, the key being to accept that there will be some level of &#8220;compromise&#8221; necessary; it&#8217;s never going to be possible to rely solely on texture baking of any description to hide the fact that a terrain is an extremely large modelled object.<\/p>\n<div class=\"subNav\">[<a href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain\/\" title=\"baking ambient occlusion maps for terrain\" target=\"_self\" rel=\"noopener\">Page 1 &#8211; intro &amp; how to<\/a> | <a href=\"https:\/\/www.katsbits.com\/site\/baking-ambient-occlusion-maps-for-terrain-advanced\/\" title=\"advanced options baking ambient occlusion maps for terrain\" target=\"_self\" rel=\"noopener\">Page 2 &#8211; advanced options<\/a>]<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":1179,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[234,231,18,276,277,278,25,317,318,316,257,239],"class_list":["post-848","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-ambient-occlusion","tag-bake","tag-blender","tag-blender-2-5x","tag-blender-2-6x","tag-blender-2-7x","tag-materials","tag-optimising","tag-optimizing","tag-terrain","tag-texture-bake","tag-uv-editing"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/comments?post=848"}],"version-history":[{"count":5,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/848\/revisions"}],"predecessor-version":[{"id":1182,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/848\/revisions\/1182"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/media\/1179"}],"wp:attachment":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/media?parent=848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/categories?post=848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/tags?post=848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}