Hi Scott,So this is really two issues.The first, is that the camera.zoom() function doesn't really zoom in on the image, instead it decreases the "width" the volume rendering region by the zoom factor. This makes a lot of sense for plane-parallel volume renderings (the default), but not so much for perspective lenses as you saw. For a perspective lens you should instead reposition the camera to be closer to the focus to get the same effect.Next, you also saw that manipulating the TransferFunctionHelper object (source.tfh) after you've already done a volume rendering doesn't update the transfer function. That's because the TransferFunctionHelper object is only used to generate the transfer function (source.transfer_function) if it isn't set yet. If it's already set, it reuses it. So in your example the first time you called save(), the VolumeSource saw that no one had manually created a transfer function, and used the TransferFunctionHelper object to build one. Then, when you asked it for the second rendering, it just reused the same one because right now the VolumeSource doesn't track if the TransferFunctionHelper has been updated. To do what you mean, you need to manually set the transfer function to be the one generated by the TransferFunctionHelper:source.tfh.build_transfer_
function()source.tfh.setup_default()source.transfer_function = source.tfh.tfAfter manipulating source.tfh.Using as an example the script from the docs, here's how to make the second image come out as you would expect for the perspective lens:Which makes these two images:http://i.imgur.com/gwUTWz1.png (rendering.png)http://i.imgur.com/M1lSz0N.png (rendering2.png)I think we could probably do a better job of detecting that the TransferFunctionHelper has been manipulated and avoid this confusion, if you'd like I invite you to open an issue about this on our issue tracker. One might also argue that the zoom function should adjust the camera position for perspective lenses.Sorry the volume renderer isn't totally intuitive for this use case. I did some work before the yt 3.3.1 release to improve things, but it's still definitely not perfect. I think there's a lot of power there but it also really needs some love from someone who is willing to think about corner cases and interactive workflows.-NathanOn Thu, Sep 15, 2016 at 7:38 PM, Scott Feister <email@example.com> wrote:______________________________Hi yt users,Hi there! I'm just starting to use yt to make volume renderings of FLASH simulations. While working through examples, I hit a roadblock, and I've had some difficulty finding good documentation on the what the "Scene.save()" function actually does; specifically, why it does different things on the first and second call. The first example in the user tutorial page for 3D volume rendering (http://yt-project.org/doc/vis ualizing/volume_rendering.html ) looks something like this:...sc = yt.create_scene(ds, lens_type='perspective')...source = scsource.tfh.set_bounds((3e-31, 5e-27))...sc.save('rendering.png', sigma_clip=6.0)And, voila, volume rendering saved to png.However, if I naively continue the script to re-render with new settings:source.tfh.set_bounds((3e-35, 5e-27))sc.camera.zoom(2.0)sc.save('rendering2.png', sigma_clip=6.0)I find that none of my new settings are reflected in "rendering2.png" -- it's just a duplicate of "rendering.png"! But if I start again from scratch with a new scene, the settings take hold. This leaves me (a new user) scratching my head.So here is my question: Once you've created and saved a scene once, how do you change scene settings like colormap and camera angle?Best,Scott
Scott Feister, Ph.D.
Postdoctoral Researcher, Flash Center for Computational ScienceUniversity of Chicago, Department of Astronomy and Astrophysics
yt-users mailing list
yt-users mailing list