Clash Detection Bake API#
The Clash Detection Bake extension (included in the Clash Detection Bundle extension) is an API that allows baking the resulting meshes of a clash detection to a time-sampled OpenUSD layer. The time sampled OpenUSD layer containing the animated clash will be playing along with the existing animations.
The suggested integration of the Clash Detection Bake API is in the clash detection pipeline as a headless process. Nevertheless, a simple integration of the Clash Bake API has been added to the Clash Detection Window (reference implementation).
Reference implementation UI#
The reference implementation (omni.physx.clashdetection.ui extension) uses clash bake API to build an interactive UI for baking the clash meshes and materials that is integrated inside the Clash Detection Window.
It allows baking the clash meshes and materials on the fly, interleaving with the UI updates to keep it responsive.
It takes care of loading the baked layers in the session layer to show them in the main viewport when switching clash queries and provides buttons to save, reload and clear the baked layers.
A settings menu allows customizing the bake process and the visual options for the baked layers.
Typical workflow#
The typical workflow for baking clash meshes and materials on a given clash query is the following:
Create a new clash detection query or select an existing one. It can be dynamic or static.
Make sure to run the clash detection for the first time or update the results.
Click the
Bake Layer (OFF)button to open the sub-menu window (if not already enabled).Select
Enable Clash Bake Layer(if not already enabled).Select all the clashes for which to generate clash meshes from the clash detection results window.
Right Click on any of the selected rows to show the context menu.
Left click on
Generate Clash Meshesto start the bake process from the context menu.
The Generate Clash Meshes menu item will:
Remove all overlay clash meshes previously created for selected clash records
Generate all relevant overlay clash meshes for selected clash records
If the same mesh is impacted by multiple clashes, the API will generate a merged clash mesh, where relevant clash polygons will be highlighted at the right timecode
The generated meshes will respect the options configured in the Bake Layer menu (outlines, wireframe, clashing polygons, etc.)
After clicking the Generate Clash Meshes menu item:
A progress bar will appear inside the
Clash Detection Windowand the clash meshes will be baked in background. Depending on the batch size, the progress bar will update more or less frequently and the FPS may be affected accordingly.Once the bake process is completed, the highlights will be visible in the main viewport.
Scrolling the timeline will animate the highlights along with the keyframed animations of the original meshes.
To save the baked layer, click
Save Clash Bake Layersto save the progress to a .usd file that will be loaded automatically next time the same file is opened andEnable Clash Bake Layeris enabled.
Note
The clash baking process can be interrupted at any time by clicking on the clash detection window progress bar.
Use the
Clear Clash Meshesoption to remove all overlay clash meshes previously created for selected clash records.
Warning
When
Run Clash Detectionis clicked, the current clash bake layer will be cleared to avoid meshes added by it from being used in the clash detection, generating false / fake clashes between real geometry and their visual representation.The clash bake layer will NOT be saved to disk when
Run Clash Detectionis clicked, so if this has been done by mistake just pressReloadto restore the previous state (assuming the layer was saved before).
Layer Actions#
This section is only visible when the clash bake layer is enabled. It provides buttons to manage the baked data (save, reload, clear):
Save: Saves the clash bake layer for current query to persistent storage.Reload: Replaces content in the clash bake layer for current query with content from persistent storageClear: Clears all contents of the current clash bake layer.
Generation options#
This section is collapsed by default and controls the baking process behavior:
Keep DB Data in Memory(default: enabled):If enabled keeps the data for each baked record in memory to avoid reloading it.
As a downside it consumes additional memory.
Show Notification(default: enabled):If enabled shows a notification when the clash baking process is completed.
Finalize When Cancelled(default: enabled):If enabled finalizes meshes baked so far when the process is cancelled.
Batch Size(default: 5):Number of clashes to process in each batch, between each UI update.
Smaller batches will take longer to process updating the UI more frequently.
Larger batches will take less time to process updating the UI less frequently.
Visual options#
This section is collapsed by default and controls what visual elements get baked:
Use Selection Groups(default: enabled):If enabled uses selection groups to highlight the meshes during the clash.
Bake Clash Outlines(default: enabled):If enabled bakes clash outlines for each frame.
Bake Clash Meshes(default: enabled):If enabled bakes clones of the clashing meshes to highlight them with a different material or with the selection group.
The cloned meshes are visible for the entire duration of the clash.
When not using Layer API or when Use Selection Groups is disabled, the following additional options are visible:
Bake Wireframe(default: disabled):If enabled bakes wireframes on top of clashing polygons for each frame (high performance cost).
Bake Clashing Polygons(default: disabled):If enabled bakes time sampled clashing polygons for each frame (very high performance cost).
Outline Width Options:
These options control the width of outline edges:
Outline Size(float slider):Size of the outline in world space units.
Outline Scale(float slider):Scale factor for the outline width.
Developer options#
This section is collapsed by default and only visible when development mode is enabled (/physics/developmentMode==true):
USD Sdf Layer API(default: enabled): DEPRECATED.Sdf API will be the only one supported in future releases.
If enabled bakes using layer API instead of stage API.
Save as USD(default: enabled):If enabled saves as usd instead of usda.
Deprecated Options (Stage API mode only):
The following option is only visible when USD Sdf Layer API is disabled:
Bake Using Display Opacity(default: enabled): DEPRECATED.Sdf API will be the only one supported in future releases.
If enabled bakes using display opacity instead of hole indices.
Clash Bake Layer Creation#
A Clash Bake layer is created when
Enable Clash Bake Layeris enabled.A Clash Bake layer is always associated with a specific query, by its query ID.
When enabling a Clash Bake layer, two additional .usd files will be created in the same folder where the root layer of current stage lives.
One
.usdfile will start with the same file name as the root layer and end with_CLASH_MATERIALS.usd.One
.usdfile will start with the same file name as the root layer and end with_CLASH_QUERY_{query_id}.usdwhere{query_id}is the integer ID of the selected clash query.Both files will be saved in the same directory where the root layer lives.
Additional support files (for example
ClashMaterials.mdl) will be created in the same directory.A Clash Bake layer is loaded if an already existing file with the expected file name exists in the destination folder.
- Once a bake layer has been enabled for a given Clash Query, when switching to other queries other clash mesh layers will be created.
This allows to bake clash meshes for a given query, save the baked layer and then switch to other queries without having to bake again for each query.
As an example given a source root layer named cylinder_sphere_animated.usda that has 4 queries (with ID from 1 to 4), the generated files will be:
cylinder_sphere_animated_CLASH_MATERIALS.usdcylinder_sphere_animated_CLASH_QUERY_1.usdcylinder_sphere_animated_CLASH_QUERY_2.usdcylinder_sphere_animated_CLASH_QUERY_3.usdcylinder_sphere_animated_CLASH_QUERY_4.usdClashMaterials.mdl
Note
Clash Bake layers are added as an anonymous sublayer of the session layer.
Such layer will be saved / loaded from persistent storage using the
Layer Actionsbuttons.
Runtime performance costs#
Adding a dynamic clash bake layer to a stage affects the performance of stage animation. The selected options can have a significant impact on the performance.
The performance cost of the features is the following:
Use selection groups: LOWLayer mode only.
Enabled by default.
Bake Clash Meshes: LOW to MEDIUMEnabled by default
Highlights clashing objects from clash start to end.
It can be medium if a lot of instanced prims are clashing as highlights will happen on a reference to the instanced prims with the instancing flag disabled.
If a stage heavily relies on instancing for performance, then clash bake may be causing significant performance drops.
Bake Outlines: MEDIUM to HIGHDepends on how many intersection edges are detected for a given clash and how many points are in the outline.
Animated outlines are topology changing meshes and they are computationally expensive for the renderer.
If the size of the outline is very large in screen space, the performance cost can be high. In that case lower the
Outline SizeorOutline Scalevalue.
Bake Wireframe: HIGHComputationally expensive.
Only available with
Use Selection GroupsdisabledThey increase memory usage and file size because the over layer will contain the offset vertices for each highlighted mesh.
Bake clashing polygons: HIGHVery computationally expensive.
Only available with
Use Selection GroupsdisabledThey increase memory usage and file size because the over layer will contain some time-sampled primvars to highlight each polygon that is clashing at a given timecode.
Note
It’s possible to bake any selection with different options (enabling or disabling wireframe, outlines, clash meshes, etc.) from whatever was already baked for all the other records. Users can take advantage of this to only highlight meshes with a different color and add the more expensive clash polygons and wireframes or outlines only for a subset of clashes of interest.
Bake layers standalone usage#
The clash baked layer can be composed in the same way as any other USD layer and viewed without the need of almost all clash detection extension, because the output of clash bake layer extension is just pure USD.
Note
The only exception to the above statement is that the omni.physx.clashdetection.viewport extension must be enabled to be able viewing the highlights coming from the Selection Groups options.
In the following example:
ClashBakingCurve.usdThe base layer containing original meshes with animation curves enabled
ClashBakingCurveTimeSampled.usdThe over layer containing time-sampled animation for all meshes and disabling the Animation Curves PushGraph
ClashBakingCurveTimeSampled_CLASH_MATERIALS.usdThe over layer containing clash materials (used by the clash meshes)
ClashBakingCurveTimeSampled_CLASH_MESHES.usdThe over layer containing clash meshes (higlights clashing objects from clash start to end)
Warning
As explained in the dedicated section, Animation curves will need to be baked to a timesampled animation layer in order to delete (or disable) the PushGraph from the original layer.
It can be difficult disabling multiple PushGraphs on a complex composed stage if they’re nested in referenced or instanced prims.
In such cases it’s recommended to disable the animation curves runtime entirely (disabling the omni.anim.curve.core extension).
Technical Notes#
The Generated clash layers contain only some delta that must be set as over to the original USD layer used to generate them.
Efficient usage of references allow such delta clash layer to be significantly smaller than a full time-sampled animated USD containing all mesh faces, indices and vertices. The delta contains just the time-sampled list of faces impacted by the clash over time.
The API is also able to visualize meshes that are part of an instanced prim (instancing proxies), through use of references.
Warning
The reference implementation centralizes the code handling live attachment / detachment of the bake layer to the session layer, and integrating the bake process with the UI to keep it responsive, through an helper class called
ClashBakeAsync.Stability and future availability of
ClashBakeAsyncis not guaranteed, it should be considered sample code part of the reference implementation and not part of the public API.The official API for clash bake is the
ClashBakeLayerclass and theClashBakeOptionsclass.
Animation Curves Interaction#
Warning
omni.physx.clashdetection.bake only supports time sampled animated prims.
If the prims clashing are sub-nodes of some prim controlled by animation curves the baked layer will animate correctly with the timeline position.
- If the prims clashing are directly animated with Animation Curves (from
omni.anim.curve.coreextension) the baked layer will not be able to change visibility correctly for it. In this case
omni.anim.curve.coremust be baked to a time-sampled layer before baking the clash meshes, otherwise the baked layer will not be able to change visibility correctly for it.The original animation curves must be deleted or the corresponding PushGraph must be deleted or de-activated.
If deleting animation curves data is not feasible, disabling the
omni.anim.curve.coreextension while generating and viewing clash backed layer can avoid such issues.Failure to do any of the above may cause clash meshes visibility to be incorrect and/or clash faces not to be animated correctly with the timeline position.
- If the prims clashing are directly animated with Animation Curves (from
Known issues#
Warning
RendererInstancing is an experimental feature. Setting
app.usdrt.population.utils.enableRendererInstancingtotruecan cause clash bake to generate incorrect visualizations.
API Usage#
The high-level clash baking API usage workflow is the following:
One time:
[Optional] Create and attach any additional layer to write clash meshes and clash materials.
Copy support files (mainly MDL shaders) to the folder that will receive the USD file containing clash materials (
ClashBakeLayer.get_support_files_paths)Bake Clash materials (
ClashBakeLayer.bake_clash_materials)
Every time there is need to bake an array of ClashInfo objects:
Collect all paths to be baked in the current run
Remove previously baked meshes to avoid merging new results with them (
ClashBakeLayer.remove_baked_meshes)Prepare meshes to be baked (
ClashBakeLayer.prepare_clash_bake_infos)Bake clash meshes (
ClashBakeLayer.bake_clash_meshes)Finalize clash meshes (
ClashBakeLayer.finalize_clash_meshes)
The following example shows how to generate a baked clashes layer offline from a non-interactive / headless command-line program:
Warning
Make sure that the layers have same timeCodesPerSecond of the root layer being baked.
Clash Bake Layer Example#
from omni.physxclashdetectionbake import ClashBakeLayer, ClashBakeOptions
# use clash detection core api to get ClashInfo objects from current stage
# clash_infos = ... # list of ClashInfo objects coming from clash detection core api
# ClashBakeOptions allows customizing the bake process, for example:
# Enable clash meshes and outlines, but disable wireframe and clashing polygons for better performance
options = ClashBakeOptions()
options.generate_clash_meshes = True # highlights clashing objects from clash start to end
options.generate_outlines = True
stage_path_name = self._test_data_dir + "ClashBaking/ClashBakingTimeSampled.usda"
carb.log_info(f"Opening stage '{stage_path_name}'...")
stage = Usd.Stage.Open(stage_path_name)
self.assertIsNotNone(stage)
UsdUtils.StageCache.Get().Insert(stage)
# Collect all a/b paths
paths = [(str(ci.object_a_path), str(ci.object_b_path)) for ci in clash_infos]
# Create two dedicated layers for clash baking, one for materials and one for meshes
# Using the ClashBakeLayer API, we don't need to insert these layers into the stage
root_layer = stage.GetRootLayer()
base_path, _ = os.path.splitext(root_layer.identifier)
extension = "usd"
layer_meshes_path = base_path + f"_CLASH_MESHES.{extension}"
layer_materials_path = base_path + f"_CLASH_MATERIALS.{extension}"
# It's possible also to open an existing layer before creating new ones
layer_meshes: Sdf.Layer = Sdf.Layer.CreateNew(layer_meshes_path)
layer_materials: Sdf.Layer = Sdf.Layer.CreateNew(layer_materials_path)
# NOTE: The layers must have same time codes per second as the original stage
layer_meshes.timeCodesPerSecond = root_layer.timeCodesPerSecond # type: ignore
layer_materials.timeCodesPerSecond = root_layer.timeCodesPerSecond # type: ignore
# Copy Support files (material shaders mainly) to same folder where layers live
support_paths = ClashBakeLayer.get_support_files_paths(options=options)
dest_folder = os.path.dirname(str(layer_materials.identifier))
for src in support_paths:
dest = os.path.join(dest_folder, os.path.basename(src))
await omni.client.copy_async(src, dest, omni.client.CopyBehavior.OVERWRITE)
# Generate materials before they're referenced by meshes
# Using ClashBakeLayer API, we directly bake to the layer without setting edit target
carb.log_info("Baking materials")
materials = ClashBakeLayer.bake_clash_materials(layer=layer_materials, options=options)
# Prepare bake infos
bake_infos = ClashBakeLayer.prepare_clash_bake_infos(stage=stage, clash_infos=clash_infos, options=options)
carb.log_info("Removing previously baked meshes")
# Remove previously baked meshes (useful when opening an existing layer with pre-baked clash meshes)
with Sdf.ChangeBlock():
ClashBakeLayer.remove_baked_meshes(stage=stage, layer=layer_meshes, paths=paths, options=options)
# Bake clash meshes directly to the layer
# This can be taking some time so if needed just split the bake_infos in batches
# to give some time to user interfaces updates in order to display progress.
carb.log_info("Baking Meshes")
ClashBakeLayer.bake_clash_meshes(layer=layer_meshes, bake_infos=bake_infos, materials=materials, options=options)
# Finalize mesh baking (runs optimization / merge operations)
# Also this operation can be taking some time so if needed split bake_infos in batches
# and interleave with user interface updates in order to display progress.
carb.log_info("Finalizing Meshes")
with Sdf.ChangeBlock():
ClashBakeLayer.finalize_clash_meshes(layer=layer_meshes, bake_infos=bake_infos, options=options)
carb.log_info("Clash baking finished")
# Save the layers
layer_materials.Save()
layer_meshes.Save()
API Reference#
ClashBakeLayer Class#
- class ClashBakeOptions#
A class to customize the clash bake process.
- Parameters:
generate_outlines (bool) – Generate outlines for clashing polygons at every frame (default: True).
generate_clash_meshes (bool) – Generate clash meshes to highlight the meshes from clash start to end (layer mode only, default: True).
generate_wireframe (bool) – Generate a wireframe mesh on top of clashing polygons (not useful with selection groups, default: False).
generate_clash_polygons (bool) – Generate time samples for clashing polygons, resource intensive (not useful with selection groups, default: False).
use_selection_groups (bool) – Use selection groups for highlighting (layer mode only, default: True).
wireframe_offset_epsilon (float) – Offset distance along normals to avoid z-fighting for wireframes (default: 0.001).
group_name_clash_a (str) – The name of the selection group for object A (default: “ClashDetection:ObjectA”).
group_name_clash_b (str) – The name of the selection group for object B (default: “ClashDetection:ObjectB”).
group_name_outlines (str) – The name of the selection group for outlines (default: “ClashDetection:Outlines”).
group_name_duplicate (str) – The name of the selection group for duplicate meshes (default: “ClashDetection:Duplicate”).
outline_width_size (float) – Size of the outline in world space units (default: 0.5).
outline_width_scale (float) – Scale factor for the outline width (default: 1.0).
- class ClashBakeLayer#
A class to bake clash meshes directly to a USD layer without requiring stage composition or edit target manipulation. All methods of this class are
@staticmethodso this class doesn’t need to be instantiated.The API enables baking a list of
ClashInfoobjects from Clash Detection Core API extension to OpenUSD layers.- Advantages over ClashDetectionBake:
No need to compose layers into the stage during baking
No need to manipulate edit targets
Better performance and memory efficiency
Cleaner workflow without try/finally blocks
The general usage workflow is:
- Setup (when a new stage is loaded):
ClashBakeLayer.get_support_files_pathsobtains support files that must be copied where the result of clash bake will beCreate separate layers for clash materials and meshes (not composed into the stage)
ClashBakeLayer.bake_clash_materialscreates materials directly in the material layer
- Runtime:
ClashBakeLayer.prepare_clash_bake_infostransforms a [ClashInfo] (withclash_frame_info_itemsfilled) in a [ClashBakeInfo]ClashBakeLayer.bake_clash_meshestakes a [ClashBakeInfo] and writes the meshes directly to the layerFinally
ClashBakeLayer.finalize_clash_mesheswill finalize meshes, doing merging and / or keyframe simplifications
- Update:
ClashBakeLayer.remove_baked_meshesremoves the baked meshes from a previous run when needing to update an existing layer
Static Methods#
- ClashBakeLayer.remove_baked_meshes(
- stage: Usd.Stage,
- layer: Sdf.Layer,
- paths: list[tuple[str, str]],
- options: ClashBakeOptions = ClashBakeOptions(),
Removes additional clash prims baked for prims at given paths directly from the specified layer.
- Parameters:
stage (Usd.Stage) – The USD Stage (used for prim path validation).
layer (Sdf.Layer) – The layer to remove the baked meshes from.
paths (list[tuple[str, str]]) – List of tuples containing the paths of the prims to remove.
options (ClashBakeOptions) – Options for the bake process.
- Returns:
List of paths of the prims that failed to be removed.
- Return type:
list[str]
- ClashBakeLayer.prepare_clash_bake_infos(
- stage: Usd.Stage,
- clash_infos: list[ClashInfo],
- options: ClashBakeOptions = ClashBakeOptions(),
Prepare ClashBakeInfo objects that are needed to bake meshes for a given list of clashes.
- Parameters:
stage (Usd.Stage) – The USD Stage.
clash_infos (list[ClashInfo]) – List of ClashInfo objects from omni.physx.clashdetection.core.
options (ClashBakeOptions) – Options for the bake process.
- Returns:
List of ClashBakeInfo objects that can be used with bake_clash_meshes.
- Return type:
list[ClashBakeInfo]
- ClashBakeLayer.get_support_files_paths(
- options: ClashBakeOptions,
Obtain a list of paths to support files needed by bake_clash_meshes.
For example it contains the path to material file used by the baked meshes materials. Copy these files in the target directory where the clash layer is saved.
- Parameters:
options (ClashBakeOptions) – Options for the bake process.
- Returns:
List of file paths to support files needed by bake_clash_meshes.
- Return type:
list[str]
- ClashBakeLayer.bake_clash_materials(
- layer: Sdf.Layer,
- options: ClashBakeOptions = ClashBakeOptions(),
Write materials used by bake_clash_meshes directly to the specified layer.
Note: This method writes directly to the layer without requiring edit target manipulation.
- Parameters:
layer (Sdf.Layer) – The layer to write materials to.
options (ClashBakeOptions) – Options for the bake process.
- Returns:
The materials created (to be passed in to bake_clash_meshes)
- Return type:
ClashMaterialsPaths
- ClashBakeLayer.bake_clash_meshes(
- layer: Sdf.Layer,
- bake_infos: list[ClashBakeInfo],
- materials: ClashMaterialsPaths,
- options: ClashBakeOptions = ClashBakeOptions(),
Bakes meshes prepared with prepare_clash_bake_infos applying the materials created with bake_clash_materials directly to the specified layer.
Note: This method writes directly to the layer without requiring edit target manipulation or stage composition.
- Parameters:
layer (Sdf.Layer) – The layer to write clash meshes to.
bake_infos (list[ClashBakeInfo]) – List of ClashBakeInfo objects prepared with prepare_clash_bake_infos.
materials (ClashMaterialsPaths) – Materials created with bake_clash_materials.
options (ClashBakeOptions) – Options for the bake process.
- ClashBakeLayer.finalize_clash_meshes(
- layer: Sdf.Layer,
- bake_infos: list[ClashBakeInfo],
- options: ClashBakeOptions = ClashBakeOptions(),
Merges multiple clash pairs previously baked with bake_clash_meshes directly in the specified layer.
- Parameters:
layer (Sdf.Layer) – The layer containing the baked meshes to finalize.
bake_infos (list[ClashBakeInfo]) – List of ClashBakeInfo objects that were baked.
options (ClashBakeOptions) – Options for the bake process.
ClashDetectionBake Class (Deprecated)#
Deprecated since version 109.0: The ClashDetectionBake class is deprecated and it will be removed in future releases.
Use ClashBakeLayer instead for better performance more flexible workflow.
- class ClashDetectionBake#
A deprecated class to bake clash meshes to a USD stage using edit targets. All methods of this class are
@staticmethodso this class doesn’t need to be instantiated.Deprecated: This API requires stage composition and edit target manipulation which causes performance overhead. Use
ClashBakeLayerinstead which works directly with layers.The API enables baking a list of
ClashInfoobjects from Clash Detection Core API extension to OpenUSD meshes.The general usage workflow is:
- Setup (when a new stage is loaded):
ClashDetectionBake.get_support_files_pathsobtains support files that must be copied where the result of clash bake will beSet an edit target where clash materials need to be written
ClashDetectionBake.bake_clash_materialscreates materials in the current edit target for a given stagePotentially create an additional layer to contain only the clash meshes
Attach the layer containing the material and the clash meshes one as sublayers of current session layer
- Runtime:
ClashDetectionBake.prepare_clash_bake_infostransforms a [ClashInfo] (withclash_frame_info_itemsfilled) in a [ClashBakeInfo]Set an edit target where clash meshes need to be written
ClashDetectionBake.bake_clash_meshestakes a [ClashBakeInfo] and a stage + materials and writes the meshes in the stage.Finally
ClashDetectionBake.finalize_clash_mesheswill finalize meshes, doing merging and / or keyframe simplifications.
- Update:
ClashDetectionBake.remove_baked_meshesremoves the baked meshes from a previous run when needing to update an existing layer.
Static Methods#
- ClashDetectionBake.remove_baked_meshes(
- stage: Usd.Stage,
- paths: list[tuple[str, str]],
- options: ClashBakeOptions = ClashBakeOptions(),
Removes additional clash prims baked for prims at given paths.
- Parameters:
stage (Usd.Stage) – The USD Stage.
paths (list[tuple[str, str]]) – List of tuples containing the paths of the prims to remove.
options (ClashBakeOptions) – Options for the bake process.
- Returns:
List of paths of the prims that failed to be removed.
- Return type:
list[str]
- ClashDetectionBake.prepare_clash_bake_infos(
- stage: Usd.Stage,
- clash_infos: list[ClashInfo],
- options: ClashBakeOptions = ClashBakeOptions(),
Prepare ClashBakeInfo objects that are needed to bake meshes for a given list of clashes.
- Parameters:
stage (Usd.Stage) – The USD Stage.
clash_infos (list[ClashInfo]) – List of ClashInfo objects from omni.physx.clashdetection.core.
options (ClashBakeOptions) – Options for the bake process.
- Returns:
List of ClashBakeInfo objects that can be used with bake_clash_meshes.
- Return type:
list[ClashBakeInfo]
- ClashDetectionBake.get_support_files_paths(
- options: ClashBakeOptions,
Obtain a list of paths to support files needed by bake_clash_meshes.
For example it contains the path to material file used by the baked meshes materials. Copy these files in the target directory where the clash layer is saved.
- Parameters:
options (ClashBakeOptions) – Options for the bake process.
- Returns:
List of file paths to support files needed by bake_clash_meshes.
- Return type:
list[str]
- ClashDetectionBake.bake_clash_materials(
- stage: Usd.Stage,
- options: ClashBakeOptions = ClashBakeOptions(),
Write materials used by bake_clash_meshes to current stage.
Note: Before calling this function you can change the edit layer to save the materials to.
- Parameters:
stage (Usd.Stage) – The USD Stage.
options (ClashBakeOptions) – Options for the bake process.
- Returns:
The materials created (to be passed in to bake_clash_meshes)
- Return type:
ClashMaterialsPaths
- ClashDetectionBake.bake_clash_meshes(
- stage: Usd.Stage,
- bake_infos: list[ClashBakeInfo],
- materials: ClashMaterialsPaths,
- options: ClashBakeOptions = ClashBakeOptions(),
Bakes meshes prepared with prepare_clash_bake_infos applying the materials created with bake_clash_materials.
Note: Before calling this function you can change the edit layer to save the clash mesh USD overs to.
- Parameters:
stage (Usd.Stage) – The USD Stage.
bake_infos (list[ClashBakeInfo]) – List of ClashBakeInfo objects prepared with prepare_clash_bake_infos.
materials (ClashMaterialsPaths) – Materials created with bake_clash_materials.
options (ClashBakeOptions) – Options for the bake process.
- ClashDetectionBake.finalize_clash_meshes(
- stage: Usd.Stage,
- paths: list[tuple[str, str]],
- options: ClashBakeOptions = ClashBakeOptions(),
Merges multiple clash pairs at paths previously baked with bake_clash_meshes
- Parameters:
stage (Usd.Stage) – The USD Stage.
paths (list[tuple[str, str]]) – List of tuples containing the paths of the prims to merge.
options (ClashBakeOptions) – Options for the bake process.