Cameras

class Camera(parameters)

Camera in the non-euclidean scene. It should not be confused with the Three.js camera in the virtual euclidean scene. The minimal GLSL struct should contain - minDist - maxDist - maxSteps - threshold - position - matrix The GLSL code needs to contain (after the declaration) a function mapping. The role of this function is to map a point on the horizon sphere to the initial direction to follow during the ray-marching.

Constructor.

Arguments:
  • parameters (Object) – the parameters of the camera. These parameters are - {number} minDist - the minimal distance we ray-march - {number} maxDist - the maximal distance we ray-march - {number} maxSteps - the maximal number of steps during the ray-marching - {number} safetyDist - in case an object is at the same place as the camera, we always initially march a distance safetyDist, no matter what the SDFs return - {number} threshold - the threshold to stop the ray-marching - {TeleportationSet} set - the underlying subgroup of the geometry (to create the position)

Camera.Camera

Constructor.

Camera.fakeCameras

type: Array.<Object>

Two fake copies of the cameras meant to be passed to the shader as uniforms. Mostly for VR

Camera.matrix

type: Matrix4

Matrix of the underlying Three.js camera in the virtual euclidean scene

Camera.maxDist

type: number

Maximal distance we ray-march

Camera.maxSteps

type: number

Maximal number of steps during the ray-marching

Camera.minDist

type: number

Minimal distance we ray-march

Camera.position

type: RelPosition

Position of the camera

Camera.safetyDist

type: number

Safety distance, to avoid collision with objects attached to the camera

Camera.threeCamera

type: Camera

The underlying Three.js camera. It has to be implemented (through setThreeCamera) by classes extending Camera

Camera.threeScene

type: Scene

The underlying Three.js scene It has to be implemented (through setThreeScene) by classes extending Camera

Camera.threshold

type: number

Threshold to stop the ray-marching

Camera.setThreeCamera(parameters)

Set up the Three.js camera compatible with the Three.js scene

Camera.setThreeScene()

Set up the Three.js scene compatible with the Three.js camera

Camera.shader(shaderBuilder, side)

build the GLSL code needed to declare the camera

Arguments:
  • shaderBuilder (ShaderBuilder) – the shader builder

  • side (number) – the side (left of right) (used for stereographic camera)

Camera.updateProjectionMatrix()

Shortcut to update the projection matrix of the underlying Three.js camera

static Camera.glslClass()

Return the chunk of GLSL code defining the camera structure The structure name should always be Camera

Returns:

string

static Camera.glslMapping()

Return the chunk of GLSL code defining the mapping

  • from the screen space in Three.js

  • to the tangent space to the camera in the geometry

The structure name should always be Camera

Returns:

string

class FlatCamera()

Camera with a rectangle as a Three.js screen

FlatCamera.FlatCamera
FlatCamera.fov

type: number

Vertical field of view (in degrees) Default value is the same as in three.js

FlatCamera.fovRadians

Vertical field of view in radians

FlatCamera.setThreeCamera()

Set up an Orthographic Three.js camera.

FlatCamera.setThreeScene(shaderBuilder)

Set up the Three.js scene compatible with the Three.js camera

class SphereCamera()

Camera with a sphere as a Three.js screen

SphereCamera.SphereCamera
SphereCamera.aspect

Shortcut to reset the aspect of the underlying Three.js camera

SphereCamera.fov

Vertical field of view (in degree) from bottom to top.

SphereCamera.fovRadians

Vertical field of view in radians

SphereCamera.setThreeCamera(parameters)

Set up a Perspective Three.js Camera

SphereCamera.setThreeScene(shaderBuilder)

Set up the Three.js scene compatible with the Three.js camera

The lag that may occur when we move the sphere to chase the camera can be the source of noisy movement. We put a very large sphere around the user, to minimize this effect.

class VRCamera(parameters)

Stereographic camera. Used for VR. The position of the camera corresponds to the midpoint between the two eyes.

Constructor.

Arguments:
  • parameters (Object) – the parameters of the camera. Additional parameters are - {number} ipDist - the interpupillary distance

VRCamera.VRCamera

Constructor.

VRCamera.chaseThreeCamera

In VR mode the position of the Three.js camera (in the Euclidean Three.js scene) is directly controlled by the VR headset. This method update the position of the observer in the geometry accordingly. Every displacement is the Three.js scene is interpreted as a tangent vector. We move the observer by following the geodesic in this direction. The method also update the left and right eyes positions. The method should be called at each frame.

VRCamera.ipDist

Half the interpupillary distance

VRCamera.isStereoOff

type: boolean

True if stereo is off

VRCamera.isStereoOn

type: boolean

True if stereo is on

VRCamera._chaseThreeCamera()
VRCamera.switchStereo()

Turn the stereo mode on or off

VRCamera.updateFakeCamerasPosition()

Update the fake camera position. Shift the left and right camera from the current position using parallel transport.

class PathTracerCamera(parameters)