[yt-users] PerspectiveCamera question

Michael Zingale michael.zingale at stonybrook.edu
Wed Jun 4 10:24:06 PDT 2014


To add a little more to this, here's an example:

---

import pylab
from yt.mods import *

# following http://yt-project.org/docs/2.6/examining/generic_array_data.html

arr = np.random.random(size=(64,64,64))
data = dict(Density = arr)
bbox = np.array([[-1.5, 1.5], [-1.5, 1.5], [-1.5, 1.5]])
pf = load_uniform_grid(data, arr.shape)

import yt.visualization.volume_rendering.api as vr

c = (pf.domain_right_edge + pf.domain_left_edge)/2.0
L = np.array([-0.0, -1.0, -1.0])
W = 2.0*pf.domain_width
N = 720

tf = vr.ColorTransferFunction((0.0,1.0))
tf.add_layers(10, 0.1)

cam = vr.Camera(c, L, W, N, transfer_function=tf, pf=pf, fields=[('gas',
'Density')], log_fields=[False])

rot_vector=[0.0,0.0,1.0]
cam.rotate(2*np.pi/6., rot_vector=rot_vector)

im = cam.snapshot()
nim = cam.draw_domain(im)

pylab.imshow(nim)
pylab.savefig("test.png")


---

This generates a simple cube with the domain drawn, and it looks as I
expect.  If I change Camera to PerspectiveCamera, but leave everything else
unchanged, I get a blank image.


On Sat, May 24, 2014 at 4:41 PM, Michael Zingale <
michael.zingale at stonybrook.edu> wrote:

> I'd like to try using the PerspectiveCamera instead of the normal
> orthographic Camera.  My script renders fine with Camera(), but I thought
> that I should be able to just change Camera() to PerspectiveCamera() and it
> should render with the perspective.  Instead, I get an empty rendering --
> is there something else one needs to do to use the PerspectiveCamera rather
> than just changing the class name but otherwise keeping the argument list
> the same?
>
> Mike
>
> --
> Michael Zingale
> Associate Professor
>
> Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
> 11794-3800
> *phone*:  631-632-8225
> *e-mail*: Michael.Zingale at stonybrook.edu
> *web*: http://www.astro.sunysb.edu/mzingale
>



-- 
Michael Zingale
Associate Professor

Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
11794-3800
*phone*:  631-632-8225
*e-mail*: Michael.Zingale at stonybrook.edu
*web*: http://www.astro.sunysb.edu/mzingale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140604/65a7feab/attachment.htm>


More information about the yt-users mailing list