# tfg.rendering.framebuffer.Framebuffer

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/graphics/blob/master/tensorflow_graphics/rendering/framebuffer.py#L88-L185) |

A framebuffer holding rasterized values required for deferred shading.

    tfg.rendering.framebuffer.Framebuffer(
        barycentrics: https://www.tensorflow.org/graphics/api_docs/python/tfg/rendering/framebuffer/RasterizedAttribute,
        triangle_id: tf.Tensor,
        vertex_ids: tf.Tensor,
        foreground_mask: tf.Tensor,
        attributes: Dict[str, https://www.tensorflow.org/graphics/api_docs/python/tfg/rendering/framebuffer/RasterizedAttribute] = dataclasses.field(default_factory=dict)
    )

Tensors are expected to have shape \[batch, height, width, channels\].

For now, the fields are specialized for triangle rendering. Other primitives
may be supported in the future.

Immutable once created. Uses cached_property to avoid creating redundant
tf ops when properties are accessed multiple times.

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `background_mask` | <br /> <br /> |
| `batch_size` | <br /> <br /> |
| `height` | <br /> <br /> |
| `is_multi_layer` | <br /> <br /> |
| `num_layers` | <br /> <br /> |
| `pixel_count` | <br /> <br /> |
| `width` | <br /> <br /> |
| `barycentrics` | Dataclass field |
| `triangle_id` | Dataclass field |
| `vertex_ids` | Dataclass field |
| `foreground_mask` | Dataclass field |
| `attributes` | Dataclass field |

<br />

## Methods

### `layer`

[View source](https://github.com/tensorflow/graphics/blob/master/tensorflow_graphics/rendering/framebuffer.py#L172-L185)

    layer(
        index
    )

Slices at the given layer index, returning a single-layer Framebuffer.

### `__eq__`

    __eq__(
        other
    )