diff --git a/compass/utils/ovrtx_render_product.py b/compass/utils/ovrtx_render_product.py deleted file mode 100644 index e8276e7..0000000 --- a/compass/utils/ovrtx_render_product.py +++ /dev/null @@ -1,66 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from functools import wraps - -# Import simulation dependencies only after renderer startup is configured. -# pylint: disable=import-outside-toplevel - - -def configure_gaussian_hdr(enabled): - """Configure each NuRec SPG render product for the PPISP HDR input. - - Author the required Gaussian setting directly in USD without debug-only - environment variables. The newer integration builds products separately. - Keep the adapter local to Isaac Lab and leave the native OVRTX API unchanged. - """ - from isaaclab_ov.renderers import ovrtx_renderer - - key = '_compass_original_build_render_product_as_string' - if not hasattr(ovrtx_renderer, key): - setattr(ovrtx_renderer, key, ovrtx_renderer.build_render_product_as_string) - original = getattr(ovrtx_renderer, key) - if not enabled: - ovrtx_renderer.build_render_product_as_string = original - return - - @wraps(original) - def build_with_gaussian_hdr(*args, **kwargs): - result = original(*args, **kwargs) - # Older Isaac Lab builders return the layer and product path together; - # newer builders return only the layer. Preserve either interface. - if isinstance(result, tuple): - usd_text, product_path = result - return apply_gaussian_hdr(usd_text), product_path - return apply_gaussian_hdr(result) - - ovrtx_renderer.build_render_product_as_string = build_with_gaussian_hdr - - -def apply_gaussian_hdr(usd_text): - """Author a typed per-product setting while preserving the layer metadata.""" - from pxr import Sdf, Usd - - layer = Sdf.Layer.CreateAnonymous('compass-ovrtx-products.usda') - if not layer.ImportFromString(usd_text): - raise RuntimeError('Could not parse OVRTX render-product layer') - stage = Usd.Stage.Open(layer) - for prim in stage.Traverse(): - if prim.GetTypeName() == 'RenderProduct': - prim.CreateAttribute('omni:rtx:rtpt:gaussian:skipTonemapping:enabled', - Sdf.ValueTypeNames.Bool, - custom=False).Set(False) - return layer.ExportToString() diff --git a/compass/utils/renderer_utils.py b/compass/utils/renderer_utils.py index b3a1cc2..09648e7 100644 --- a/compass/utils/renderer_utils.py +++ b/compass/utils/renderer_utils.py @@ -50,7 +50,6 @@ # Additional camera renderer settings for NuRec USDs that require SPG runtime. NUREC_SPG_CAMERA_RENDERER_CARB_SETTINGS = { - "/rtx/rtpt/gaussian/skipTonemapping/enabled": False, "/rtx/rtpt/gaussian/accumulatedDepth/allHits/enabled": True, "/rtx/rtpt/gaussian/accumulatedAlbedo/enabled": True, "/rtx/rtpt/gaussian/maxGaussiansToAccumulate": 360, @@ -112,10 +111,6 @@ def apply_camera_renderer_settings(env_cfg, args): from isaaclab_ov.renderers import OVRTXRendererCfg _configure_ovrtx_device(env_cfg.sim.device) - from compass.utils.ovrtx_render_product import configure_gaussian_hdr - - configure_gaussian_hdr( - bool(getattr(args, "nurec_scene", None)) and bool(getattr(args, "spg_runtime", False))) if getattr(args, "nurec_scene", None): from isaaclab_ov.renderers import ovrtx_renderer diff --git a/tests/test_ovrtx_render_product.py b/tests/test_ovrtx_render_product.py deleted file mode 100644 index 0f1efa2..0000000 --- a/tests/test_ovrtx_render_product.py +++ /dev/null @@ -1,73 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -import sys -import unittest -from types import SimpleNamespace -from unittest.mock import Mock, patch - -try: - from pxr import Sdf, Usd -except ImportError: - Usd = None - -from compass.utils.ovrtx_render_product import apply_gaussian_hdr, configure_gaussian_hdr - - -@unittest.skipIf(Usd is None, 'Requires OpenUSD') -class RenderProductHDRTests(unittest.TestCase): - """Verify the PPISP HDR setting and both render-product builder interfaces.""" - - def setUp(self): - self.usd_text = '''#usda 1.0 -(defaultPrim = "RenderCamera_0") -def Scope "RenderCamera_0" { - def RenderProduct "RenderProduct" { - rel camera = - uniform int2 resolution = (512, 320) - } -} -''' - - def assert_hdr_layer(self, text): - layer = Sdf.Layer.CreateAnonymous() - self.assertTrue(layer.ImportFromString(text)) - stage = Usd.Stage.Open(layer) - self.assertEqual(str(stage.GetDefaultPrim().GetPath()), '/RenderCamera_0') - product = stage.GetPrimAtPath('/RenderCamera_0/RenderProduct') - self.assertEqual( - product.GetRelationship('camera').GetTargets(), [Sdf.Path('/World/envs/env_0/Camera')]) - self.assertEqual(tuple(product.GetAttribute('resolution').Get()), (512, 320)) - attr = product.GetAttribute('omni:rtx:rtpt:gaussian:skipTonemapping:enabled') - self.assertEqual(attr.GetTypeName(), Sdf.ValueTypeNames.Bool) - self.assertFalse(attr.Get()) - - def test_hdr_setting_preserves_layer_and_camera_relationships(self): - self.assert_hdr_layer(apply_gaussian_hdr(self.usd_text)) - - def test_hdr_setting_replaces_incompatible_authored_value(self): - text = self.usd_text.replace( - 'rel camera', - 'bool omni:rtx:rtpt:gaussian:skipTonemapping:enabled = true\n rel camera') - self.assert_hdr_layer(apply_gaussian_hdr(text)) - - def test_adapter_preserves_builder_interfaces_and_restores_original(self): - for returns_path in (False, True): - with self.subTest(returns_path=returns_path): - result = (self.usd_text, - '/RenderCamera_0/RenderProduct') if returns_path else self.usd_text - original = Mock(return_value=result) - adapter = SimpleNamespace(build_render_product_as_string=original) - with patch.dict(sys.modules, - {'isaaclab_ov.renderers': SimpleNamespace(ovrtx_renderer=adapter)}): - configure_gaussian_hdr(True) - configure_gaussian_hdr(True) - actual = adapter.build_render_product_as_string('spec', device_id=0) - original.assert_called_once_with('spec', device_id=0) - if returns_path: - text, path = actual - self.assertEqual(path, '/RenderCamera_0/RenderProduct') - else: - text = actual - self.assert_hdr_layer(text) - configure_gaussian_hdr(False) - self.assertIs(adapter.build_render_product_as_string, original)