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

Support for volume rendering #1417

Open
PolarBean opened this issue Sep 21, 2023 · 2 comments
Open

Support for volume rendering #1417

PolarBean opened this issue Sep 21, 2023 · 2 comments

Comments

@PolarBean
Copy link

This is a feature request for Siibra explorer to support Volumetric rendering with relevant information about that feature.

As of 2020 (see this commit google/neuroglancer@a12552d) Neuroglancer has supported Volume Rendering.
A guide can be found here on how to add this in the shader:
https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md#volume-rendering
Essentially you set alpha to the same values as the data times some large value.
here is a basic example:

void main () {
  float x = float(normalized());
  
  emitRGBA(vec4(x ,
               0,
              0,
               clamp(x*256.0,0.0,256.0)));
}

The reason for the multiplication is that is appears rgb values are between 0 and 1 whereas alpha values are between 0 and 256.
The issue with increasing the alpha of only one value is this value effectively changes the opacity of the layer. Further visualisations will inevitably look better using a white background for the projection.

Here is an example of a dataset that has volume rendering enabled for some data
https://tinyurl.com/2p9rfs8t
You can see here that the 2D planes are overexposed however this can be fixed by dividing the opacity value by the constant which the alpha value has been multiplied by, in this case 256.
https://tinyurl.com/yj9nt3ka

This view looks better however since every pixel has an individual opacity value it looks slightly different than the way it is rendered in siibra (here zero values are invisible but its a bit different from clamping since this achieved through gradually increasing opacity).

If siibra is updated to support this feature a choice would have to be made as to whether we just render volumes in the 2d view with per pixel opacities (which is fine IMO) or if the 2d view and 3d view are actually two seperate layers hidden from the user.

@PolarBean
Copy link
Author

Oh the good news is the commit which added this feature was less than 2 months after the nehuba fork diverged :)

@PolarBean
Copy link
Author

PolarBean commented Sep 29, 2023

In case it is useful i created a fork at the relavant commit of neuroglancer:
https://github.com/polarBean/neuroglancer/tree/volume-rendering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants