Mesh Decimation#
In the collected asset folder from the previous section there are several JSON files, one for each USD file in the project. These JSON files are Scene Optimizer presets and contain instructions on which meshes should decimated, and how to decimate them.
In this example, we are decimating some meshes using a max mean error of 0.03, and others a lower tolerance. The max mean error method of decimating is a quality-based metric that tells the decimator to not allow the surface to deviate more than this number (in cm) away from the original surface. This allows the method to be used on both high and low mesh densities without having to worry about introducing bad results. A percentage-based decimation would remove some percentage of polygons, which may be bad if you have a low resolution mesh.
These presets are authored by using the Scene Optimizer Framework. To author a preset, open any stage in your project and run a Scene Optimizer operation. If you are not satisfied with the result, reopen the stage, change the variables, and try again. When you receive a satisfactory result, save the preset. Finally, copy the presets into the source project. The extension automatically finds and copies these presets on collect and applies them using the Scene Optimizer Framework when running optimization. Note that the extension only decimates meshes that are native to each USD file as it batch processes all the USD files in the collected folder headlessly.
If a stage JSON preset is not found, optimization reverts back to a user-specified global preset (Optimizer Config field). If the preset is empty, it reverts back to a global preset supplied with the Configurator Publisher Extension. For the Configurator Publisher global preset, you must input the Optimizer Max Mean Error you would like to use for global decimation.
If you take a look at ../Ingest/ConceptCar_3xf_model.json
you see that interior meshes are decimated more than the exterior ones because they have a larger max mean error value. Currently, all stages should have a JSON preset. If you would like no meshes to be affected, you may have a preset that does not do anything (if not, the extension reverts back to global presets as described above).
[
{
"operation": "decimateMeshes",
"paths": [
"/World/ConceptCar_3xf/ConceptCar/carInterior"
],
"reductionFactor": 0.0,
"maxMeanError": 0.03,
"guideDecimation": 0,
"cpuVertexCountThreshold": 100000,
"gpuVertexCountThreshold": 500000
},
{
"operation": "decimateMeshes",
"paths": [
"/World/ConceptCar_3xf/ConceptCar/carExterior",
"/World/ConceptCar_3xf/ConceptCar/wheelsAll"
],
"reductionFactor": 0.0,
"maxMeanError": 0.01,
"guideDecimation": 0,
"cpuVertexCountThreshold": 100000,
"gpuVertexCountThreshold": 500000
}
]
Open the collected product_configurator_base.usd
file. The RTX scene statistics can be found under Windows > Utilities > Statistics under the RTX Scene scope. This shows how many polygons and vertices are in the stage.
Memory usage appears in the application’s heads up display.
Check Optimize at the bottom of the Configurator Publisher.
Select Run Process.
Note
Optimizer Config and Optimizer Mean Error are optional settings for global or user-provided global optimizer presets as described above and not used in this example because every stage has a JSON file.
When the asynchronous functions finish, reopen the file and return to the Statistics window to compare the RTX stats. You should see roughly 85% of the polygons have been eliminated with minimal loss in visual fidelity. The screenshot also includes the texture scaling described below.