[yt-users] Broken volume rendering

Matthew Turk matthewturk at gmail.com
Thu Jul 29 17:20:46 PDT 2010


Hi all,

I broke volume rendering (via yt.extensions.volume_rendering) some
time ago, and I only just realized it today when some people were
getting corrupted images.  It took a while to come up because I
avoided re-generating the Cython/C code that actually conducts the
volume rendering; however, recently I updated this code and pushed it
to the repository, and that's when the errors started showing up.

The exact error was in mercurial changeset 3007999e2518 (May 30),
which I merged into trunk in revision 1754 (June 24).  These dates are
not necessarily the dates at which the error showed up, however, as
the re-cythonization probably did not occur at those times.  The error
was in the optimization of division by the inverse of the vector
direction; the rays to cast were passed to partitioned bricks and to
avoid too much division of 64-bit floats, I changed it to be a
multiplication against the inverse.

To calculate the inverse, I did something similar to this:

for i in range(3):
    iv_dir[i] = 1.0/v_dir[0]

The error, of course, being that I was dividing by v_dir[0] for all
three values.

I identified this by using the hg bisect command, where I found a good
revision and a bad revision and it executed the necessary tests to
figure out where the code took a turn for the worse.  I've committed
fixes in hg changeset f0960f4f6bed, svn trunk r1804 and svn yt-1.7
r1805.

I'm really sorry for the troubles, and I hope that it hasn't cost
anyone too much time.  There may still be some lingering bugs, so
please let me know if you run into any more bad images or difficulties
with the volume rendering.  You can get an updated yt by doing "yt
instinfo -u".

-Matt



More information about the yt-users mailing list