Hi Suoqing,

Of course! Here's a link to the bug report I submitted; I updated it to include your reply. I think the starting point for new users is going to be adding to the documentation on the mindset of how these various pieces fit together. As I better learn how "cameras", "lenses", "scenes" etc. jive together in yt, I'd be happy to add to sections of the documentation where I got stuck.

If you think that's a good idea, how can I become a supporting editor of the documentation for http://yt-project.org/doc/? Specifically, http://yt-project.org/doc/visualizing/volume_rendering.html ?

Scott


Scott Feister, Ph.D.
Postdoctoral Researcher, Flash Center for Computational Science
University of Chicago, Department of Astronomy and Astrophysics

On Fri, Sep 16, 2016 at 6:56 PM, Suoqing Ji <suoqing@physics.ucsb.edu> wrote:
Hi Scott,

Just add a bit to Nathan’s comments on volume rendering — previously the zooming factor does not change the open angle of perspective lens, that’s why you got the same images before and after zooming. I’ve already issued a PR here to fix this: https://bitbucket.org/yt_analysis/yt/pull-requests/2381/bugfix-fix-zoom-for-perspective-lens/diff

In addition, if you would like to rotate the camera and keep your focus fixed, you could specify the parameter “rot_center” to be your focus (http://yt-project.org/docs/dev/reference/api/generated/yt.visualization.volume_rendering.camera.Camera.rotate.html?highlight=rotate); if not, the default rotation center is the camera location. The default rotation center is not set to focus point because sometimes people use camera without setting the focus (say, giving the camera location and orientation already makes a camera well-defined). But we can definitely discuss and think about how to improve this.

Thanks for reporting this!

Best wishes,
--
Suoqing JI
Ph.D Candidate
Department of Physics
University of California, Santa Barbara

On Sep 16, 2016, at 3:13 PM, Scott Feister <sfeister@gmail.com> wrote:

Hi Nathan,

Thank you so much for this explanation. It gets me off the ground running! I appreciate the work you've done to make the volume rendering so amazing; these are small final touches. I'll be happy to open a bug report.

Scott


Scott Feister, Ph.D.
Postdoctoral Researcher, Flash Center for Computational Science
University of Chicago, Department of Astronomy and Astrophysics

On Thu, Sep 15, 2016 at 8:57 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
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.tf

After 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:


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.

-Nathan

On Thu, Sep 15, 2016 at 7:38 PM, Scott Feister <sfeister@gmail.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/visualizing/volume_rendering.html) looks something like this:

...
sc = yt.create_scene(ds, lens_type='perspective')
...
source = sc[0]
source.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 Science
University of Chicago, Department of Astronomy and Astrophysics

_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org



_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org