A camera is a place, a facing and a lens from which the world is drawn into an image. Each visitor's own picture is one camera's; a mirror, a window onto somewhere else, a security screen and a far-seeing stone are each another camera's picture laid on a surface in the world. "The viewer" in the language is always the camera drawing the picture, not the player, so parts that exist round the viewer (the rain, the sky) exist once per camera and show what is round that camera. This page covers cameras, view surfaces (mirrors and portals), far-seeing, parts per camera, and what the renderer does.

Words used on this page:

View
One drawing of the scene from one camera into a texture.
Render to texture
Drawing a picture into an image that a material then shows, instead of onto the screen.
Exposure
How much a picture is brightened; each place's picture has its own.
Oblique clip
Cutting a camera's picture at a tilted plane (a portal's mouth), so nothing behind that plane is drawn.

How you write it

A mirror

part cottage
  part frame: mirrorFrame(pane: pane, bars: 7 cm, offWall: 5 cm, backing: 3 cm), material: materials.darkTimber
  part pane : glassPane(width: 1.0 m, height: 1.7 m), rotation: rotation(180 deg),
              at: (1.5 m, 1.4 m, -6.034 m)    // the pane's center: 1.5 m along the back wall, 1.4 m up, 3.4 cm outside it
  derive(pane.picture, render(camera: reflected(viewingCamera, about: pane), skip: [pane]))
  derive(pane.look, screenMapped(pane.picture, tint: (0.92, 0.94, 0.95)))

A glass 1 m wide and 1.7 m tall, its center 1.4 m above the cottage's ground (so its bottom is 0.55 m and its top 2.25 m up), returning about 92% of the light, as silvered glass does. A pane faces +z of its own frame, and its at: is its center, like every primitive's. The cottage's frame has its origin in the middle of the front wall, so the back wall is at z = -6 and the glass hangs on the outside of it at -6.034, facing north (-z): it is turned half a turn to face away from the house. mirrorFrame(pane:, bars:, offWall:, backing:) builds the frame round that pane: four bars bars wide, standing offWall proud of the wall, and a backing board backing thick behind the glass. The picture is the scene drawn again from the viewer's camera reflected in the glass's plane, without the glass itself; it is shown on the glass where each pixel falls on the screen. render(camera:, skip:) is the image source of Images; reflected and screenMapped are the vocabulary's view-surface steps. reflected(camera, about: pane) reflects a camera; reflect(x, in: pane) reflects a place, a direction or a rotation in the pane's plane, which is where a thing stands in the mirror (The looking-glass places a figure at reflect(v.place, in: pane)).

A window onto somewhere else

part cottage
  field open: bool = false, mutable: true, lives: both
  field link: offset = labyrinth.entrance.mouth.worldPlace - pane.worldPlace   // from the pane to the corridor's mouth
  derive(pane.picture, {
    if open { render(camera: moved(viewingCamera, by: link, clip: pane), skip: [pane]) }
    else    { render(camera: reflected(viewingCamera, about: pane), skip: [pane]) }
  })
  part wayIn: gate(across: pane, shift: link, when: open)

While shut the glass is a mirror; while open it is a window onto a corridor 300 m below, and a gate into it (Physics). The link is worked out from the two places, not typed: p.worldPlace reads any part's place in world coordinates (Frames). The portal's camera is the viewer's camera moved by the link, so the picture is what the viewer would see standing at the mouth. clip: names the exit's plane: the pane's plane moved by the link, facing back, which is the mouth's plane. It is the camera's near edge, so nothing behind it is drawn. At the moment of opening the picture changes in what it is made of, not in what it shows.

This window is one aspect of a single portal part, the other being its passage, and the labyrinth is a scene of its own; the camera beyond is the viewer's camera carried from the mouth's frame to the arrival's, rather than moved by an offset in one space. This page keeps how the picture is drawn; what a portal is, its arrivals and who may pass are on Portals.

Far-seeing

part seeingStone: sphere(radius: 0.15), material: materials.darkGlass   // illustration
  field watching: place = riverFord
  derive(surface.picture, render(camera: camera(at: watching, facing: ...)))

A security screen, a scrying stone, a window into another land: the same element with a different camera, derive(screen.picture, gateCamera.picture). What it shows is drawn as that place is: its weather round the projected eye, its own light.

Parts per camera

part rainNear: falling(kind: rain, radius: 9 m, above: 6 m, fall: 8 m/s), at: around(camera, rotation: world)    // illustration

A part placed round the camera exists once for each camera drawing a picture, and what it shows is looked up where that camera is (Sky and weather).

What it means

The viewer is the camera

Looking through a far-seeing stone, the rain is round the projected eye and is that land's rain. So parts round the viewer exist per camera, and the renderer resolves them for each picture it draws. Rain aimed once a frame at the player's eye and reused in a portal's picture would show the near rain wrongly there. The same holds for anything else per viewer: the sound's ear, a speech plate's distance, the lantern's nearness are each per visitor or per camera, and the language needs to say which.

Per camera, per visitor

A mirror's picture is made once per camera that sees the glass; a speech plate is in each visitor's picture. Each visitor's browser draws its own viewer's reflection. These are outside client, server and both: a value once per camera is a fourth place a value can live (Distribution).

What the content states, and what it does not

The content states only the surface and which camera. Drawing the scene again, cutting the picture to the patch of screen the surface covers, its cost and its sharpness are below the content. The browser draws a picture just big enough for the patch of screen the glass covers, and draws nothing while the glass is behind the viewer or off screen.

Recursion

A surface is on its own drawing layer, which no picture draws, so recursion depth is one by construction: a mirror never shows a mirror inside it more than once. The render package allows nested views to a set depth, by default one. Whether a world may ask for deeper recursion (a hall of mirrors) is a quality of experience; the depth is the engine's.

Each picture is lit by the place it shows

A picture is lit by the light of the world the picture shows: a labyrinth seen from outside is lit by its own lamps and drawn at its own exposure; the outside seen from below by its sun. Each place's picture settings (light, exposure, shadows, how far it sees, sky light, which drawing layers, fog) are a record, built per region. Which region's settings a picture uses follows from where it looks; the model does not yet say so. Under the hypothesis of scenes, an outdoor top and a labyrinth below are two scenes, each with its own rendering, so a picture through a portal uses the settings of the scene it shows (Worlds, scenes and regions).

Pictures are images

A camera's picture is an image, a value, made by a source and wired by a subscription. The same machinery makes the HUD (a layout drawn into an image and composited over the camera's picture), a sign, and a minimap (Images, Overlays). A click on a surface showing a picture follows the ray from the eye to the surface, to the point in its image, to what is there; a click through a mirror's picture is not yet supported.

The visitor's own camera

Possession and the camera are built-in rules: content never names a player, and the camera that draws each visitor's picture follows the visitor's being. It is one of the pieces an avatar is made of (Avatars). The camera is kept out of walls by a sphere cast and is carried with its being on a platform and through a gate. A world-controlled camera (a cutscene, a fixed view) is not yet supported.

The render package's cameras and views

How it connects

Open questions

  1. Per camera or per visitor: how the language says which a value or part is (the rain round each camera, a plate in each visitor's picture).
  2. A part's kind changed by state: mirror to window is a field of one type or a change of type.
  3. A portal as one thing: a portal type that is both pane and gate, or a relation binding the two. A proposal answers this: one portal part with a window and a passage (Portals).
  4. Which region's settings a picture uses, stated or derived from where it looks. Under the hypothesis of scenes, the scene it shows (Worlds); a zone inside one scene with settings of its own (an area, proposal) is not yet covered.
  5. Resolution of a live image: content states a quality, not pixels.
  6. A turned or scaled window: how the picture through a portal that turns or scales is drawn is not yet described. What crossing does to your facing is settled (Portals: where you land, and which way you face).
  7. Waking by eye: a region wakes when an eye enters the area it can be seen from; whether a portal's window or a far-seeing stone's camera counts as an eye, and wakes what it shows (Worlds: waking a region).
  8. Cameras a world controls, and how they meet possession.
  9. Scenes, or one space (a design question): where a place's own light, exposure, far distance and sky live, and whether a picture of the labyrinth is exposed at its own exposure or darker, as the island's is (Worlds).

← Physics | Contents | The vocabulary and packages →