Spectra 1.23
EN
User manual · version 1.23

Rendering with Spectra

How to make pictures with Spectra's tools: the built-in scenes, your own glTF and OBJ models, lights, cameras, what comes out and how to get it faster. Programming with the library is in the SDK guide.

What Spectra is

Spectra is a ray tracer: it makes a picture of a scene by following rays of light between the camera, the objects and the lights, the way light travels in the world. Because it follows light rather than drawing triangles, it shows what a real camera would see without any tricks: soft shadows, light bouncing from wall to wall, reflections in everything glossy, glass that bends and splits light, smoke lit from inside.

Spectra is first of all a library, made to be built into other programs (the first is Titler, the 3D titling program). The package also has two programs that use it, and with them you can render without writing any code:

spectra-cli

The command-line renderer: two dozen sample scenes, glTF and OBJ models, every setting of the library as an option, pictures as PNG, OpenEXR or Radiance HDR.

spectra-server

Renders for programs on other machines: a computer without a GPU sends its scene to one with an NVIDIA card and gets the picture back.

The library

spectra.h and one static library. C99, no C++ runtime, no other libraries. See the SDK guide.

A glass ball, a polished gold ring and a brushed steel ring in sunlight, each throwing a bright curve of light
A glass ball and two metal rings in the computed sky. The bright curves on the table are caustics: sunlight gathered by the ring's inside and by the ball. spectra-cli --scene sunlit --samples 2048 --denoise --aces · 960×540 · GPU

Quick start

From the package to a first picture in four steps. The examples are for Windows; on Linux and MorphOS the programs have the same names without .exe.

  1. Unpack spectra-1.23.zip and open a command prompt in bin\windows-x64.
  2. Render the start-up scene:
    spectra-cli
    beam on the CPU: 960x540, 64 samples, 70 triangles stored, 0 instances, build 0.000 s, render 7.91 s -> out.png
    Open out.png: a beam of white light through a prism. With only 64 samples per pixel it is still grainy.
  3. Add samples, the denoiser and a film-like tone curve, and render on the graphics card if there is one:
    spectra-cli --samples 512 --denoise --aces --device auto --out beam.png
  4. Try the other scenes (the gallery shows them all) and your own model:
    spectra-cli --scene materials --denoise --aces --out materials.png
    spectra-cli --model chair.glb --sky 35,140 --samples 256 --denoise --aces --out chair.png

spectra-cli --help lists every option, spectra-cli --info tells which processor and which graphics cards Spectra can use on this machine.

The package

FolderWhat is in it
include/spectra/spectra.hThe library's interface, C99. Its comments are the reference for every function and field.
lib/<platform>/The library to link statically: spectra.lib (Visual Studio) or libspectra.a (gcc).
bin/<platform>/spectra-cli and spectra-server; on MorphOS also the test programs.
examples/minimal.c, the smallest program, and five programs that render something and check a result that can be known (materials, formats, instances, volumes, session).
manual/These pages: start with manual/index.html.
LICENSE.md, ACKNOWLEDGEMENTS.mdThe terms, and the published methods and formats Spectra is built on.

Platforms

PlatformLibraryState
Windows x64lib/windows-x64-msvc, lib/windows-x64-gccBuilt and tested; the Visual Studio library also renders on NVIDIA GPUs.
Linux x64lib/linuxBuilt and tested by the author (gcc 13).
MorphOS (PowerPC)lib/morphos-ppcBuilt with the MorphOS SDK's gcc 9.5; see MorphOS.

Rendering with spectra-cli

spectra-cli builds a scene (one of its own, a model file or a saved scene), renders it and writes the picture. Everything is given as options; those not given keep their defaults:

spectra-cli --scene ring --size 1280x720 --samples 1024 --denoise --aces --out ring.png

The options that matter most:

OptionDefaultWhat it does
--scene NAMEbeamA built-in scene; see the gallery.
--model FILEA model file instead: .gltf, .glb or .obj. See your own models.
--size WxH960x540The picture's size in pixels.
--samples N64Rays per pixel. More = less noise, longer render. See samples.
--integrator path|directpathFull light transport, or the fast direct light only. See path and direct.
--bounces N6How often light may bounce. Glass and mirrors in front of each other want more.
--denoiseFilter the remaining noise out, guided by the surfaces' colours, directions and distances.
--aces, --tonemap NAMEnoneHow bright light is squeezed into what a screen can show. See the picture.
--device cpu|gpu|autocpuWhere to render; auto takes an NVIDIA GPU when there is one.
--out FILEout.png.png, .exr (every buffer as floats) or .hdr.
--quietNo progress, only the summary line.

While it renders, spectra-cli shows how far it is. At the end it prints one line: the scene, the device, the size, the samples, the triangles stored, the instances, and the times to prepare the scene and to render it. The last chapter lists every option.

Your own models

spectra-cli --model house.glb --samples 512 --denoise --aces --out house.png
spectra-cli --model robot.obj --env studio.hdr --env-strength 1.5 --out robot.png

--model reads glTF 2.0 (.gltf with its .bin and pictures, or one .glb) and Wavefront OBJ (.obj with its .mtl). Pictures may be PNG (also 16-bit), JPEG (also progressive) or WebP, lossless 0.98 or lossy, also with transparency 1.3 (in glTF through EXT_texture_webp); Spectra reads them with decoders of its own. An animated WebP is not read: a glTF texture then uses its other picture, if it has one.

What comes across from glTF

  • Meshes, with a mesh used by several nodes stored once and placed as instances.
  • The metallic-roughness material: base colour, metallic, roughness, normal and emission maps, alpha (opaque, mask, blend), and the extensions KHR_materials_transmission, _ior, _dispersion, _clearcoat, _sheen, _anisotropy, _emissive_strength.
  • Texture samplers (repeat, clamp, mirror; nearest or smooth) and KHR_texture_transform on every texture.
  • The file's first camera, and its lamps (KHR_lights_punctual).

Parts compressed with meshopt (EXT_meshopt_compression, also with KHR_mesh_quantization) are read 0.99. Parts compressed with Draco are skipped, and spectra-cli says how many; such a file has to be saved again without Draco. Pictures that cannot be decoded are counted the same way.

Light and ground for a model

A model file that brings no lamps of its own gets a sun from the upper left and a pale blue background, so that something is seen at once. For real light give it a sky or an environment map:

OptionWhat it does
--sky ELEV[,AZIMUTH[,HAZE]]Daylight computed for a sun ELEV degrees above the horizon and AZIMUTH degrees round it (0 = towards −Z, ahead of a camera that looks down −Z; 90 = towards +X); haze 2 (very clear) to 10.
--env FILEAn environment map: a panorama of real surroundings that lights the model and is seen behind it. Radiance .hdr or OpenEXR .exr 0.92, latitude-longitude, twice as wide as high.
--env-strength X, --env-rotation DEGBrighter or darker; turned around the vertical.
--no-groundLeave out the floor spectra-cli puts under a model.
--auto-cameraIgnore the file's camera; look at the whole model from in front, a little to the right and above.

Models found on the web come with their own licences. A picture rendered from a model is a copy of it in the eyes of many licences: check before you publish.

Path and direct

Spectra has two ways of working out the light, called integrators.

The demo scene with the path tracer: light bounces between the objects and the floorpath · 256 spp
The demo scene with the direct integrator: lamp light, shadows, reflections, no bounced lightdirect · 16 spp

The same scene. Left, the path tracer: light bounces, shadows are filled by light from the floor and the sky, colours bleed. Right, the direct integrator with a sixteenth of the samples: only the light that comes straight from the lamps, the sun and the sky, with mirrors and glass. --scene demo --integrator path|direct

In the direct integrator a glowing surface glows but lights nothing. A scene lit only by such surfaces (the Cornell box, whose lamp is a glowing panel in the ceiling) comes out black but for the panel. Use lamps, the sky or an environment map there, or the path tracer.

path default
A path tracer. Light bounces as often as --bounces allows, so everything lights everything: colour bleeding, light in rooms, glossy reflections of glossy things, caustics, volumes, subsurface scattering, dispersion. Its pictures start noisy and clear up with samples. Runs on the CPU and on NVIDIA GPUs.
direct
Light that comes straight from a lamp, the sun or the sky, with its shadows, plus mirror reflection and refraction through glass. Light does not bounce off matte surfaces, so rooms are darker and glowing surfaces do not light others. Few samples are enough, so it is quick: for previews, for titles and graphics, for anything whose look is set by its lamps. Runs on the CPU only.

Some things only the path tracer shows: path marks them in these pages (dispersion, caustics, volumes fully lit).

Samples, noise, denoising

A path tracer estimates each pixel from random paths of light. With few paths the estimate is grainy, and the grain halves only when the samples are made four times as many. Three ways to a clean picture:

Sixteen samples per pixel: grainy16 spp
Sixteen samples, denoised: smooth16 spp + --denoise
2048 samples: clean2048 spp

Left to right: 16 samples per pixel; the same denoised (a few hundredths of a second); 2048 samples, 128 times the work. --scene cornell --size 512x512

  • More samples: --samples N. Always right, slow for the last bit of grain.
  • The denoiser: --denoise. It smooths the noise but keeps edges, guided by what the first surface in each pixel is: its colour (albedo), its direction (normal) and its distance (depth). With very few samples it can wash out fine texture; 64 to 256 samples and the denoiser is a good balance.
  • Adaptive sampling: --adaptive 0.01 --samples 1024. Each pixel stops once its remaining error is below 1% of its brightness; --samples becomes the most any pixel takes. The sky and flat walls stop early, the hard places go on. The motion scene renders with 19% of the samples a fixed count would take.

Bright single pixels ("fireflies") come from rare paths that find a small bright light by chance, usually through glass or off a mirror. --caustics follows such light from the lamp instead, and the library also clamps the brightest indirect light (clamp_indirect, 10 by default).

Light

A scene is lit by its lamps, by surfaces that glow, and by the world around it: a plain colour, a computed sky, or an environment map.

Lamps

LampWhat it is
PointLight from a point in all directions; with a radius, a small ball that gives soft shadows. A picture wrapped around it gives it a measured spread (IES).
SpotA point lamp limited to a cone, with a soft edge; with a picture it is a slide projector.
SunParallel light from a direction; its angular size softens the shadows.
PanelA glowing rectangle or disk, shining to one side: windows, softboxes, ceiling lights. Can show a picture across its face and limit its spread like a softbox grid.
Glowing surfacesAny mesh whose material emits light lights the scene too (in the path tracer).
A spot lamp throws a pattern of coloured fields across a ball onto a wall; a panel overhead glows in two colours
Lamps with pictures: a spot lamp throws coloured fields like a slide projector, a panel shows two colours across its face. --scene projector --samples 1024 --denoise --aces

Sky and environment

--sky 35,140 computes a daylight sky for that sun: light scattered by the air (blue overhead, white near the horizon, red at sunset) and the sun's disc in it, which lights the scene with sharp shadows and shows in mirrors. --env FILE.hdr uses a photographed panorama instead.

Caustics path

Light focused by glass or a curved mirror (the bright spot behind a glass of water, the curve inside a ring) is hard to find from the camera's side. --caustics follows it from the lamps, glowing surfaces and the sun's disc instead; --caustics-sky also from the sky. It is stored once before rendering so that it is seen in mirrors and through glass too; --photons N sets how many paths that store has.

A polished gold ring standing on a table; its inside focuses a lamp's light into a bright heart-shaped curve
The curve of light inside a polished ring: a caustic, followed from the lamp. --scene ring --samples 2048 --denoise --aces (the scene turns caustics on)

Measured lamps (IES)

Lamp makers publish how their lamps spread light as IES files (IESNA LM-63). --scene ies --ies FILE puts three such lamps in front of a wall. Horizontal angle 0 of the file lies along the lamp's length, and the angles grow counterclockwise seen from above.

Materials at a glance

Every surface in Spectra has one kind of material, with settings that make it anything from chalk to chrome to glass. glTF and OBJ files bring their materials along; in a program you set them yourself (see materials in the SDK guide).

Twelve balls on a dark checkered floor, each a different material
Matteroughness 1, no specularPlasticroughness 0.25Car paintclear coat over redVelvetsheen Goldmetallic, roughness 0.18Chromemetallic, roughness 0Brushed steelanisotropySoap filmthin film, 380 nm Glasstransmission 1Frosted glassroughness 0.3Diamondior 2.42, dispersionWaxsubsurface
The material gallery, made by docs/manual/src/manual_pictures.c. 1200×760 · 512 spp · path · denoised · filmic

Cameras

Every scene has its camera; --camera renders it through another kind of lens from the same place.

The forest through a fisheye lens: a round picturefisheye
The studio scene with parallel rays: no perspectiveortho
The forest all around the camera, 360 degrees across
A panorama: everything around the camera, 360° across and 180° from top to bottom. Such a picture can itself be an environment map. --scene forest --camera panorama --size 1024x512
--cameraWhat it shows
perspectiveAs the scene has it: a lens with a field of view, and depth of field when the scene gives the lens an opening.
orthoParallel rays: sizes do not shrink with distance (plans, technical views).
panoramaAll around, latitude-longitude; give a 2:1 size.
fisheye, equisolidA circle; --fisheye DEG sets its angle (default 180). Equisolid gives every part of the circle as much of the surroundings, as most real fisheye lenses do.
mirrorballThe surroundings as a polished ball shows them: a light probe.

Depth of field and the shape of out-of-focus lights are shown by --scene bokeh: --blades N gives the opening N sides, --blade-turn DEG turns it, --anamorphic 2 makes it twice as high as wide. --eye left|right renders one picture of a stereo pair; --shutter OPEN CLOSE and --rolling SHARE set the exposure of moving scenes.

The picture

A render holds light as numbers without an upper limit: a lamp can be a thousand times brighter than a white wall. A screen shows 0 to 255. How the one becomes the other is the look, and it is chosen when the picture is written, not when it is rendered.

Without a tone curve the brightest parts clip to whitenone
ACES: filmic with strong contrastaces
Filmic: softer shoulderfilmic
Reinhard: gentle, never clipsreinhard

The same render of sunlit written with each tone curve: --tonemap none|aces|filmic|reinhard. Without a curve the glare clips to flat white; the others roll it off, ACES with the most contrast.

OptionWhat it does
--tonemap none|aces|filmic|reinhardThe curve that maps light to the screen (--aces is --tonemap aces).
--exposure STOPSBrighter (+1 = twice) or darker, before the curve.
--temperature KELVINWhite balance: the colour of light that should come out white. 3000 takes the orange out of lamp light, 10000 the blue out of shade.
--saturation X, --contrast X−1 to 1; 0 leaves them as they are.
--pixel-filter box|tent|gaussianHow the scene is averaged into a pixel: box is the sharpest, gaussian the softest (--pixel-width sets its width).
--region X0 Y0 X1 Y1Render only that part of the picture; the rest is left empty.

Files

EndingWhat is written
.png8-bit RGB with the look applied; with --transparent also the alpha channel. Compressed.
.exrOpenEXR, 32-bit floats, linear, without the look: colour, alpha, depth (Z), albedo, normal and every pass that was asked for, as layers. For compositing programs.
.hdrRadiance RGBE: the colour, linear. Good for environment maps rendered with --camera panorama.

Over another picture

--transparent leaves the background out: the PNG gets an alpha channel. Surfaces that only catch shadows (a material setting) show nothing where they are lit and darken what lies under them where they are shaded, so an object can be laid over a photograph with its shadow.

Balls and their shadows, the background transparent
The overlay scene with --transparent, here over a checkerboard: the floor is a shadow catcher, so only the shadows remain of it. --scene overlay --transparent --size 640x360 --samples 256 --denoise --aces

Passes and buffers

Besides the picture, a render can keep what compositing and effects programs need, each as a picture of its own.

The whole picturepicture
Direct light onlydirect
Indirect light onlyindirect
Ambient occlusionao

The Cornell box with --passes --ao 0: the picture, the light that came straight from the lamp, the light that bounced, and how open each point is. The emission part (the lamp itself) is left out here. The three parts add up to the picture exactly.

OptionWrites
--passesThe light in three parts that add up to the picture: NAME-emission.png (what glows, seen directly), NAME-direct.png, NAME-indirect.png.
--ao DISTANCENAME-ao.png: how open each point is to the sky, counting only what is nearer than DISTANCE (0 = everything).
--idsInto an .exr: the number of the mesh, instance and material seen in each pixel, for cutting one thing out.
--placesInto an .exr: where each pixel's surface is in the world, and its texture coordinates.
--cryptomatte 1.8Into an .exr, as Cryptomatte layers (CryptoMesh, CryptoInstance, CryptoMaterial) that compositing programs read: for each pixel up to eight meshes, instances and materials in it and how much of it each covers, so that one thing can be cut out with soft edges, also where it is small, blurred or seen through hair.
--sobol 1.15The samples of each pixel spread out evenly (scrambled Sobol points) instead of falling at random: the same picture on average, with less noise for the same number of samples, most where the light is smooth.
--manifold 1.21The light of point and spot lamps through clear solid glass, along the path that really refracts: caustics at once, without stored light. Instead of --caustics, which turns it off.
--guiding 1.20Path guiding: the paths learn where the light comes from; less noise where bounces seldom find it (a room lit from the next one). The same picture on average. The path tracer only, on the CPU.
--checkpoint FILE, --stop-after N 1.19A render that can stop and go on: what is rendered is saved in FILE, and the next run with the same options goes on from there (at most N samples a run). The finished picture is the one of a render without the breaks, bit for bit, also on another machine or the other device.
--light-path EXPR 1.18Into an .exr as layer lpe0 ... lpe3: the light that came the way EXPR says, for example "C<RD>L" a lamp's light off something matte, "C.*S.*" everything seen in mirrors and through glass. Up to four. The path tracer only, rendered on the CPU.
--motion-vectors 1.14Into an .exr (motion.X, motion.Y): how far, in pixels, the point each pixel shows moves on the picture while the shutter is open, for motion blur added in compositing.
--toon N 1.11The scene drawn rather than lit: every opaque material in N flat tones of light, with a dark fill of its own colour on the unlit side and a light rim at the edges.
--outline 1.11Lines drawn into the picture where the depth jumps, the surface turns sharply, or one object or material meets another; in an .exr also as the buffer outline.
--deep 1.10NAME-deep.exr: an OpenEXR deep file, each pixel's samples kept apart by the things at different depths in it (up to eight), for deep compositing.

Albedo, normal and depth are always kept: every .exr has them.

Volumes, fog, motion

A cloud, a glass ball of juice, fire and a chrome ball under an evening skyvolumes
Lamp beams through a grating in a hazy hallhaze

Left: a cloud, a glass ball of juice, fire, and a chrome ball in the evening sky. Right: a hall full of haze, seen from inside it; a lamp shines through a grating.

Volumes path fill the inside of a closed mesh with something that scatters, absorbs or gives off light: smoke, cloud, murky liquid, fire. The density can be even or come from a grid (smoke from a simulation). Volumes may overlap or sit inside one another, and the camera may be inside them.

Fog is simpler: a colour that grows with distance (linear, exp or exp²), or volumetric fog that shows light shafts and shadows in the air.

Motion blur: objects, deforming meshes, lamps and the camera can move during the exposure; the motion scene shows a flying ball and a spinning bar. --shutter and --rolling set how the exposure takes the movement.

Baking

Instead of a picture from the camera, Spectra can bake: write the light falling on one mesh into a texture laid out by the mesh's texture coordinates. A game or a real-time preview can then show the expensive light without computing it.

spectra-cli --model room.glb --bake 3 --size 2048x2048 --samples 512 --denoise --out room-light.exr
spectra-cli --model statue.glb --bake 0 --tile 1002 --size 4096x4096 --out statue-1002.png

--bake N bakes mesh number N, counted from 0 in the order the scene adds them; --tile bakes one UDIM tile of a mesh whose texture spreads over several. The baked picture has an alpha channel: 1 where the mesh covers the texture, 0 elsewhere, with the colours carried a few texels past the edges.

Scene files

Any scene can be written as one file and rendered again later, on any machine (byte order does not matter):

spectra-cli --scene ring --save ring.spectra
spectra-cli --load ring.spectra --size 1920x1080 --samples 4096 --denoise --aces --out ring-big.png

A scene file holds everything that was put into the scene: meshes, instances, materials, textures, shaders, lamps, camera, world, sky. Files from older versions of Spectra still load. Programs write and read them with spSceneSaveFile and spSceneLoadFile.

Rendering elsewhere

spectra-server renders for programs on other machines. A computer without a GPU (a PowerPC under MorphOS, a small laptop) builds its scene as usual and sends it to a PC with an NVIDIA card; the samples are rendered there, and the picture comes back.

On the machine with the GPU:

spectra-server --listen 0.0.0.0 --key-file render.key
spectra-server 0.93 listening on 0.0.0.0 port 7878, a key is needed, encrypted

On the other machine:

spectra-cli --scene beam --device gpu --remote 192.168.1.20 --key-file render.key --out beam.png
beam on the server's GPU: 960x540, 64 samples, ...
Server optionWhat it does
--port NThe port to listen on, 7878 by default.
--listen ADDRESS127.0.0.1 by default: only programs on the same machine can connect. 0.0.0.0 opens it to the network.
--key-file FILE 0.90Render only for programs that prove they know the key in FILE; the conversation is then encrypted (0.93). Use a long random key (16 characters or more); a shorter one draws a warning. Programs older than 0.93 cannot encrypt and are refused.
--key TEXT 0.90The key on the command line, where other users of the machine may see it.
--onceEnd after serving one program.
--stdioServe one conversation over standard input and output, for a program that starts the server itself.

With a key, everything travels encrypted 0.93. The program proves the key by answering a random challenge (HMAC-SHA-256), the server proves it in turn, and from then on every message is encrypted with ChaCha20-Poly1305 under keys made for that conversation alone. The key itself never goes over the network. A message changed on the way ends the conversation, and after three wrong answers the server hangs up. Someone watching the network sees only how much goes each way.

A program given --key-file refuses to talk to a server that wants no key, or is older than 0.93: it sends nothing rather than send the scene in the clear. Without a key on either side, nothing is encrypted; open such a server to the network only where you trust the network.

The server serves one program at a time; the next one waits. --device and --threads on the client choose the server's device.

Pictures come back compressed, without losing anything 0.92: every buffer as one OpenEXR file (about a quarter of the raw floats), the picture for a screen as a PNG (about a third of the raw bytes). A client meeting an older server asks again the old way, so old and new programs still work together.

A program that changes its scene and renders again (a host such as Titler, through sp_remote.h) sends only what changed 0.94: a moved object costs a few dozen bytes instead of the whole scene.

One picture on several machines 1.1

With --servers several machines render one picture together: spectra-servers, separated by commas, and here for the machine you type on. Each gets the scene, and the picture is handed out in bands of rows; a machine that finishes a band takes the next, so a faster one takes more. The bands are put together, and denoised, on your machine.

spectra-cli --scene demo --servers 192.168.1.20,192.168.1.21:7900,here --key-file render.key --out demo.png
  23 of 23 bands
  192.168.1.20 (GPU): 15 bands, 120 rows
  192.168.1.21:7900 (CPU): 3 bands, 24 rows
  here (CPU): 5 bands, 36 rows
  • The picture is the one a single machine makes, bit for bit, whichever machine rendered which band, GPU or CPU.
  • A machine that cannot be reached, or does not know the key, is left out; one that fails during the render drops out, and the others render its bands.
  • A machine that is still receiving the scene when the rest have finished is not waited for: over a slow line it simply does less, or nothing.
  • When no band is left to hand out, a machine that has finished renders a band another machine is still on 1.5, and the first to finish gives it. A slow machine, or one that has stopped answering, is then stopped when all bands are done, instead of the picture waiting for it; the report says then not waited for.
  • With caustics each machine gets one band, because every band follows the light from the lamps for the whole picture.
  • It pays for large pictures and many samples. A small, quick picture is faster on one machine: the bands' round trips then cost more than the work.
  • With --frames N 1.7 the machines render an animation, a whole frame each: the camera turns once around the scene, and the frames are written as NAME-0001.png and so on (with .exr, every buffer). A machine is sent only what changed since its last frame. Without --servers this machine renders the frames one after another.
  • The picture comes back with every buffer it was rendered with 1.6: with --passes, --ao, --ids, --places or --cryptomatte also the light in parts, the openness, the numbers and the positions, the same as one machine's. So does a picture from --remote. Only the count of samples each pixel took (adaptive sampling) stays on the servers.

The GPU

The Visual Studio library for Windows renders on NVIDIA graphics cards through CUDA. It needs no CUDA toolkit on the machine, only the graphics driver; without a usable card it renders on the processor.

spectra-cli --info
spectra 1.23
architecture: x64
features: sse2 sse4.1 avx avx2 fma
device 0: CPU x64, 20 threads
device 1: GPU 0, NVIDIA GeForce RTX 5050 Laptop GPU, 8.0 GB
spectra-cli --scene haze --device gpu --samples 1024 --denoise --aces
  • --device gpu renders on the first NVIDIA card, --gpu N on another; --device auto takes a card if there is one and the CPU otherwise.
  • The path tracer runs on the GPU, about seven times as fast as the 24 threads of the same laptop's processor. The direct integrator runs there too 0.95; until 0.94 it stayed on the CPU. Whatever Spectra can render, it renders on the CPU as well: the GPU only makes it faster.
  • The same scene gives the same picture on the GPU and on the CPU, bit for bit 0.96: Spectra brings its own exp, log, sin and the rest, made of operations every processor rounds alike, and no compiler may fuse a multiply with an add. Until 0.95 the two agreed only up to noise.

MorphOS

MorphOS The library, spectra-cli and the test programs are built for MorphOS on PowerPC (bin/morphos-ppc). Run them from a shell in a folder where they may write their pictures; each test program says at the end whether all its checks passed.

  • There are no threads inside the library on MorphOS: it renders on one task, unless the program that uses it hands its own tasks to it (see the context).
  • A MorphOS program starts with a small stack. Spectra needs about 28 KB while rendering; the tools ask for 256 KB.
  • Built with make ALTIVEC=1 0.97, the library tests four boxes of its tree at once with AltiVec on a G4 or G5 and runs as before on a G3: it asks the system which processor it has. The pictures are the same either way.
  • spectra-server and --remote have no network on MorphOS yet. The way to render a MorphOS scene on a GPU is to save it (--save) and render the file on the PC.

Making it faster

WhenTry
Any scene--device auto; --denoise with fewer samples; --adaptive 0.01.
Previews, titles, product shots lit by lamps--integrator direct with 16 to 64 samples.
Many matte bounces, little to gain--diffuse-bounces 2: matte light bounces at most twice within --bounces.
Glass in front of glass, mirrors facing each otherRaise --bounces and --transmission-bounces; keep --diffuse-bounces low.
Very many lamps--one-lamp: each point asks one lamp, chosen by what it is likely to bring.
A room lit through a gap or from the next room 1.20--guiding: over the first half of the samples the paths learn where the light comes from, and half the bounces then go there. Takes a large picture or many samples to learn from; the path tracer only, on the CPU.
Thousands of lamps or glowing things 1.16--light-tree: the lamp is found in a tree, so the time does not grow with their number, and each point aims at the glowing things near it instead of at any of them.
Caustics are slow--photons lower, or caustics only where they matter.
Many copies of a thingStore it once and place it many times (instances): the forest scene stores 4000 triangles and shows ten million.

Troubleshooting

The picture is black.
The scene has no light the integrator can use: a model without lamps in an empty world. Add --sky 40 or --env. With the direct integrator, glowing surfaces light nothing.
White dots that do not go away.
Fireflies: light found by chance through glass or a mirror. Use --caustics, more samples with --denoise, or fewer bounces of the kind that causes them.
Glass looks black.
Light has run out of bounces inside it: raise --bounces or --transmission-bounces.
--device gpu renders on the CPU anyway.
No NVIDIA card or driver was found, or this library was built without the GPU (gcc, Linux, MorphOS). --info lists what Spectra sees; the log line at the start tells why.
"cannot reach a spectra-server".
The server listens on 127.0.0.1 unless started with --listen 0.0.0.0; a firewall may block port 7878.
"the spectra-server ... wants a key".
Give the same key file to spectra-cli --key-file as the server was started with.
"the spectra-server ... cannot encrypt".
The program has a key but the server wants none, or is older than 0.93; nothing was sent. Start the server with the same --key-file, or leave --key-file out to talk in the clear.
"the spectra-server ... does not know the key".
Something answered at that address but could not prove the key: it may not be your server. Nothing was sent.
A model renders without its textures.
The pictures must be PNG, JPEG or WebP next to the model, under the names the file gives. For glTF files spectra-cli prints how many pictures could not be decoded.

Known limits

AreaLimit
Direct integratorBlurred reflections are noisy at low samples; glowing surfaces glow but do not light others.
Glass without causticsLamp light passes glass straight and tinted, without the focused light behind it.
CausticsUp to roughness 0.3; the sky only with --caustics-sky; seen in mirrors and through glass they are slightly blurred.
DispersionThe colours are a fit, not measured; path tracer only.
VolumesClosed meshes with outward normals; at most four at one place.
SubsurfaceClosed meshes only.
SkyLight scattered once and scaled for the rest: brightness about right, dusk colours too saturated.
Render serverOne program at a time; encrypted only with a key; no network on MorphOS yet. The count of samples a pixel took does not come back from a server.
GPUNVIDIA only (CUDA); both integrators since 0.95.

All options

As spectra-cli --help prints them, grouped.

What to render

--scene NAMEbeam (default), prism, demo, cornell, fog, cube, studio, forest, materials, volumes, motion, haze, ring, sunlit, terrain, fur, hair, patterns, relief, nodes, overlay, smooth, projector, ies, points, bokeh
--model FILE.obj (with its .mtl), .gltf or .glb; --no-ground, --auto-camera
--load FILE, --save FILERender a saved scene; write the scene as a file
--triangles NScene terrain: how many (default 2 000 000)
--view NScene beam: 2 = from the other side and above, 3 = with a mirror and a glass ball
--dice PIXELS 1.23Scene relief: edges cut until none looks longer than this on screen, instead of cut evenly
--height FILEScene relief: the height picture (PNG 8 or 16 bits, JPEG, .hdr)
--ies FILEScene ies: the lamps' measured spread of light
--blades N, --blade-turn DEG, --anamorphic RScene bokeh: the camera's opening

Light and world

--sky ELEV[,AZIMUTH[,HAZE]]Daylight sky and sun; haze 2 to 10, default 3
--env FILE, --env-strength X, --env-rotation DEGEnvironment map (.hdr or .exr)
--portal X,Y,Z,DX,DY,DZ,W,H 1.17A light portal: a W x H rectangle in a window or skylight, the sky's light coming in along DX,DY,DZ. A room lit by the sky gets far less noise. May be given several times.
--caustics, --caustics-sky, --photons NLight followed from the lights through glass and off mirrors
--one-lampEach point asks one lamp instead of all
--light-tree 1.16As --one-lamp, the lamp found in a tree of the lamps; glowing triangles picked by the light each is likely to bring

Rendering

--integrator path|directDefault path
--size WxH, --samples N, --bounces NDefaults 960x540, 64, 6
--diffuse-bounces N, --glossy-bounces N, --transmission-bounces NLimits within --bounces (0 = no own limit, negative = none)
--adaptive XStop a pixel once its error is below X of its brightness
--seed NAnother set of random numbers
--no-filterTextures looked up at a point, not averaged over what a pixel covers
--pixel-filter box|tent|gaussian, --pixel-width PHow the scene is averaged into a pixel
--region X0 Y0 X1 Y1Only that part of the picture
--bake MESH, --tile NBake a mesh's light into its texture layout
--device cpu|gpu|auto, --gpu N, --threads NWhere and on how many threads
--remote HOST[:PORT], --key-file FILE, --key TEXTRender on a spectra-server
--servers HOST[:PORT],...,here 1.1Render one picture on several machines
--frames N 1.7An animation of N frames: the camera turns once around the scene; NAME-0001.png and so on

Camera

--camera KINDperspective, ortho, panorama, fisheye, equisolid, mirrorball; --fisheye DEG
--eye left|rightOne picture of a stereo pair
--shutter OPEN CLOSE, --rolling SHAREThe exposure of a moving scene

The picture

--out FILE.png, .exr or .hdr
--denoiseFilter the result
--aces, --tonemap none|aces|reinhard|filmic, --exposure STOPSThe look
--temperature KELVIN, --saturation X, --contrast XWhite balance and colour
--transparentNo background: PNG with alpha
--passes, --ao DISTANCE, --ids, --places, --cryptomatte, --deep, --outline, --toon N, --motion-vectorsExtra buffers, and a drawn look
--quiet, --infoNo progress; show the CPU and the devices