2
$\begingroup$

I'm trying to render a simple spherical distribution where the opacity varies with radius using Image3D. Unfortunately, the outcome is not very appealing, with discrete colors showing up in the rendering:

enter image description here

You can see that not only are the colors discrete, they are not even in order, with some darker bands appearing in the image in the lighter regions, whereas the image should have the appearance of a smooth radial gradient.

The code I used to generate the above image is:

res = 100;
coords = Table[{i, j, k} - 0.5, {i, Range@res}, {j, Range@res}, {k, Range@res}];
dists = Map[N@Norm[# - res/2.] &, coords, {3}];
opa = 1/(dists + 0.1);
opa /= Max@opa;
ImageAdjust@Image3D[opa, ColorFunction -> "GrayOpacity"]

My question is if there are limitations for opacity in Image3D, and if so, are there ways around it?

$\endgroup$
  • $\begingroup$ In V9 I don't see the "alternating" effect $\endgroup$ – Dr. belisarius Oct 1 '14 at 16:13
  • $\begingroup$ This is what I get $\endgroup$ – Dr. belisarius Oct 1 '14 at 16:18
  • $\begingroup$ @belisarius I'm using V9 on OS X. Even if the banding is absent, the discrete color levels are undesirable, which I still see in your output. $\endgroup$ – Guillochon Oct 1 '14 at 17:14
  • $\begingroup$ There is a question somewhere about Opacity having a sharp cutoff (ie not being able to represent low gray values). Probably a hint that it's working with discrete values. $\endgroup$ – Dr. belisarius Oct 1 '14 at 17:25
  • $\begingroup$ I know that some volume renderers do only 256 discrete levels (IDL being an ancient example). I was hoping it was a global rendering option that perhaps was causing this. $\endgroup$ – Guillochon Oct 1 '14 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.