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

Fix material switching for objects using shaders (ogre2) #533

Merged
merged 11 commits into from
Jan 18, 2022

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Jan 8, 2022

🦟 Bug fix

Related PR: gazebosim/gz-sim#1275

Summary

Mouse picking works by assigning a unique material to an object. When a user clicks on a object, we switch out its material to a unique one to identify the clicked object. There is bug that when switching objects that use custom shader materials. Added an extra check and logic make sure we restore the correct material (low level shader material).

Also fixed a bug that causes ign-rendering to crash when a long shader name is given.

Test this with ign-gazebo using gazebosim/gz-sim#1275. Launch the shader_param.sdf world and hover the mouse over the 3D render window. Without these changes, the shader will stop working and the sphere will turn black.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • 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.

Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
@codecov
Copy link

codecov bot commented Jan 8, 2022

Codecov Report

Merging #533 (2f88119) into ign-rendering6 (c10c303) will decrease coverage by 0.00%.
The diff coverage is 41.17%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           ign-rendering6     #533      +/-   ##
==================================================
- Coverage           54.38%   54.37%   -0.01%     
==================================================
  Files                 198      198              
  Lines               20087    20096       +9     
==================================================
+ Hits                10925    10928       +3     
- Misses               9162     9168       +6     
Impacted Files Coverage Δ
ogre2/src/Ogre2Material.cc 70.88% <0.00%> (-0.29%) ⬇️
ogre2/src/Ogre2MaterialSwitcher.cc 84.41% <53.84%> (-5.59%) ⬇️
...e/ignition/rendering/base/BaseGaussianNoisePass.hh 100.00% <0.00%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c10c303...2f88119. Read the comment docs.

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

can we add a test ?

Base automatically changed from shader_constants to ign-rendering6 January 12, 2022 18:18
@iche033
Copy link
Contributor Author

iche033 commented Jan 13, 2022

can we add a test ?

yep, added test in 33dd4c4

Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Ian Chen <[email protected]>
@iche033
Copy link
Contributor Author

iche033 commented Jan 13, 2022

hmm test is failing on github bionic build but pass on focal and other jenkins machines. Not sure if it's a bionic software rendering or mesa driver issue or something else. Added logic to disable test on github action. f82a0ac

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

some minor style issues

if (_renderEngine == "optix")
{
igndbg << "Custom shaders are not supported yet in rendering engine: "
<< _renderEngine << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<< _renderEngine << std::endl;
<< _renderEngine << std::endl;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 599 to 600
igndbg << "Engine '" << _renderEngine
<< "' is not supported" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
igndbg << "Engine '" << _renderEngine
<< "' is not supported" << std::endl;
igndbg << "Engine '" << _renderEngine
<< "' is not supported" << std::endl;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@iche033 iche033 merged commit 73b9fa1 into ign-rendering6 Jan 18, 2022
@iche033 iche033 deleted the shader_fixes branch January 18, 2022 19:49
@osrf-triage
Copy link

This pull request has been mentioned on Gazebo Community. There might be relevant details there:

https://community.gazebosim.org/t/new-ignition-releases-2022-03-01-citadel-edifice-fortress/1313/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants