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 objects using shaders when there is a lidar in the scene (ogre2) #575

Merged
merged 3 commits into from
Mar 5, 2022

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Mar 3, 2022

Signed-off-by: Ian Chen [email protected]

🦟 Bug fix

Summary

The gpu ray sensor sets up generates retro values by switching materials. The probably is that it incorrectly restores shader materials causing objects using custom shaders to render incorrectly after first update.

Applied a similar fix as as #533. Updated integration test should which fail without this fix.

On way to reproduce the issue is to run this shader_param_gpu_lidar.sdf world with ign-gazebo:

ign gazebo -v 4 -r shader_param_gpu_lidar.sdf

Without this fix, the red sphere and waves (which use custom shaders) will appear black in the Image Display plugin.

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.

@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Mar 3, 2022
@iche033 iche033 mentioned this pull request Mar 3, 2022
@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #575 (a3d2bbe) into ign-rendering6 (996c58d) will decrease coverage by 0.00%.
The diff coverage is 52.94%.

❗ Current head a3d2bbe differs from pull request most recent head 3a4383e. Consider uploading reports for the commit 3a4383e to get more accurate results

Impacted file tree graph

@@                Coverage Diff                 @@
##           ign-rendering6     #575      +/-   ##
==================================================
- Coverage           54.36%   54.35%   -0.01%     
==================================================
  Files                 198      198              
  Lines               20157    20170      +13     
==================================================
+ Hits                10958    10964       +6     
- Misses               9199     9206       +7     
Impacted Files Coverage Δ
ogre2/src/Ogre2MaterialSwitcher.cc 79.26% <0.00%> (-5.15%) ⬇️
ogre2/src/Ogre2GpuRays.cc 95.08% <75.00%> (-0.44%) ⬇️
...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 996c58d...3a4383e. 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.

I made two style suggestions, I tested locally and it works great

@@ -324,12 +337,24 @@ void Ogre2LaserRetroMaterialSwitcher::cameraPostRenderScene(
subItem->setDatablock(it.second);
}

auto lIt = laserRetroMaterialMap.find(this);
Copy link
Contributor

@ahcorde ahcorde Mar 4, 2022

Choose a reason for hiding this comment

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

use a variable name more descriptive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

está hecho a6c13de

Comment on lines 115 to 119
if (technique && !technique->isDepthWriteEnabled() &&
!technique->isDepthCheckEnabled())
subItem->setMaterial(this->plainOverlayMaterial);
else
subItem->setMaterial(this->plainMaterial);
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
if (technique && !technique->isDepthWriteEnabled() &&
!technique->isDepthCheckEnabled())
subItem->setMaterial(this->plainOverlayMaterial);
else
subItem->setMaterial(this->plainMaterial);
if (technique && !technique->isDepthWriteEnabled() &&
!technique->isDepthCheckEnabled())
{
subItem->setMaterial(this->plainOverlayMaterial);
}
else
{
subItem->setMaterial(this->plainMaterial);
}

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 dd8b465 into ign-rendering6 Mar 5, 2022
@iche033 iche033 deleted the fix_shader_gpu_rays branch March 5, 2022 00:52
@scpeters scpeters mentioned this pull request Mar 21, 2022
@iche033 iche033 mentioned this pull request Mar 22, 2022
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.

2 participants