Hi Cameron, this answers a question I've had for a white, since I've been trying to get a white background.  Two comments on the new cookbook recipe you just posted -- are you sure that "up" is "up" in those images?  When I use write_png, my image is upside down.  Secondary, do we want to try to pass the transparent/white background stuff through the draw_domain and save_annotated functions?  At the moment, draw_domain forces things to be black, and save_annotated sets the facecolor of the resulting plot to black.


On Thu, Jul 31, 2014 at 12:12 AM, Cameron Hummels <issues-reply@bitbucket.org> wrote:
New issue 873: volume rendering set_background does not work

Cameron Hummels:

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


The resulting script is here:


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.

yt-dev mailing list

Michael Zingale
Associate Professor

Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY 11794-3800
phone:  631-632-8225
e-mail: Michael.Zingale@stonybrook.edu
web: http://www.astro.sunysb.edu/mzingale