forked from google/neuroglancer
-
Notifications
You must be signed in to change notification settings - Fork 0
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: option to hide cross section background in 3D slice views #45
Open
seankmartin
wants to merge
17
commits into
master
Choose a base branch
from
feature/hide-cross-section-opaque
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aranega
approved these changes
Nov 1, 2024
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.
All looks good to me :) !
…d be to hide areas of the cross sectiont that are transparent in 3D
aranega
approved these changes
Dec 17, 2024
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.
All looks good to me :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new global setting to optionally hide the background of 3D cross-sections in Neuroglancer. When activated, this setting allows users to view 3D slice projections without the background color, offering a less obstructed view of the data while still keeping the slice views in 3D on. Open to thoughts and suggestions on the functionality and implementation!
Default (background visible):
New Option (background hidden):
Motivation
When displaying slice views in 3D, the background of 2D cross-sections can sometimes appear prominently, especially when the user is zoomed out. This view can be useful but may also limit visibility of the 3D content itself. This feature provides the flexibility to hide the background in 3D, to improve visibility without turning off the section rendering completely. 2D cross-section views remain unaffected.
User interaction
In neuroglancer, this setting is available in the same panel where users toggle 3D view sections. It can also be enabled or disabled with the global "t" keybind (representing "Transparent"), selected to avoid overlap with existing shortcuts. Very open to suggestions on the keybind.
Implementation
The primary change is to the
SliceViewRenderHelper
class, and specifically the constructor and shader. The shader becomes a context and parameter dependent shader instead of a fixed shader. This allows the shader to change based on whether the user controlled setting is toggled on or off (the parameter to the memoized shader getter), and whether the render helper is for a cross-section view or projection view (the context).When the hide setting is on, and the rendering is for a projection view, if the alpha of the sampled cross-section texture is 0 in the fragment shader, instead of picking up the background color, the fragment is discarded.
Oblique slicing example
For clarity, here is an example with oblique slicing and a red projection background to illustrate the effects of this new setting.