API Reference · Diagnostics

OfflineRenderer

Namespace: Ava3D

public static class OfflineRenderer

Draws a scene into a Texture, with no window, no graphics context and no control.

This is render-to-texture as an operation a caller performs, rather than as a second pass inside a frame — and the difference is the whole design. A live nested render needs a second target on three graphics backends and a rule about a scene sampling a texture the same frame drew it, which is a week's work in the frame path and a class of ordering bug that only shows on one driver. Handing back an image the caller owns needs neither, and it is what almost every use of "render to texture" in a desktop application actually wants:

It runs on the CPU renderer, always, on every platform. That is a deliberate choice rather than a limitation to apologise for: it is the one backend that needs no context, so this works headless, in a unit test, on a build server and inside a background thread, and it gives the same pixels everywhere. What it costs is speed and the things that renderer cannot do — see RenderInfo.Features for the list, which is per-pixel lighting, most of the maps, and anti-aliasing.

Fields

MemberDescription
static long PixelLimit

The largest image this will draw, in pixels, unless OfflineRenderOptions.PixelLimit says otherwise — on the same reasoning as the CPU renderer's own budget.

Methods

MemberDescription
static Texture Render(Scene scene, Camera camera, int width, int height)

Draws scene as seen by camera into a new texture.

scene

What to draw. Not modified, and not retained.

camera

Where to draw it from.

width

Image width in pixels.

height

Image height in pixels.

returns

A texture holding the finished image, ready to put on a Material or to save.

static OfflineRenderResult Render(Scene scene, Camera camera, int width, int height, OfflineRenderOptions options)

Draws scene as seen by camera under options, and says what it left out.

scene

What to draw. Not modified, and not retained.

camera

Where to draw it from.

width

Image width in pixels.

height

Image height in pixels.

options

The budget, the size limit, the shading path and whether to composite.

returns

The picture, and the count of what the budget left out — OfflineRenderResult.Complete is the thing a test asserts.

static Texture Render(Scene scene, int width, int height, float orbitDegrees = 25.0f)

Draws scene from a camera framed on everything in it — the same framing a fresh view opens with.

static Texture RenderShaded(Scene scene, Camera camera, int width, int height)

Draws scene the way the GPU backends draw it: shaded once per pixel, with the maps the ordinary CPU path has no per-pixel coordinate to read.

scene

What to draw. Not modified, and not retained.

camera

Where to draw it from.

width

Image width in pixels.

height

Image height in pixels.

returns

A texture holding the finished image.

See also