# Blender LOD Tools This add-on enables **real-time LOD preview and screen size authoring** directly in the Blender viewport. The aim of this tool is to speed up the LOD setup process by reducing the need to export and switch back and forth between Blender and the simulation. This tool is designed to be used for any kind of model that can be used in Microsoft Flight Simulator, whether it is a SimObject like an aircraft: {{< video-center src="3_Models_And_Textures\Plugins\BlenderPlugin\LODTools\lodtools_demo_da62.mp4" >}} Or a static object designed for scenery: {{< video-center src="3_Models_And_Textures\Plugins\BlenderPlugin\LODTools\lodtools_demo_scenery.mp4" >}} The add-on generates **LOD Viewer** objects in your scene for each LOD group defined in the [MSFS 2024 exporter](../the-blender-exporter/), and each LOD Viewer will use a *Geometry Nodes modifier* to emulate the [LOD selection system](../../../modeling/lods/lod-selection-system/) of the simulation engine. Note that the LOD Viewers directly use the objects in you scene, so there is no need to export any {{< glossterm >}}gltf{{< /glossterm >}} to be able to preview the LODs in Blender. {{< callout context="note" title="NOTE" icon="outline/bulb" >}} This add-on does **not** generate any LOD meshes, it is purely a visualisation and optimisation aid. {{< /callout >}} ### LOD Viewer Generation Before using the LOD Viewer tool, the object LODs must be set up in the [MSFS 2024 exporter](../the-blender-exporter/) panel, as the tool will use the export hierarchy in the visualisation process. Once that is done you can then do the following: - Open the LOD Tools from the right side panel and then click the **Generate LOD Viewers** button to create the LOD Viewer objects for your scene. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/generate_button.png" alt="Generate Button" >}} - A settings pop-up will appear with the following options: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/generate_popup.png" alt="Generation options" >}} {{< table-wrapper "250px" >}} |Option | Description | | --- | --- | | **Align LOD Viewer To Source** | Places each LOD Viewer at its source object's location. When disabled, viewers are placed at the world origin. | | **Offset** | Offsets LOD Viewers along the chosen axis so source and LOD Viewer objects are visible side by side. The offset distance equals the scene's bounding box size along that axis. | | **Target** | Chooses which objects get LOD Viewers. Select **All** to generate for the whole scene, or **Checked** to pick specific LOD group entries from the list. | {{< /table-wrapper >}} - In **Checked** mode, the **Target** list is displayed and shows one entry per LOD group found in the exporter (see [here](#lod-group-detection) for more information). {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/generate_target_list.png" alt="Exporter LOD Groups and their corresponding entries in list." >}} - You can filter entries using filters in the bottom panel: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/generate_target_list_filter.png" alt="List Filter" >}} - Click **Okay** to generate the viewers. A new **--LOD Viewers--** collection is created, containing one LOD Viewer per chosen LOD group. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/generated_after_checked.png" alt="Generated LOD Viewers" >}} Once this has been completed, you will be able to see a visualisation of the LODs, next to a list of the source objects, and the viewport has automatically switched to the **LOD Camera** mode (shown by the "LOD Camera Active" label at the top of the viewport), letting you move around and see LOD transitions update in real time. From now on, when needed, you can select LOD Viewers and adjust their location in the scene. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/da62_source_next_to_lod.png" alt="Source objects on the Left, and LOD Viewers on the right" >}} ### Regenerating After Edits Any time you move or edit source objects, or add/remove LODs from an exporter LOD Group, you will have to **regenerate LOD viewers**. If you don't do this, the LOD preview and stats (vertex count, bounding sphere size, LOD origins, etc...) **will not be correct**. The process for regenerating the LOD preview is simplly a case of clicking **Generate LOD Viewers** again to rebuild them (existing LOD Viewers are deleted and recreated). Note that you can hold {{< input "Shift" />}} while clicking the **Generate LOD Viewers** button to skip the popup and reuse the last-used settings. ### Clearing LOD Viewers At any time you can click the {{< image-icon src="images/3_Models_And_Textures/Plugins/Blender/LodTools/clear_button_icon.png" alt="Clear LOD Button" >}} **Clear LODs** button to stop the LOD preview and remove all LOD Viewers from the scene. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/clear_button.png" alt="Clear LOD Viewers Button" >}} ### Rules for LOD Viewer Objects LOD Viewers are *objects* with a **Geometry Node Modifier** that emulates the simulation render engine [LOD selection system](../../../modeling/lods/lod-selection-system/): {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_viewer_modifier.png" alt="LOD viewer modifier" >}} The following rules should be followed when working with LOD Viewers: - You cannot edit LOD Viewer objects - You cannot remove LOD Viewer object modifiers. - LOD Viewers can be moved and rotated, but *cannot* be scaled or duplicated. ### LOD Group Detection LOD Viewers are generated from the LOD groups found in the exporter panel hierarchy, which is why the [Blender Exporter](../the-blender-exporter/) must be set up before creating LOD Viewers. Note that in the exporter, when using the **Objects** or **Collections** mode, you may need to press the **Reload LOD Groups** button before generating LOD Viewers. - *LOD groups and their associated LOD Viewers with exporter set to **Objects** mode :* {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_groups_objects_mode.png" alt="Example of LOD Groups and their associated LOD Viewers in Objects mode" >}} - *LOD groups and their associated LOD Viewers with exporter set to **Collections** mode :* {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_groups_collections_mode.png" alt="Example of LOD Groups and their associated LOD Viewers in Collections mode" >}} - *In **Presets** mode, a LOD group is a preset group containing one preset per LOD, ordered alphabetically:* {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_groups_presets_mode.png" alt="Example of LOD Groups and their associated LOD Viewers in Presets mode" >}} {{< callout context="caution" title="Warning" icon="outline/alert-triangle" >}} LOD Groups that have only one LOD0, or that have Auto LOD enabled are ignored. {{< /callout >}} ### LOD Viewer Origin LOD Viewer objects use the same origin they would have when exported as {{< glossterm >}}gltf{{< /glossterm >}}, since this ensures a correct preview for modular scenery and aircraft. However, export settings that reset object transforms during export *are* supported, including those with [Reset Origins](../the-blender-exporter/#reset-origins) in the exporter settings where both modes are supported - ##### All Roots {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/origin_reset_all_roots.png" alt="Reset Origin 'All Roots' is supported" >}} - ##### Per Objects {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/origin_reset_per_object.png" alt="Reset Origin 'Per Object' is supported" >}} {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/object_transform_reset.png" alt="Reset Origin 'Per Object' is supported" >}} {{< callout context="caution" title="IMPORTANT!" icon="outline/alert-triangle" >}} If you modify these export settings, you **must** regenerate the LOD Viewers to update the preview. {{< /callout >}} ### Render Preset The Render Preset controls the LOD Factor, which determines how screen size is scaled in-game, and it emulates the simulation render presets andset by the **Objects Level of Detail** render setting: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_factor_game.png" alt="Render Preset Settings" >}} The render preset being used can be set in the LOD Tools panel. However, if needed, you can override this global setting and set the LOD Factor manually using the {{< image-icon src="images/3_Models_And_Textures/Plugins/Blender/LodTools/render_preset_icon.png" alt="Render Preset Button" >}} Render Preset button (here a LOD Factor of `1` corresponds to `100%` in the simulation settings, `0.5` to `50%`, etc...): {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/render_preset_ui.png" alt="Render Preset Settings" >}} The Render Preset can be changed in real time and will directly affect the LOD preview: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_factor_edit.gif" alt="LOD Factor edition" >}} {{< table-wrapper "150px" "" "150px" >}} | Preset | Description | LOD Factor | | -------- | ----------- | ---------- | | `Low` | Lower-detail LODs appear much sooner. | 0.25 | | `Medium` | Lower-detail LODs appear sooner than normal. | 0.5 | | `High` | Uses the provided screen size and intended visual quality. **This is the recommended preset when authoring LODs.** | 1 | | `Ultra` | Keeps high-detail LODs visible much farther from the camera. Best visual quality, with the highest performance cost. | 2 | {{< /table-wrapper >}} ### Screen Size Setup #### Screen Size From Exporter When the [Blender Exporter](../the-blender-exporter/) is set to **Objects** or **Collections** mode, created LOD Viewers will use the screen sizes set in the exporter panel. If a screen size is set to `0`, the tool falls back to the minimum screen size the engine computes from vertex count. In **Presets** mode, screen sizes cannot be set in the exporter, so LOD Viewers use the engine-computed minimum based on vertex count. **In this case, you can still edit these screen size values manually.** #### Editing Screen Size Screen sizes can be adjusted in real time from the right panel in the **Active LOD Viewer** tab, for example here we have adjusted the LOD0 screen size from 50% to 80%: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/screen_size_edits.gif" alt="Live Screen Size edits" >}} {{< callout context="caution" title="Warning" icon="outline/alert-triangle" >}} Screen sizes can also be edited directly on the modifier, but using the dedicated panel is recommended. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/screen_size_edit_advice.png" alt="Use dedicated Panel instead of LOD Viewer modifier panel" >}} {{< /callout >}} Note that: - You can press {{< input "alt" />}} + {{< input "enter" />}} while editing a screen size field to apply the same value to *all* selected LOD Viewers. - You can also *right-click*{{< mouse-press "right" >}} a field and choose **Copy Single To Selected**. #### Sending Screen Sizes to the Exporter Click **Send to exporter** to push your screen size edits back to the exporter panel. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/send_to_exporter.gif" alt="Use dedicated Panel instead of LOD Viewer modifier panel" >}} The **Send to exporter** popup lets you choose which LOD Viewer screen sizes to send: - **Active LOD Viewer** - Sends the screen sizes of the active LOD Viewer. - **All LOD Viewers** - Sends the screen sizes of all LOD Viewers. - **Selected LOD Viewers** - Sends the screen sizes of the selected LOD Viewers. Each LOD Viewer screen size setup is sent to the exporter individually. Note that the **Send to exporter** option is available when the exporter is set to **Objects** or **Collections** mode, but *disabled* in **Presets** mode. In **Presets** mode, *screen sizes must be copied manually into the XML files*. ### LOD Camera LOD transitions are only visible while **LOD Camera** mode is active, which can be toggled with the LOD Camera button: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_camera_toggle.gif" alt="LOD Camera Toggle" >}} Camera **Focal Length** can be tweaked using the view panel, and will have a direct effect on LOD preview (You may have to increase the clip end value when viewing a LOD from a far distance): {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_camera_fov.gif" alt="LOD Camera FOV" >}} Note that only one 3D viewport can have the LOD Camera enabled at a time, but you can easily switch between viewports using the LOD Camera button. In the image below, we set LOD Camera in another view: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/lod_camera_viewport_switch.gif" alt="LOD Camera FOV" >}} In addition you have the following extra controls: - Use the {{< input "ctrl" />}} + {{< input "space" />}} hotkey combo to switch to fullscreen. - You can create a new window using the **Duplicate Area Into New Window** button and enable the LOD Camera inside it. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/duplicate_area.png" alt="New Window" >}} - For smooth zoom in/out, you can hold {{< input "ctrl" />}} + *middle mouse button*{{< mouse-press "middle" >}} in viewport. ### Debug Features Some of these debug features reproduce those available in the simulation, and they can be toggled by checking/unchecking the "Debug" checkbox. - ##### Active LOD Viewer Stats Displays active LOD Viewer statistics in a table shown in the bottom-left corner (active LOD stats are highlighted in orange): {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/active_lod_viewer_stats.png" alt="Active LOD Viewer Stats" >}} {{< callout context="note" title="NOTE" icon="outline/bulb" >}} **Vertex count reflects the in-simulation count** (accounting for UVs, normals, vertex colors, and other attributes), not the raw Blender count. It may deviate slightly from the engine's result but they should be close enough for analysis of your models. {{< /callout >}} - ##### Debug Text overlays Display an overlay on top of each LOD Viewer object in the viewport (including: *LOD Name*, *LOD Index*, *LOD Screen Size*, *LOD Min Size*, *LOD Distance* and *Vertex Count*): {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/debug_lod_text.png" alt="LOD Debug" >}} - ##### Display Bounding Spheres Display the bounding spheres as wireframes around the objects: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/display_bounding_sphere.gif" alt="Bounding sphere Debug" >}} - ##### Force Active LOD This ignores the LOD Camera and forces a specific LOD index: {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/force_active_lod.gif" alt="Force Active LOD" >}} ### Tips #### Hide Collision / Occluders - Disabling **Show in Viewport** for individual source objects (or an entire collection) in the Outliner using the {{< image-icon src="images/3_Models_And_Textures/Plugins/Blender/LodTools/tv_icon.png" alt="" >}} button will also hide them in the LOD Preview. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/hide_objects_in_preview.gif" alt="Hide Objects In Preview" >}} - Keeping collision and occluder objects in dedicated collections makes it easy to hide them all at once during LOD Preview. - You can hold {{< input "ctrl" />}} while clicking on the {{< image-icon src="images/3_Models_And_Textures/Plugins/Blender/LodTools/tv_icon.png" alt="" >}} button to hide the entire collection. #### Improving Viewport Performance LOD Preview can slow down the viewport when previewing hundreds of object LODs. To improve the FPS you can: - Hide the source objects, which can give a significant performance boost. Hiding source objects using the {{< image-icon src="images/3_Models_And_Textures/Plugins/Blender/LodTools/eye_icon_outliner.png" alt="" >}} button in the Outliner does *not* affect the LOD Preview. {{< image-center src="images/3_Models_And_Textures/Plugins/Blender/LodTools/hide_source_objects.png" alt="Hide Source Objects" >}} - Limit the number of LOD Viewers by selecting fewer items in the **Generate LOD Viewers** panel.