Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

capture.viewport

Renders a screenshot mirroring the active viewport. It mirrors the on-screen camera through the shared capture core, so the frame carries that camera's pose, its lens (fov, clip planes and the projection it builds), the lighting environment it states (an isolated camera's background and ambient) and the layers it draws the screen with, so the image matches the viewport's picture: the scene, its debug overlays and the content UI. The editor's own chrome (the EditorUI layer) is never in the frame. The raster is the viewport's own pixel size, the size getViewportSize() reports. Returns the picture as an image value, and writes a PNG as well when a path is given; fails when no active viewport camera exists.

Its one argument is a path to also write the PNG to, or a table overriding any of that for one capture: width / height for a raster of some other size, renderLayers for the frame under a different layer spec (!EditorUI is always appended to it, whatever it names; "all !debug" is the frame without the debug overlays) and postProcessing to take it with the grade off.

tools.use("capture", "viewport", "/source/tmp/capture/shot.png")
tools.use("capture", "viewport", { path = "/source/tmp/capture/clean.png",
                                   renderLayers = "all !debug" })
tools.use("capture", "viewport", { width = 960, height = 540 })