-
Notifications
You must be signed in to change notification settings - Fork 27
MASCamera
The MASCamera module represents a camera installed on a part. The camera may be accessed in a CAMERA node of a MASMonitor page. The MASCamera is similar to the JSIExternalCameraSelector, but there are important differences to be aware of:
- Camera parameters (zoom limits, pan and tilt limits) are part of MASCamera. In RPM, they were part of the page definition, allowing different pages to use different values for the same camera. Putting the limits in the part config better duplicates a physical camera, and it allows the part maker to specify limits based on what the part is emulating.
- Likewise, post-processing shaders belong to the MASCamera module, not the monitor. This allows cameras to be designed for specific applications. Cameras may have more than one post-processing configuration, such as a simple color mode and a highly-gained green monochrome (to represent a night vision setting), or a camera may be designed as a monochrome, low-resolution, noisy camera to represent early television.
- Camera names are user-configurable in the VAB/SPH (or in flight) using a text input box. RPM used a named prefix (traditionally, "ExtCam"), and it allowed the user to increment or decrement a number that was added to the prefix. Default names for a camera may be set in the config file, but a user is always allowed to edit it.
The MASCamera is configured with the following values. All user-configurable values and their defaults are included.
MODULE
{
name = MASCamera
fovRange = 50, 50
currentFov = 50
panRange = 0, 0
currentPan = 0
tiltRange = 0, 0
currentTilt = 0
cameraTransformName = ""
panTransformName = ""
tiltTransformName = ""
refreshRate = 1
translation = 0, 0, 0
rotation = 0, 0, 0
cameraName = ""
showFov = false
MODE
{
(see below)
}
MODE
{
...
}
}
- fovRange - Defines the minimum and maximum field of view for the camera, in degrees.
- currentFov - This value will change in flight if the user zooms a camera, but putting it in the part config allows the part maker to specify the initial setting for the part.
- panRange - Defines the maximum left and right rotation of the camera, in degrees.
- currentPan - This value will change in flight if the user pans a camera.
- tiltRange - Defines the maximum up and down rotation of the camera, in degrees.
- currentTilt - This value will change in flight if the user tilts a camera.
- cameraTransformName - Required. Specifies the transform in the prop where the camera is attached. The following two fields allow the camera to be moved and rotated from that location.
- panTransformName - Optional. When present, specifies a transform in the model that will be rotated to correspond with the current pan value. Using the pan transform allows the camera model to rotate physically when it is rotated. The pan rotation takes place around the Y axis of the transform.
- tiltTransformName - Optional. When present, specifies a transform in the model that will be rotated to correspond with the current tilt value. Using the tilt transform allows the camera model to tilt physically when it is tilted. The tilt rotation takes place around the X axis of the transform.
-
refreshRate - Optional. Defaults to 1. Controls how frequently the camera's render texture is updated (every
refreshRate
Unity updates). A 1 means the camera's view updates every Update, while a 2 means every other update, a 3 means every 3rd update, etc. -
translation - Specifies the offset from
cameraTransformName
where the camera should be created. -
rotation - Specifies the rotation (in degrees) that the camera should be rotated from
cameraTransformName
's forward (blue) axis. - cameraName - A user-configurable field naming the camera. An initial default name may be provided in the config.
- showFov - Whether the field-of-view cones should be visible in the VAB/SPH. This option is controlled by the player using the context menu in the VAB/SPH, and it should not be added to the config file.
Each MASCamera may include one or more MODE configuration nodes. These nodes allow configuring a camera with different post-processing shaders, resolutions, etc. If no MODEs are included, the camera is configured with no post-processing effects, a mode name of "Default", and a 256 x 256 pixel resolution.
If more than one MODE is included, the first one is the default. MODE selection persists, and it applies to all monitors that display that camera.
MODE
{
name = anonymous
cameraResolution = 256
shader = ""
properties = ""
texture = ""
}
-
name: Optional, but highly recommended. Defaults to "anonymous". This is the name of the camera mode. This name may be displayed using
fc.GetCameraModeName()
(see). - cameraResolution: Optional. Defaults to 256. Controls the resolution of the camera, in pixels. The resolution is always adjusted to the largest power-of-two that is less than or equal to the provided resolution (for instance, a setting of 320 will automatically be adjusted to 256). Values larger than 2048 are clamped to 2048, and values smaller than 64 are clamped to 64.
- shader: Optional. If present, and set to one of the included Shaders, this camera mode will apply a post-processing shader effect to the image before showing it. If the 'shader' is not included, the camera mode will display a color image with no effects applied.
- properties: Optional. Ignored if 'shader' is absent. The 'properties' field is a semi-colon (;) separated list of name:value pairs that controls various tunable parameters in the shader. Refer to the Shaders page for more information.
- texture: Optional. Ignored if 'shader' is absent. The texture field provides the name of a texture that is used in the shader (where applicable, such as the noise shaders).