-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
feat(ImageSlice): add forceOpacity and forceTransparent #3128
Conversation
To maintain consistent render effect with stacked image slices no matter the opacity of the slices. closes Kitware#3126
9135442
to
5b1ffda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🎉 This PR is included in version 32.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Is this a workaround for a bug in rendering? I'm trying to understand when to |
You may want to forceOpaque when you want to render something translucent but writing in the depth buffer. |
Thanks @finetjul I guess the default (without setting these force properties) is to render something translucent without a depth buffer and render something opaque with writing to the depth buffer? What are the main reasons that one might or might not want to write to the depth buffer? |
Yes, this is the default.
Want to write in depth buffer: if you don't want other actors to render behind the actor I do not have a special use case in mind (besides Paul's), but I remember needing those in VTK C++. That's why Paul just "brought" those "forceXXX" functions from VTK-C++ to VTK.js |
Amazing, thanks |
To maintain consistent render effect with stacked image slices no matter the opacity of the slices.
Context
When the prop's transparency crosses from .999 to 1, it gets slotted in the Opaque render pass and can change its render order: https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/ImageSlice/index.js#L24-L26
When multiple slices are layered changing the tranparency can inavertently change how they are blended. Would be nice to keep a slice in a consistent render pass despite the opacity. Then can avoid this workaround: https://github.com/Kitware/VolView/pull/654/files#diff-3b32a6ae4684ef94faf56b59ea525d8c8adccc792d96cb56613eec2aedf6faf6R20
Results
From an added test: before with 2 actors where one is translucent
After with adding
actorAbove.setForceTranslucent(true)
Changes
PR and Code Checklist
npm run reformat
to have correctly formatted codeTesting