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 loading grayscale emissive map #503

Merged
merged 9 commits into from
Dec 7, 2021
Merged

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Dec 4, 2021

🦟 Bug fix

Fixes #499

Summary

Continuing the effort from #501, this PR fixes loading grayscale emissive map by converting it to RGB color texture so that the visual with the emissive map is not incorrectly rendered as red color.

Test by lauching ign gazebo with the fuel_textured_mesh.sdf world file.

Before:

tube_grayscale_emissive_before

After:

tube_grayscale_emissive_after

Alternative considered

The other option considered is to some customization in the Pbs Hlms pixel shader and just apply only the r channel of the emissive texture to the final color, .e.g. changing the code here to finalColour += emissiveCol.rrr;.

I went with the approach in this PR mainly to keep the changes within one function without touching the shaders so we don't deviate too much from the original Pbs shader code we took from ogre. This approach was also easier for me to to implement.

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

@codecov
Copy link

codecov bot commented Dec 4, 2021

Codecov Report

Merging #503 (a6796ac) into ign-rendering6 (f025610) will decrease coverage by 0.08%.
The diff coverage is 15.00%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           ign-rendering6     #503      +/-   ##
==================================================
- Coverage           55.53%   55.44%   -0.09%     
==================================================
  Files                 195      195              
  Lines               19698    19736      +38     
==================================================
+ Hits                10939    10943       +4     
- Misses               8759     8793      +34     
Impacted Files Coverage Δ
ogre2/src/Ogre2Material.cc 84.30% <15.00%> (-7.86%) ⬇️

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 f025610...a6796ac. Read the comment docs.

ogre2/src/Ogre2Material.cc Outdated Show resolved Hide resolved
ogre2/src/Ogre2Material.cc Outdated Show resolved Hide resolved
@darksylinc
Copy link
Contributor

darksylinc commented Dec 4, 2021

Sounds like this is something that should be fixed from Upstream?

Detect if emissive is greyscale, then use a shader with the right swizzle

Update: Added fix to upstream. Remember to update C++ and copy shader files to ignition's.

Signed-off-by: Ian Chen <[email protected]>
@iche033 iche033 requested a review from ahcorde December 6, 2021 23:37
@iche033
Copy link
Contributor Author

iche033 commented Dec 6, 2021

great, thanks for implementing grayscale emissive map support upstream! I'm going to try get this in first, and remove later when I get time to port the fix over to our fork (and package / release new debs etc)

@iche033 iche033 merged commit 6c463bd into ign-rendering6 Dec 7, 2021
@iche033 iche033 deleted the fix_emissive_map_upload branch December 7, 2021 19:19
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.

Emissive map no longer works in ign-rendering6 (ogre2)
3 participants