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