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.

Parameters:
  • 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.

Examples

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