# How the rendering pipeline works

> Understand how camera frames move through on-device tracking, effects, rendering, and output before they reach your app.

> For AI agents: the complete documentation index is at https://nosmai.com/llms/effects.txt

Product: Nosmai Effects
Group: core-concepts
Source: https://nosmai.com/docs/effects/concepts/how-the-pipeline-works/

## Frame path

![Detailed Nosmai rendering pipeline from a source frame through processing to output](/images/docs/nosmai-rendering-pipeline-v1.svg)

Nosmai Effects processes frames on the device. Camera pixels are not uploaded
to apply beauty, masks, backgrounds, or authored effects. Network access is
used separately for license verification and Cloud Filter catalog or asset
downloads.

## Processing stages

Nosmai enables only the stages needed by the active features. A color filter
does not require the same work as face-tracked makeup or background
segmentation. This is why two effects can have different performance on the
same device.

The normal target is 30 FPS. Actual frame rate depends on the device, input
resolution, active effect, recording or streaming load, and thermal state.

## Effect composition

The runtime uses separate visual slots:

- A regular `filter` can remain active with an AR package.
- `effect` and `beauty_effect` share the AR slot and replace each other.
- A `background` package replaces the previous authored background.
- Built-in beauty can remain active with a regular filter.
- A `game` owns the full visual mode and clears conflicting effects.

Applying a new package in the same slot replaces the previous package. Observe
the SDK's active-state callback instead of assuming that a button tap always
leaves the requested package active.

## Camera-owned and external-frame flows

In the normal flow, Nosmai displays a camera preview and provides processed
capture, recording, or streaming output. In an external-frame flow, the host
application owns the source and submits frames to native iOS or Android.

Use one camera owner at a time. If another camera library already owns the
device, dispose or pause it before opening a Nosmai camera preview. Camera2
device error `2` on Android commonly means another camera session is still
using the hardware.

## Output ownership

The consumer owns any copied photo or finalized recording returned by the SDK.
For real-time native frame callbacks, ownership is shorter:

- Retain an iOS `CVPixelBuffer` if it is needed after the callback returns.
- Consume or copy Android native output before submitting the next frame.
- Never build an unbounded frame queue. Keep the newest waiting frame.
- Remove callbacks before releasing the camera, encoder, or GL context.

## Next steps

- [Understand filters and effects](/docs/effects/concepts/filters-and-effects/)
- [Learn how Cloud Filters work](/docs/effects/concepts/cloud-filters/)
- [Use processed output](/docs/effects/concepts/off-screen-rendering/)
- [Review limits and performance](/docs/effects/limits-and-performance/)

## References

- [Platform support](/docs/effects/platform-support/)
- [Nosmai Effects](https://nosmai.com/effects/)
