Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Global Illumination (GI VCT) for sensors in SDF #2550

Merged
merged 25 commits into from
Sep 10, 2024

Conversation

athenaz2
Copy link
Contributor

@athenaz2 athenaz2 commented Aug 27, 2024

🎉 New feature

Summary

Global illumination (GI) has been enabled for the GUI with #1597, but not for the camera sensor view. This PR allows for GI to be enabled for sensors in the SDF as a <global_illumination> element within the sensor_system plugin. Currently supports the VCT technique, in the future can consider adding support for CI VCT.

Sensor view (left) and GUI (right) without GI VCT:

With GI VCT:

Test it

gi_for_sensors_demo.zip

Modify the <global_illumination> element in the SDF. This element is within the sensor_system plugin. The format is as follows:

<global_illumination type="vct">
    <enabled>true</enabled>
    <resolution>16 16 16</resolution>
    <octant_count>1 1 1</octant_count>
    <bounce_count>6</bounce_count>
    <high_quality>true</high_quality>
    <anisotropic>true</anisotropic>
    <thin_wall_counter>1.0</thin_wall_counter>
    <conserve_memory>true</conserve_memory>
    <debug_vis_mode>none</debug_vis_mode>
</global_illumination>

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@athenaz2 athenaz2 requested a review from iche033 as a code owner August 27, 2024 17:30
@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Aug 27, 2024
@athenaz2 athenaz2 marked this pull request as draft August 27, 2024 17:31
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this generally looks good, added some suggestions

@@ -521,6 +628,52 @@ Sensors::~Sensors()
this->dataPtr->Stop();
}

//TODO: why does math::Vector3d work but not math::Vector3i?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::string giType = giElem->GetAttribute("type")->GetAsString();
if (giType == "vct")
{
this->dataPtr->giVctParameters.enabled = giElem->Get<bool>("enabled", this->dataPtr->giVctParameters.enabled).first;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrap lines to 80char

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked style with codecheck in f82c68e

src/systems/sensors/Sensors.cc Outdated Show resolved Hide resolved
@athenaz2 athenaz2 marked this pull request as ready for review August 29, 2024 01:00
@iche033
Copy link
Contributor

iche033 commented Aug 30, 2024

looks like there's an issue with GI on metal. Output from homebrew CI build:

281: [ RUN      ] CameraSensorGlobalIlluminationTest.GlobalIlluminationEnabled
281: libc++abi: terminating with uncaught exception of type Ogre::FileNotFoundException: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource CrossPlatformSettings_piece_all.metal in resource group General or any other group. in ResourceGroupManager::openResource at /tmp/ogre2.3-20230918-86352-14va4s/ogre-next-2.3.1/OgreMain/src/OgreResourceGroupManager.cpp (line 793)

you can disable the test on mac using this macro. Can you ticket an issue on this in gz-rendering?

@athenaz2
Copy link
Contributor Author

looks like there's an issue with GI on metal. Output from homebrew CI build:

281: [ RUN      ] CameraSensorGlobalIlluminationTest.GlobalIlluminationEnabled
281: libc++abi: terminating with uncaught exception of type Ogre::FileNotFoundException: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource CrossPlatformSettings_piece_all.metal in resource group General or any other group. in ResourceGroupManager::openResource at /tmp/ogre2.3-20230918-86352-14va4s/ogre-next-2.3.1/OgreMain/src/OgreResourceGroupManager.cpp (line 793)

you can disable the test on mac using this macro. Can you ticket an issue on this in gz-rendering?

Okay, created an issue - gazebosim/gz-rendering#1048. I also noted it in the issue description but the GI unit test also skips testing for Apple platform.

@azeey
Copy link
Contributor

azeey commented Aug 30, 2024

The test is still segfaulting. I'm wondering if it's an issue with having two rendering tests in the same file. Can you try commenting out the "GiNotEnabled" version to see if just running the test with GI enabled still segfaults?

test/worlds/camera_sensor_gi_enabled_true.sdf Outdated Show resolved Hide resolved
<!-- <plugin
filename="gz-sim-scene-broadcaster-system"
name="gz::sim::systems::SceneBroadcaster">
</plugin> -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove if not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<property key="showTitleBar" type="bool">false</property>
</gz-gui>
</plugin>
</gui>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the whole <gui> block because we don't need it for the test right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for the camera_sensor_gi_enabled_false.sdf test world

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, was from creating SDF scene and ensuring cam lines up for test case. 95530a6

test/integration/camera_sensor_global_illumination.cc Outdated Show resolved Hide resolved
#### Example usage with VCT

We will demonstrate how to enable VCT for the sensor with the SDF file below. (The finished SDF file can be viewed [here](
https:/gazebosim/gz-sim/blob/main/examples/worlds/global_illumination.sdf).)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change link to point to the gz-sim8 branch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#### Example usage for CI VCT

1) Open the [global_illumination.sdf](
https:/gazebosim/gz-sim/blob/main/examples/worlds/global_illumination.sdf) world using Vulkan with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change link to point to the gz-sim8 branch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tutorials/global_illumination.md Outdated Show resolved Hide resolved
tutorials/global_illumination.md Outdated Show resolved Hide resolved
tutorials/global_illumination.md Outdated Show resolved Hide resolved
#### Example usage for VCT

1) Open the [global_illumination.sdf](
https:/gazebosim/gz-sim/blob/main/examples/worlds/global_illumination.sdf) world with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update link to point to gz-sim8 branch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

athenaz2 and others added 5 commits September 6, 2024 16:49
@iche033
Copy link
Contributor

iche033 commented Sep 9, 2024

I made a couple of minor changes in f03476b (removed white space), and 966f48c (hide gui plugins). This now looks good to me.

@ahcorde ahcorde merged commit a167312 into gazebosim:gz-sim8 Sep 10, 2024
9 checks passed
@azeey
Copy link
Contributor

azeey commented Sep 11, 2024

This shouldn't have been merged since we are in code freeze. Let's make sure we don't forward port this to gz-sim9. Ideally, we won't need to forward port in the next few weeks, but if we do, we should just cherry-pick any necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants