Skip to end of metadata
Go to start of metadata

Introduction

LOD Generator acts a single integrated tool within the Sandbox Editor that facilitates the generation of both geometry LODs and material LOD's for the static geometry. Integration with the editor source control means all files are automatically added to source control change list.

Integration with the editor's python scripting allows the LOD's to be generated autonomously as part of a batch system or overnight process. All settings are saved as an XML file so that future work on the same asset will be quick and easy to replicate.

Icon

LOD Generator in CRYENGINE 5.4 will not work properly with Vulkan APIs. It is recommended to use the existing rendering pipeline.

Icon

The LOD Generator was removed in a recent release build. Users are advised to create LODs in their 3rd-party DCC tools.

User Interface

To access the LOD Generator, open the CRYENGINE Editor and navigate to the Lod Generator option from the Tools menu.

The initial state of the tool shows you the geometry-generating section, however, if you're just interested in generating material you can skip the following sections and go directly to the MaterialGenerationPanel section.

Source File Overview

The source file panel lets you load an asset into the LOD Generator either by browsing for the specific file, or selecting the asset in the viewport and clicking Use Selected Asset.

From left to right and top to bottom a brief description of the controls:

OptionDescription
Source CGF PathThis is the path to the CGF the LOD tool will use for generating.
Open File ButtonThe user can click this to browse to and find a specific CGF to load.
Use Selected ButtonThe user can click this to load the model they currently have selected in the viewport.
Material PathAfter loading a CGF the material path displays the file path of the material that will be used during the generation process.
Material Editor ButtonClicking this will open the material editor at the specified material allowing a user to check and tweak the material if required.

Geometry Bake Options

These are automatically set to keep the bake time reasonable (30s -> 3m) but could require tweaking. At the very least make sure bObjecthasbase is correctly selected.

Geometry Bake OptionDescription
nSource LODDefines the source LOD from which the LOD chain will be generated.
bObjecthasbaseWhen enabled, it considers the entire views from below the origin. This effectively halves the views specified in "View elevations".
fViewResolutionAlters the resolution of the views. The LOD generator judges if a change is good by considering what the object looks like from many views. A low value means quicker results but potentially worst accuracy. This is in pixels per meter.
nViewsAroundControls the number of views around the Z axis at each elevation. See diagram below.
nViewElevationsControls the number of views in the Z axis. See diagram below.
fSilhouetteweightingControls how important the silhouette is considered (in multiples of the object radius).
i.e. A setting of 50 means a one-pixel silhouette change is equal to 50 pixels moving from the front of the object to the back.
fVertexweldingBefore starting the LOD generation process, vertices within this distance will be welded together. Be warned this can create bad geometry that interferes with the topology check.
bCheckTopologyAvoids moves that will create "bowties" (a vertex connects two faces that don't share an edge) or "flaps" (an edge has more than 2 faces connected to it).
This helps the LOD generator from creating bad geometry (which can lead to messy results).
However, some models have this type of geometry, to begin with, which could mean the LOD baker does not move these vertices at all. In this case, you should turn off the topology check.
bWireframeThis option will render the LOD preview in a solid white color.
bExportObj When enabled, this will save an obj file per LOD to disk in the folder _obj.
bAddToParentMaterialWhen enabled, adds the new lod material to the parent else creates a separate lod material.
bUseCageMeshWhen enabled, uses a LOD cage for generating the LOD.
PreviewSourceLodThis option will give you preview panel displaying the source LOD.

Geometry Task Panel

Once the settings are correct then click Generate LOD Chain. This will create a number of models ranging from full polygon down to zero polygons (or the lowest number possible without violating the topology check).

This can take some time. The time scales with a number of views and resolutions.

Please note that the ETA is just an estimate. If the generation is taking too long you can use the cancel button to stop and tweak the settings for better performance.

Geometry Generator Panel

The workflow for generating geometry should be to load the CGF to generate LOD's for, set up the geometry generation options, generate the LOD chain, specify required LODs for export and finally to generate the files and new sub-material.

Here you can preview a LOD at a given percentage specified by the key on the ramp at the bottom of the preview window. You can add as many LOD keys as the engine supports. The model shown is a wireframe version of the LOD.

The error graph shows how the error (as detected during the LOD'ing process) changes as the polygon count is reduced. This could be useful to hone in on sweet spots in the LOD. The graph also shows statistics about the currently selected LOD like its poly and vertex count.

Once you've selected the point in the LOD chain that looks acceptable you can add another LOD by double-clicking on the ramp. Any existing LOD's that the object has will automatically generate a key at the position matching the percentage of triangles to LOD has in relation to the source model.

Once you're happy with the LOD's you want to generate click 'Generate Geometry Files'. This will save each key to the specified LODs geometry file also generating UVs for the LOD model and creating a new custom sub-material in the Material file.

All these files will be added to a change list in source control should you have it enabled.

Material Bake Options

Creating Material LOD's for an assets geometry LOD's can be done in the same LOD tools, once you've selected the model in the file panel, if you generated geometry LOD's this will already be the case, you can set-up the options for baking each LODs material.

Material baking is done using two geometry models, the source LOD usually the high poly model and the destination LOD case, a low poly LOD model. Rays are cast through the models and the hits against the high poly model are used for sampling the pixel color value for the texture.

Material Bake OptionDescription
Ray Test LengthThe distance to ray cast for hits onto the surface of the source LOD.
Ray Start DistanceThe distance from the model to start the ray cast.
Bake Alpha Creates a diffuse texture with an alpha channel for objects that contain transparent geometry.
Bake Unique SpecularMapWhen checked, enables you to bake out the specular texture.
Smooth CageEnables smoothing the normals of the LOD cage to help reduce artifacts.
Dilation PassWill reduces filtering errors by filling in none baked areas.
Background Color
Used to fill any areas of the texture that didn't get filled by the ray casting.
Export PathThis is automatically filled out when the object is selected.
File name TemplateThis is automatically generated and should be left as default.
Diffuse Texture PresetRC preset for the Albedo Map texture.
Normal Texture PresetRC preset for the Normal Map texture.
Specular Texture PresetRC preset for the Reflectance Map texture.
Use Auto Texture SizeChoose the texture size based on the size of the object.

The main settings you will need to tweak here are Ray Test Length and Ray Start Distance, try baking with the default options before tweaking.

Individual LOD Settings

Each LOD has some individual settings that can be tweaked to customize the baking, mainly the texture resolution for the LOD.

At present, you can only tweak the first LOD's texture sizes and the subsequent LOD textures are set at a factor of two smaller than the first LOD's setting. Also, you can disable baking specific LOD's if you wish.

A preview of each generated texture will appear in the Diffuse, Normal and Specular panels once you have generated the textures. Also, a preview of the Source LOD that will be used to bake the LOD's textures down is displayed in the preview panel on the right.

Material Generate Textures

Once you're happy with the settings hit the Generate Textures button, the baking will begin and once finished the previews will be updated.

Automatically, the textures will be assigned to the correct Sub-Material and the Material will be saved.

All generated textures will be added to the change list in source control with the material ready for submission.

Here is the view of the folder after generation:

 

  • No labels