[yt-dev] Issue #873: volume rendering set_background does not work (yt_analysis/yt)

Cameron Hummels issues-reply at bitbucket.org
Wed Jul 30 21:12:23 PDT 2014


New issue 873: volume rendering set_background does not work
https://bitbucket.org/yt_analysis/yt/issue/873/volume-rendering-set_background-does-not

Cameron Hummels:

I tried to make a VR with different background colors by combining the two cookbook recipes:

http://yt-project.org/docs/dev-3.0/cookbook/simple_plots.html#image-background-colors
http://yt-project.org/docs/dev-3.0/cookbook/simple_plots.html#simple-volume-rendering

The resulting script is here:

http://paste.yt-project.org/show/4978/

Unfortunately, the 'background' keyword for `write_png` doesn't seem to work on real VRs.  All of the options end up yielding the original all-black background.

When I dug into the code to figure out what was going on, it appears the problem is that the color channels are being normalized by the opacity channel prior to adding in the background color, and then renormalized by 1-opacity afterwards.  The VRs produced by the standard recipe yield a opacity=1 uniformly across the image, which essentially wipes out any changes from the renormalization.  

I can rip out this renormalization, or replace it with a rescale() function, but I wanted to make sure that wouldn't break other things.  Maybe this isn't worth changing since VR is getting a makeover soon.





More information about the yt-dev mailing list