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 depth testing for transparent objects #1643

Merged
merged 2 commits into from
Jan 5, 2022
Merged

Conversation

jslee02
Copy link
Member

@jslee02 jslee02 commented Jan 4, 2022

Summary:
This PR fixes the issue that a transparent object is sometimes not displayed when it's behind another transparent object, which is not captured by #1414. It's fixed by two changes. Firstly, set OSG to render transparent objects after opaque objects using setRenderingHint() (see: this post). Secondly, disable z-buffer writing while enabling z-buffer testing during drawing transparent objects so transparent objects don't get rendered when they're behind opaque object but always rendered (with blending) even when they're overlapped with other transparent objects regardless of their z-depths. See this post.

Not fixed by this PR:
Fixing for VoxelShape is saved for the future PR. Also, there could be performance hit for MeshShape when the color mode is COLOR_INDEX.

Before the fix:
before_fix

After the fix:
after_fix


Before creating a pull request

  • Document new methods and classes
  • Format new code files using ClangFormat by running make format
  • Build with -DDART_TREAT_WARNINGS_AS_ERRORS=ON and resolve all the compile warnings

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change

@jslee02 jslee02 added this to the DART 6.13.0 milestone Jan 4, 2022
@codecov
Copy link

codecov bot commented Jan 4, 2022

Codecov Report

Merging #1643 (55aad10) into main (0bbc551) will decrease coverage by 0.00%.
The diff coverage is n/a.

❗ Current head 55aad10 differs from pull request most recent head c4b4484. Consider uploading reports for the commit c4b4484 to get more accurate results

@@            Coverage Diff             @@
##             main    #1643      +/-   ##
==========================================
- Coverage   59.09%   59.08%   -0.01%     
==========================================
  Files         491      491              
  Lines       40555    40555              
==========================================
- Hits        23965    23962       -3     
- Misses      16590    16593       +3     
Impacted Files Coverage Δ
dart/dynamics/Skeleton.cpp 67.74% <0.00%> (-0.17%) ⬇️

@jslee02 jslee02 changed the title Fix transparent object rendering Fix depth testing for transparent objects Jan 5, 2022
@jslee02 jslee02 marked this pull request as ready for review January 5, 2022 02:37
@jslee02 jslee02 merged commit 4041649 into main Jan 5, 2022
@jslee02 jslee02 deleted the fix_transparent_obj_viz branch January 5, 2022 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant