-
Notifications
You must be signed in to change notification settings - Fork 4
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
volume rendering for volumetric data #472
Comments
This also seems odd to me. I can confirm I get similar results. @akaszynski Is there something we are doing wrong when volume rendering (upper left corner image)? (FYI, the majority of the volume rendering examples on the docs don't appear for me.) |
@wangfudong Actually, I think I see your problem. You need to switch the line grid.point_arrays['scalars'] = scalars_a.ravel() to grid.point_arrays['scalars'] = scalars_a.flatten(order="F") FORTRAN ordering is required. This solved the problem for me. Can you confirm it does the same for you? |
@wangfudong In regards to your second question, In essence, when you specify I believe from your code that you think you are setting the opacity of the color channels, but that is not actually how The opacity transfer functions are specified in transfer_func = {
'linear': np.linspace(0, 255, n_colors, dtype=np.uint8),
'geom': np.geomspace(1e-6, 255, n_colors, dtype=np.uint8),
'geom_r': np.geomspace(255, 1e-6, n_colors, dtype=np.uint8),
'sigmoid': sigmoid(np.linspace(-10.,10., n_colors)),
'sigmoid_3': sigmoid(np.linspace(-3.,3., n_colors)),
'sigmoid_4': sigmoid(np.linspace(-4.,4., n_colors)),
'sigmoid_5': sigmoid(np.linspace(-5.,5., n_colors)),
'sigmoid_6': sigmoid(np.linspace(-6.,6., n_colors)),
'sigmoid_7': sigmoid(np.linspace(-7.,7., n_colors)),
'sigmoid_8': sigmoid(np.linspace(-8.,8., n_colors)),
'sigmoid_9': sigmoid(np.linspace(-9.,9., n_colors)),
'sigmoid_10': sigmoid(np.linspace(-10.,10., n_colors)),
} For example, I would recommend using @MatthewFlamm @akaszynski This would be another great thing to add to our documentation! The volume rendering section could use some TLC. |
@wangfudong Are you able to share your data set with us so we can analyze the issue on our end as well? @akaszynski @adeak @MatthewFlamm I've also had scenarios like in |
Hi, sorry for my bothering you~
I have nowadays utilized this useful project to render my research datas, but I got some troubles with it.
I have output some volumetric data of shape [H, W, D, C] consisting of [R,G,B,A] channels following the Optical Models for Direct Volume Rendering method https://courses.cs.duke.edu/cps296.8/spring03/papers/max95opticalModelsForDirectVolumeRendering.pdf, where channel A is the so-called 'extinction coefficient (= 1- opacity)' or 'density' in some literatures. In this data, each voxel in the grid is assigned with [r,g,b,a] values.
Next I used pyvista to render it as follows:
In the code
pc.add_mesh(PC, opacity=opacity, lighting=True, smooth_shading=True)
, I usedopacity = [0, 1, 0] or opacity = [0, 1]
, respectively. The output figures are as follows:With these rendering results., I have some doubts,
opacity = [0, 1, 0] or opacity = [0, 1]
, the later looks similar to the isosurface mesh, which is closed to my desired. I read the python code 'add_volume()' and learn how the 'opacity' is calculated numerically and spanned to the the same size with 'n_colors'. However, why can not assign each voxel/point/cell an opacity value? Can you tell me the principle that pyvista used to implement the parameter 'opacity', or articles/books/links are ok.Thank you very much :)
The text was updated successfully, but these errors were encountered: