yt.visualization.volume_rendering.zbuffer_array module

class yt.visualization.volume_rendering.zbuffer_array.ZBuffer(rgba, z)[source]

Bases: object

A container object for z-buffer arrays

A zbuffer is a companion array for an image that allows the volume rendering infrastructure to determine whether one opaque source is in front of another opaque source. The z buffer encodes the distance to the opaque source relative to the camera position.

  • rgba (MxNx4 image) – The image the z buffer corresponds to
  • z (MxN image) – The z depth of each pixel in the image. The shape of the image must be the same as each RGBA channel in the original image.


>>> import numpy as np
>>> shape = (64, 64)
>>> b1 = Zbuffer(np.random.random(shape), np.ones(shape))
>>> b2 = Zbuffer(np.random.random(shape), np.zeros(shape))
>>> c = b1 + b2
>>> np.all(c.rgba == b2.rgba)
>>> np.all(c.z == b2.z))
>>> np.all(c == b2)
paint(ind, value, z)[source]