Skip to content

Commit 3384fbf

Browse files
committed
Add support for forcing PBR material
1 parent 5cee6ae commit 3384fbf

File tree

5 files changed

+135
-634
lines changed

5 files changed

+135
-634
lines changed

omnigibson/examples/scenes/scene_selector.py

+16-19
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ def main(random_selection=False, headless=False, short_exec=False):
3434
"type": scene_type,
3535
"scene_model": scene_model,
3636
},
37-
"robots": [
38-
{
39-
"type": "Turtlebot",
40-
"obs_modalities": ["scan", "rgb", "depth"],
41-
"action_type": "continuous",
42-
"action_normalize": True,
43-
},
44-
],
4537
}
4638

4739
# If the scene type is interactive, also check if we want to quick load or full load the scene
@@ -52,7 +44,15 @@ def main(random_selection=False, headless=False, short_exec=False):
5244
}
5345
load_mode = choose_from_options(options=load_options, name="load mode", random_selection=random_selection)
5446
if load_mode == "Quick":
55-
cfg["scene"]["load_object_categories"] = ["floors", "walls", "ceilings"]
47+
cfg["scene"]["load_object_categories"] = [
48+
"floors",
49+
"walls",
50+
"ceilings",
51+
"lawn",
52+
"driveway",
53+
"roof",
54+
"rail_fence",
55+
]
5656

5757
# Load the environment
5858
env = og.Environment(configs=cfg)
@@ -62,16 +62,13 @@ def main(random_selection=False, headless=False, short_exec=False):
6262
og.sim.enable_viewer_camera_teleoperation()
6363

6464
# Run a simple loop and reset periodically
65-
max_iterations = 10 if not short_exec else 1
66-
for j in range(max_iterations):
67-
og.log.info("Resetting environment")
68-
env.reset()
69-
for i in range(100):
70-
action = env.action_space.sample()
71-
state, reward, terminated, truncated, info = env.step(action)
72-
if terminated or truncated:
73-
og.log.info("Episode finished after {} timesteps".format(i + 1))
74-
break
65+
steps = 0
66+
while not short_exec or steps < 1000:
67+
state, reward, terminated, truncated, info = env.step(None)
68+
if terminated or truncated:
69+
og.log.info("Episode finished after {} timesteps".format(steps + 1))
70+
break
71+
steps += 1
7572

7673
# Always close the environment at the end
7774
og.clear()

omnigibson/macros.py

+3
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ def determine_gm_path(default_path, env_var_name):
146146
# Forced light intensity for all DatasetObjects. None if the USD-provided intensities should be respected.
147147
gm.FORCE_LIGHT_INTENSITY = 10000
148148

149+
# Whether to default the dataset objects to use the shipped V-Ray or OmniPBR materials
150+
gm.USE_PBR_MATERIALS = True
151+
149152
# Forced roughness for all DatasetObjects. None if the USD-provided roughness maps should be respected.
150153
gm.FORCE_ROUGHNESS = 0.7
151154

omnigibson/prims/entity_prim.py

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from omnigibson.prims.rigid_kinematic_prim import RigidKinematicPrim
1616
from omnigibson.prims.xform_prim import XFormPrim
1717
from omnigibson.utils.constants import JointAxis, JointType, PrimType
18+
from omnigibson.utils.render_utils import force_pbr_material_for_link
1819
from omnigibson.utils.usd_utils import PoseAPI, absolute_prim_path_to_scene_relative
1920

2021
# Create settings for this module
@@ -256,6 +257,10 @@ def update_links(self):
256257
else: # link_type == PrimType.CLOTH
257258
link_cls = ClothPrim
258259

260+
# Apply the V-Ray to PBR material change if request by the macro
261+
if gm.USE_PBR_MATERIALS:
262+
force_pbr_material_for_link(self._prim, link_name)
263+
259264
# Create and load the link
260265
self._links[link_name] = link_cls(
261266
relative_prim_path=absolute_prim_path_to_scene_relative(self.scene, prim.GetPrimPath().__str__()),

0 commit comments

Comments
 (0)