Skip to content

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Sep 10, 2025

🦟 Bug fix

Related issue: gazebosim/jetty_demo#3
Requires gazebosim/gz-rendering#1168

Summary

When updating the cast shadows property of a visual, we set the material with the cast shadow value to all the submeshes in the visual. However, the SetMaterial call by default clones the input material before setting it to the submesh. The submesh's original material will also be destroyed during this process. The problem is that the material destruction process was found to be expensive and does not cleanup textures properly, see gazebosim/gz-rendering#1167. This PR updates the SetMaterial call to pass false in the second arg so the material is not cloned when being set, which prevents the original material from being destroyed.

When running the Jetty demo world, the load time reduced from 30s to 24s on my machine (tested with with #3070 and gazebosim/gz-common#706)

Checklist

  • Signed all commits for DCO
  • Added tests
  • 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
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Generated-by: Remove this if GenAI was not used.

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

@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Sep 10, 2025
@iche033
Copy link
Contributor Author

iche033 commented Sep 10, 2025

we'll need another gz-rendering10 pre-release after gazebosim/gz-rendering#1168 is merged to get the CI green

@iche033
Copy link
Contributor Author

iche033 commented Sep 20, 2025

The homebrew EntityComponentManager_TEST test failures should be unrelated and are also happening in other builds.

@iche033 iche033 merged commit 40dbdeb into gz-sim10 Sep 20, 2025
13 of 14 checks passed
@iche033 iche033 deleted the iche033/submesh_setmaterial branch September 20, 2025 01:19
@github-project-automation github-project-automation bot moved this from In review to Done in Core development Sep 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪵 jetty Gazebo Jetty needs upstream release Blocked by a release of an upstream library

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants