<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Scott,<div class=""><br class=""></div><div class="">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: <a href="https://bitbucket.org/yt_analysis/yt/pull-requests/2381/bugfix-fix-zoom-for-perspective-lens/diff" class="">https://bitbucket.org/yt_analysis/yt/pull-requests/2381/bugfix-fix-zoom-for-perspective-lens/diff</a></div><div class=""><br class=""></div><div class="">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 (<a href="http://yt-project.org/docs/dev/reference/api/generated/yt.visualization.volume_rendering.camera.Camera.rotate.html?highlight=rotate" class="">http://yt-project.org/docs/dev/reference/api/generated/yt.visualization.volume_rendering.camera.Camera.rotate.html?highlight=rotate</a>); 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.</div><div class=""><br class=""></div><div class="">Thanks for reporting this!</div><div class=""><br class=""><div class="">
<div class=""><div class="">Best wishes,</div><div class="">--</div><div class="">Suoqing JI</div><div class="">Ph.D Candidate</div><div class="">Department of Physics</div><div class="">University of California, Santa Barbara</div><div class=""><a href="http://web.physics.ucsb.edu/~suoqing" class="">http://web.physics.ucsb.edu/~suoqing</a></div></div>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Sep 16, 2016, at 3:13 PM, Scott Feister <<a href="mailto:sfeister@gmail.com" class="">sfeister@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Nathan,<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Scott</div></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><br class="">Scott Feister, Ph.D.<br class="">Postdoctoral Researcher, Flash Center for Computational Science<br class=""></div><div class="">University of Chicago, Department of Astronomy and Astrophysics<br class=""></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br class=""><div class="gmail_quote">On Thu, Sep 15, 2016 at 8:57 PM, Nathan Goldbaum <span dir="ltr" class=""><<a href="mailto:nathan12343@gmail.com" target="_blank" class="">nathan12343@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Hi Scott,<div class=""><br class=""></div><div class="">So this is really two issues.</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class="">source.tfh.build_transfer_<wbr class="">function()</div><div class="">source.tfh.setup_default()</div><div class="">source.transfer_function = <a href="http://source.tfh.tf/" target="_blank" class="">source.tfh.tf</a></div><div class=""><br class=""></div><div class="">After manipulating source.tfh.</div><div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class=""><a href="http://paste.yt-project.org/show/6823/" target="_blank" class="">http://paste.yt-project.org/<wbr class="">show/6823/</a><br class=""></div><div class=""><br class=""></div><div class="">Which makes these two images:</div><div class=""><br class=""></div><div class=""><a href="http://i.imgur.com/gwUTWz1.png" target="_blank" class="">http://i.imgur.com/gwUTWz1.png</a> (rendering.png)<br class=""></div><div class=""><a href="http://i.imgur.com/M1lSz0N.png" target="_blank" class="">http://i.imgur.com/M1lSz0N.png</a> (rendering2.png)<br class=""></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">-Nathan</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><div class=""><div class="h5">On Thu, Sep 15, 2016 at 7:38 PM, Scott Feister <span dir="ltr" class=""><<a href="mailto:sfeister@gmail.com" target="_blank" class="">sfeister@gmail.com</a>></span> wrote:<br class=""></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class="h5"><div dir="ltr" class="">Hi yt users,<div class=""><br class=""></div><div class="">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 (<a href="http://yt-project.org/doc/visualizing/volume_rendering.html" target="_blank" class="">http://yt-project.org/doc/vis<wbr class="">ualizing/volume_rendering.html</a><wbr class="">) looks something like this:<div class=""><br class=""></div><div class="">...<br class=""></div><div class=""><div class=""><i class="">sc = yt.create_scene(ds, lens_type='perspective')</i></div><div class="">...</div><div class=""><i class="">source = sc[0]</i></div><div class=""><i class=""><span class="">source</span><span class="">.</span><span class="">tfh</span><span class="">.</span><span class="">set_bounds</span><span class="">((</span><span class="">3e-31</span><span class="">,</span> <span class="">5e-27</span><span class="">))</span></i></div><div class=""><i class="">...</i></div><div class=""><i class="">sc.save('rendering.png', sigma_clip=6.0)<br class=""></i></div><div class=""><div class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><br class=""></div><div dir="ltr" class="">And, voila, volume rendering saved to png.</div><div dir="ltr" class=""><br class=""></div><div class="">However, if I naively continue the script to re-render with new settings:</div><div class=""><div class=""><i class=""><span class="">source</span><span class="">.</span><span class="">tfh</span><span class="">.</span><span class="">set_bounds</span><span class="">((</span><span class="">3e-35</span><span class="">,</span> <span class=""><wbr class="">5e-27</span><span class="">))</span></i></div></div><div class=""><i class=""><span class="">sc.camera.zoom(2.0)</span></i></div><div class=""><div class=""><i class="">sc.save('rendering2.png', sigma_clip=6.0)<br class=""></i></div><div class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""></div></div></div></div></div></div></div></div></div></div><div dir="ltr" class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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?<br class=""></div><div class=""><br class=""></div><div dir="ltr" class="">Best,</div><div dir="ltr" class=""><br class=""></div><div dir="ltr" class="">Scott</div><div dir="ltr" class=""><br class=""></div><div dir="ltr" class=""><br class="">Scott Feister, Ph.D.<br class="">Postdoctoral Researcher, Flash Center for Computational Science<br class=""></div><div class="">University of Chicago, Department of Astronomy and Astrophysics<br class=""></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></div></div></div>
<br class=""></div></div>______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/lis<wbr class="">tinfo.cgi/yt-users-spacepope.<wbr class="">org</a><br class="">
<br class=""></blockquote></div><br class=""></div>
<br class="">______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/<wbr class="">listinfo.cgi/yt-users-<wbr class="">spacepope.org</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" class="">yt-users@lists.spacepope.org</a><br class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br class=""></div></blockquote></div><br class=""></div></body></html>