Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cgokmen committed Feb 12, 2025
1 parent 247d1e8 commit f13aeb4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions omnigibson/prims/geom_prim.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def _post_load(self):
super()._post_load()

# Temporarily set the opacity threshold to be 0.1. This will be automated in later exports.
# We do this because in previous exports we included continuous alpha values for opacity
# but the ray tracing renderer can only handle binary opacity values. The default threshold
# leaves most objects entirely transparent, so we try to avoid that here.
# TODO: Remove this after the next dataset export
if self.material:
self.material.opacity_threshold = 0.1

Expand Down
14 changes: 14 additions & 0 deletions omnigibson/prims/rigid_prim.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,14 @@ def meta_link_type(self):

@cached_property
def meta_link_id(self):
"""The meta link id of this link, if the link is a meta link.
The meta link ID is a semantic identifier for the meta link within the meta link type. It is
used when an object has multiple meta links of the same type. It can be just a numerical index,
or for some objects, it will be a string that can be matched to other meta links. For example,
a stove might have toggle buttons named "left" and "right", and heat sources named "left" and
"right". The meta link ID can be used to match the toggle button to the heat source.
"""
assert self.is_meta_link, f"{self.name} is not a meta link"
if self.prim.HasAttribute("ig:metaLinkId"):
return self.get_attribute("ig:metaLinkId")
Expand All @@ -835,6 +843,12 @@ def meta_link_id(self):

@cached_property
def meta_link_sub_id(self):
"""The integer meta link sub id of this link, if the link is a meta link.
The meta link sub ID identifies this link as one of the parts of a meta link. For example, an
attachment meta link's ID will be the attachment pair name, and each attachment point that
works with that pair will show up as a separate link with a unique sub ID.
"""
assert self.is_meta_link, f"{self.name} is not a meta link"
if self.prim.HasAttribute("ig:metaLinkSubId"):
return int(self.get_attribute("ig:metaLinkSubId"))
Expand Down
4 changes: 4 additions & 0 deletions omnigibson/utils/asset_conversion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ def _set_mtl_opacity(mtl_prim, texture):
# This defaults to some other value, which takes opaque black channels in the
# image to be fully transparent. This is not what we want.
lazy.omni.usd.create_material_input(mtl_prim, "opacity_mode", 0, lazy.pxr.Sdf.ValueTypeNames.Int)

# We also need to set an opacity threshold. Our objects can include continuous alpha values for opacity
# but the ray tracing renderer can only handle binary opacity values. The default threshold
# leaves most objects entirely transparent, so we try to avoid that here.
lazy.omni.usd.create_material_input(mtl_prim, "opacity_threshold", 0.1, lazy.pxr.Sdf.ValueTypeNames.Float)

# Verify it was set
Expand Down

0 comments on commit f13aeb4

Please sign in to comment.