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.
spectra-cli --scene sunlit --samples 2048 --denoise --aces · 960×540 · GPUQuick 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.
- Unpack
spectra-1.23.zipand open a command prompt inbin\windows-x64. - Render the start-up scene:
Openspectra-cli beam on the CPU: 960x540, 64 samples, 70 triangles stored, 0 instances, build 0.000 s, render 7.91 s -> out.pngout.png: a beam of white light through a prism. With only 64 samples per pixel it is still grainy. - 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 - 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
| Folder | What is in it |
|---|---|
include/spectra/spectra.h | The 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.md | The terms, and the published methods and formats Spectra is built on. |
Platforms
| Platform | Library | State |
|---|---|---|
| Windows x64 | lib/windows-x64-msvc, lib/windows-x64-gcc | Built and tested; the Visual Studio library also renders on NVIDIA GPUs. |
| Linux x64 | lib/linux | Built and tested by the author (gcc 13). |
| MorphOS (PowerPC) | lib/morphos-ppc | Built 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:
| Option | Default | What it does |
|---|---|---|
--scene NAME | beam | A built-in scene; see the gallery. |
--model FILE | A model file instead: .gltf, .glb or .obj. See your own models. | |
--size WxH | 960x540 | The picture's size in pixels. |
--samples N | 64 | Rays per pixel. More = less noise, longer render. See samples. |
--integrator path|direct | path | Full light transport, or the fast direct light only. See path and direct. |
--bounces N | 6 | How often light may bounce. Glass and mirrors in front of each other want more. |
--denoise | Filter the remaining noise out, guided by the surfaces' colours, directions and distances. | |
--aces, --tonemap NAME | none | How bright light is squeezed into what a screen can show. See the picture. |
--device cpu|gpu|auto | cpu | Where to render; auto takes an NVIDIA GPU when there is one. |
--out FILE | out.png | .png, .exr (every buffer as floats) or .hdr. |
--quiet | No 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.
The sample scenes
Each sample scene shows something Spectra can do. Each is also a good test of a machine: the same command gives the same picture everywhere, bit for bit, on the CPU and on a GPU 0.96. The commands below made the pictures (the scenes with many samples on a laptop's NVIDIA GPU).

--scene beam --samples 2048 --denoise --aces
--scene beam --view 2
--scene beam --view 3
--scene ring
--scene sunlit
--scene prism
--scene materials
--scene nodes
--scene volumes
--scene haze
--scene motion --adaptive 0.01
--scene forest
--scene terrain --triangles 16000000
--scene fur
--scene projector
--scene smooth
--scene relief --height map.png
--scene patterns
--scene points
--scene bokeh --blades 6
--scene studio
--scene cornell --size 600x600
--scene demo --sky 35,140
--scene cubeTwo more scenes are made for an option: ies lights a wall with lamps whose spread of light is
read from a lamp maker's IES file (--ies FILE), and overlay is made to be rendered with
--transparent (see the picture).
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_transformon 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:
| Option | What 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 FILE | An 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 DEG | Brighter or darker; turned around the vertical. |
--no-ground | Leave out the floor spectra-cli puts under a model. |
--auto-camera | Ignore 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.
path · 256 spp
direct · 16 sppThe 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.
pathdefault- A path tracer. Light bounces as often as
--bouncesallows, 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:
16 spp
16 spp + --denoise
2048 sppLeft 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;--samplesbecomes the most any pixel takes. The sky and flat walls stop early, the hard places go on. Themotionscene 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
| Lamp | What it is |
|---|---|
| Point | Light 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). |
| Spot | A point lamp limited to a cone, with a soft edge; with a picture it is a slide projector. |
| Sun | Parallel light from a direction; its angular size softens the shadows. |
| Panel | A 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 surfaces | Any mesh whose material emits light lights the scene too (in the path tracer). |
--scene projector --samples 1024 --denoise --acesSky 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.
--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).
docs/manual/src/manual_pictures.c.
1200×760 · 512 spp · path · denoised · filmicCameras
Every scene has its camera; --camera renders it through another kind of lens from the same place.
fisheye
ortho
--scene forest --camera panorama --size 1024x512--camera | What it shows |
|---|---|
perspective | As the scene has it: a lens with a field of view, and depth of field when the scene gives the lens an opening. |
ortho | Parallel rays: sizes do not shrink with distance (plans, technical views). |
panorama | All around, latitude-longitude; give a 2:1 size. |
fisheye, equisolid | A 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. |
mirrorball | The 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.
none
aces
filmic
reinhardThe 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.
| Option | What it does |
|---|---|
--tonemap none|aces|filmic|reinhard | The curve that maps light to the screen (--aces is --tonemap aces). |
--exposure STOPS | Brighter (+1 = twice) or darker, before the curve. |
--temperature KELVIN | White 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|gaussian | How the scene is averaged into a pixel: box is the sharpest, gaussian the softest (--pixel-width sets its width). |
--region X0 Y0 X1 Y1 | Render only that part of the picture; the rest is left empty. |
Files
| Ending | What is written |
|---|---|
.png | 8-bit RGB with the look applied; with --transparent also the alpha channel. Compressed. |
.exr | OpenEXR, 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. |
.hdr | Radiance 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.
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 --acesPasses and buffers
Besides the picture, a render can keep what compositing and effects programs need, each as a picture of its own.
picture
direct
indirect
aoThe 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.
| Option | Writes |
|---|---|
--passes | The light in three parts that add up to the picture: NAME-emission.png (what glows, seen directly), NAME-direct.png, NAME-indirect.png. |
--ao DISTANCE | NAME-ao.png: how open each point is to the sky, counting only what is nearer than DISTANCE (0 = everything). |
--ids | Into an .exr: the number of the mesh, instance and material seen in each pixel, for cutting one thing out. |
--places | Into an .exr: where each pixel's surface is in the world, and its texture coordinates. |
--cryptomatte 1.8 | Into 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.15 | The 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.21 | The 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.20 | Path 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.19 | A 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.18 | Into 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.14 | Into 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.11 | The 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.11 | Lines 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.10 | NAME-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
volumes
hazeLeft: 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 option | What it does |
|---|---|
--port N | The port to listen on, 7878 by default. |
--listen ADDRESS | 127.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.90 | Render 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.90 | The key on the command line, where other users of the machine may see it. |
--once | End after serving one program. |
--stdio | Serve 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 N1.7 the machines render an animation, a whole frame each: the camera turns once around the scene, and the frames are written asNAME-0001.pngand so on (with.exr, every buffer). A machine is sent only what changed since its last frame. Without--serversthis machine renders the frames one after another. - The picture comes back with every buffer it was rendered with 1.6: with
--passes,--ao,--ids,--placesor--cryptomattealso 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 gpurenders on the first NVIDIA card,--gpu Non another;--device autotakes 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=10.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-serverand--remotehave 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
| When | Try |
|---|---|
| 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 other | Raise --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 thing | Store 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 40or--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
--bouncesor--transmission-bounces. --device gpurenders on the CPU anyway.- No NVIDIA card or driver was found, or this library was built without the GPU (gcc, Linux, MorphOS).
--infolists 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-fileas 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-fileout 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-cliprints how many pictures could not be decoded.
Known limits
| Area | Limit |
|---|---|
| Direct integrator | Blurred reflections are noisy at low samples; glowing surfaces glow but do not light others. |
| Glass without caustics | Lamp light passes glass straight and tinted, without the focused light behind it. |
| Caustics | Up to roughness 0.3; the sky only with --caustics-sky; seen in mirrors and through glass they are slightly blurred. |
| Dispersion | The colours are a fit, not measured; path tracer only. |
| Volumes | Closed meshes with outward normals; at most four at one place. |
| Subsurface | Closed meshes only. |
| Sky | Light scattered once and scaled for the rest: brightness about right, dusk colours too saturated. |
| Render server | One 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. |
| GPU | NVIDIA only (CUDA); both integrators since 0.95. |
All options
As spectra-cli --help prints them, grouped.
What to render
--scene NAME | beam (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 FILE | Render a saved scene; write the scene as a file |
--triangles N | Scene terrain: how many (default 2 000 000) |
--view N | Scene beam: 2 = from the other side and above, 3 = with a mirror and a glass ball |
--dice PIXELS 1.23 | Scene relief: edges cut until none looks longer than this on screen, instead of cut evenly |
--height FILE | Scene relief: the height picture (PNG 8 or 16 bits, JPEG, .hdr) |
--ies FILE | Scene ies: the lamps' measured spread of light |
--blades N, --blade-turn DEG, --anamorphic R | Scene 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 DEG | Environment map (.hdr or .exr) |
--portal X,Y,Z,DX,DY,DZ,W,H 1.17 | A 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 N | Light followed from the lights through glass and off mirrors |
--one-lamp | Each point asks one lamp instead of all |
--light-tree 1.16 | As --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|direct | Default path |
--size WxH, --samples N, --bounces N | Defaults 960x540, 64, 6 |
--diffuse-bounces N, --glossy-bounces N, --transmission-bounces N | Limits within --bounces (0 = no own limit, negative = none) |
--adaptive X | Stop a pixel once its error is below X of its brightness |
--seed N | Another set of random numbers |
--no-filter | Textures looked up at a point, not averaged over what a pixel covers |
--pixel-filter box|tent|gaussian, --pixel-width P | How the scene is averaged into a pixel |
--region X0 Y0 X1 Y1 | Only that part of the picture |
--bake MESH, --tile N | Bake a mesh's light into its texture layout |
--device cpu|gpu|auto, --gpu N, --threads N | Where and on how many threads |
--remote HOST[:PORT], --key-file FILE, --key TEXT | Render on a spectra-server |
--servers HOST[:PORT],...,here 1.1 | Render one picture on several machines |
--frames N 1.7 | An animation of N frames: the camera turns once around the scene; NAME-0001.png and so on |
Camera
--camera KIND | perspective, ortho, panorama, fisheye, equisolid, mirrorball; --fisheye DEG |
--eye left|right | One picture of a stereo pair |
--shutter OPEN CLOSE, --rolling SHARE | The exposure of a moving scene |
The picture
--out FILE | .png, .exr or .hdr |
--denoise | Filter the result |
--aces, --tonemap none|aces|reinhard|filmic, --exposure STOPS | The look |
--temperature KELVIN, --saturation X, --contrast X | White balance and colour |
--transparent | No background: PNG with alpha |
--passes, --ao DISTANCE, --ids, --places, --cryptomatte, --deep, --outline, --toon N, --motion-vectors | Extra buffers, and a drawn look |
--quiet, --info | No progress; show the CPU and the devices |