Cameras

From Luma's Workshop
Jump to navigation Jump to search
This page is in progress and may contain incomplete information or editor's notes.

The Galaxy games use cameras to create a good view of the game's 3D scene. There are many different types to fulfill this purpose, all of which are detailed on this page. Each stage (galaxies, zones, ...) comes with a file that specifies all the camera setups to be used. The format of these files is specified below.

Contexts

Cameras are used in a lot of different contexts and may be triggered through various means, including:

  • Camera areas (CameraArea, CubeCameraBox, etc.) once they are entered. More information below.
  • Spawn points (Mario entries in a zone's StartInfo file) once the player respawns there. More information below.
  • Warp Pipes once they are being exited.
  • When the player rides Launch Stars, Sling Stars, Vines and more.
  • When the player swims underwater or on the water's surface.
  • When the player uses the Flying Power-Up.
  • While talking to an NPC.
  • Various objects and enemies use special cameras, such as SimpleDemoExecutor, JumpBeamer, Poihana and BegomanSpring.
  • Cutscenes use various cameras to change the view.

BCAM Format

All camera parameters for a zone (and some objects) are stored in a special BCSV file called CameraParam.bcam. For zones, the file is located in Stage/camera of a Map archive. Not all files will contain all known camera fields in order to save some space. These optional fields are only added when a camera wants to use a value other than the default one. The following table lists all fields, their default values, data type, camera type exclusivity, and whether they are always required or not.

Field Type Default value Exclusivity Required?
version LONG 196630 (SMG1)
196631 (SMG2)
camtype STRING_OFFSET (empty string)
id STRING_OFFSET (empty string)
angleB FLOAT 0.3
angleA FLOAT 1200.0
dist FLOAT 0.0
vpanaxis.X FLOAT 0.0
vpanaxis.Y FLOAT 1.0
vpanaxis.Z FLOAT 0.0
vpanuse LONG 1
udown LONG 120
pushdelaylow LONG 120
pushdelay LONG 120
lplay FLOAT 800.0
uplay FLOAT 300.0
gndint LONG 160
lower FLOAT 0.1
upper FLOAT 0.3
camint LONG 120
fovy FLOAT 45.0
roll FLOAT 0.0
loffsetv FLOAT 0.0
loffset FLOAT 0.0
woffset.X FLOAT 0.0
woffset.Y FLOAT 100.0 (SMG1)
0.0 (SMG2)
woffset.Z FLOAT 0.0
num1 LONG 0 (SMG1)
1 (SMG2)
num2 LONG 0
string STRING_OFFSET (empty string)
axis.X FLOAT 0.0
axis.Y FLOAT 1.0
axis.Z FLOAT 0.0
up.X FLOAT 0.0
up.Y FLOAT 0.0 (SMG1)
1.0 (SMG2)
up.Z FLOAT 0.0
wpoint.X FLOAT 0.0
wpoint.Y FLOAT 0.0
wpoint.Z FLOAT 0.0
flag.noreset LONG 0
flag.nofovy LONG 0
flag.lofserpoff LONG 0
flag.antibluroff LONG 0
flag.collisionoff LONG 0
flag.subjectiveoff LONG 0
gflag.thru LONG 0 c:
g:
s:
gflag.enableEndErpFrame LONG 0 c:
g:
s:
gflag.camendint LONG 0 c:
g:
s:
eflag.enableErpFrame LONG 0 e:
eflag.enableEndErpFrame LONG 0 e:
camendint LONG 0 e:
evfrm LONG 0 e:
evpriority LONG 1 e:

Camera ID Names

The id field of a camera parameter entry is a special ID name that specifies the camera's usage context. Every entry should have a unique ID name. The camera ID is categorized into five different categories which are described below.

Cube

Cube cameras are cameras which are referenced from a camera area (CameraArea in Super Mario Galaxy 2, CubeCamera, CubeCameraBox etc in Super Mario Galaxy). When the player is inside a camera area, it activate the referenced camera. If multiple camera areas interesect, the area with the highest priority (Obj_arg2) will be selected. The camera area's Obj_arg0 value specifies the ID number of the camera to be used. Using this value, the game generates an identifier string using the printf format string c:%04x. For example, if your camera area has an Obj_arg0 of 15, the corresponding camera ID name would be c:000f. Note that the hexadecimal digits must be lowercase.

Start

Start cameras are used when a camera is referenced from a start point. Every player spawn point (Mario entries in a zone's StartInfo) can activate a camera once the player respawns there. Just like camera areas, the game constructs an identifier string from the spawn point's CameraSetId which will be used to locate the parameters for the camera. The printf format string is s:%04x. For example, if your Mario entry has a CameraSetId of 60, the corresponding camera ID name would be s:003c. The hexadecimal digits must be lowercase. If the CameraSetId is negative, no camera will be used.

Event

Event cameras are cameras which are used for different events. One example of an event camera is Mario's intro flying, which is shown when entering all galaxies. Event cameras have the format "e:S:XXX:YYY" where S is the event name, XXX is the camera set ID in lowercase hex and YY is the event index, also in lowercase hex. Most event consists of multiple cameras, which is what YY is used for. For example, the camera for the second Mario's intro flying, with the camera set ID 5 would be "e:シナリオスターター:005:01番目". The following table shows known event cameras:

ID Description
e:シナリオスターター:XXX:YY番目 Scenario start camera YY.
e:スーパースピンドライバー:XXX:YY番目 Super spin driver camera YY. Camera 00 is used when Mario enters the launch star, and 01 and up are used for when Mario is flying.
e:スーパースピンドライバー固有出現イベント用XXX Super spin driver appearance event camera for camera set ID XXX.

Group

Group cameras have unknown usage, but has the format "g:S" where S is the group name.

Other

Other cameras are used for various cameras which does not belong to any of the previously described categories. The ID follows the format "o:S" where S is the name. The following table shows known other cameras:

ID Description
o:デフォルトカメラ Default camera to be used if no other camera is active or available.
o:デフォルト水中カメラ Default camera to be used when the player is swimming underwater.
o:デフォルト水面カメラ Default camera to be used when the player is swimming on water surface.
o:デフォルトフーファイターカメラ Camera to be used when the player is using the Flying Power-Up.
o:ズームカメラ The first person's view camera.

Camera Classes

There are many fine-tuned camera classes to choose from. The camtype field of a camera entry specifies what class to use. The available classes in the Galaxy games are:

Identifier Japanese Name Class Name Used in SMG1? Used in SMG2? Description Parameters
CAM_TYPE_XZ_PARA 並行 CameraParallel This camera moves parallel to Mario's position using fixed angles and distance.
  • dist: Distance from Mario's position.
  • angleB: Horizontal angle in radians.
  • angleA: Vertical angle in radians.
  • num1: Enables resetting and rounding if non-zero.
CAM_TYPE_WONDER_PLANET プラネット CameraWonderPlanet
  • angleA
  • axis.X
  • axis.Y
CAM_TYPE_TOWER CameraTower This camera is focused at a set coordinate and rotates around this point based on Mario's position.
  • dist: Distance from fixpoint position.
  • angleA: Vertical angle in radians.
  • angleB: Size of the radius area at which the camera stops rotating. The higher the more restricted.
  • wpoint: Fixed point coordinate
  • axis:Which Axis to use for rotating
CAM_TYPE_TOWER_POS 塔(サブターゲット付き) CameraTowerPos
  • angleB
  • angleA
  • up.X
  • up.Y
  • wpoint
  • axis
CAM_TYPE_INWARD_TOWER 塔内部 CameraInwardTower
  • axis
  • angleB
  • angleA
  • dist
  • wpoint
CAM_TYPE_INWARD_SPHERE 球内部 CameraInwardSphere
  • angleA
  • angleB
  • dist
CAM_TYPE_POINT_FIX 完全固定 CameraFix
  • dist
  • axis.X
  • axis.Y
  • wpoint
  • up
CAM_TYPE_EYEPOS_FIX 定点 CameraFixedPoint Fixed camera which looks at Mario.
  • wpoint: Position of the camera.
  • num1
  • roll: Z rotation in radians.
CAM_TYPE_EYEPOS_FIX_THERE その場定点 CameraFixedThere Stops the camera in the position of the last camera used and focuses on Mario. Mostly used for the landing sequence of flying stars.
  • num2
  • num1
CAM_TYPE_TRUNDLE トランドル CameraTrundle
  • up.X
  • angleA
  • angleB
  • dist
  • wpoint
  • axis
CAM_TYPE_SPHERE_TRUNDLE 球トランドル CameraSphereTrundle n/a ?
CAM_TYPE_INNER_CYLINDER 円筒内部 CameraInnerCylinder
  • axis
  • angleA
  • angleB
  • dist
  • up.X
  • wpoint
CAM_TYPE_CUBE_PLANET キューブ惑星 CameraCubePlanet Variant of camera type follow in which the camera rotates along based on Mario's current gravitational frame.
  • dist
  • angleA
  • angleB
CAM_TYPE_CHARMED_FIX サンボ CameraCharmedFix
  • up
  • axis
  • wpoint
CAM_TYPE_CHARMED_VECREG ベクトルレジスタ注目 CameraCharmedVecReg
  • angleA
  • angleB
  • axis
  • dist
  • string
CAM_TYPE_CHARMED_VECREG_TOWER VecReg角度補正塔カメラ CameraCharmedVecRegTower
  • axis
  • dist
  • angleA
  • angleB
  • string
  • wpoint
  • num1
CAM_TYPE_MEDIAN_PLANET 中点注目プラネット CameraMedianPlanet
  • wpoint.X
  • dist
  • angleB
  • angleA
  • axis
  • string
CAM_TYPE_MEDIAN_TOWER 中点塔カメラ CameraMedianTower
  • string
  • up
  • angleA
  • wpoint
  • axis
CAM_TYPE_FOLLOW フォロー CameraFollow
  • axis.X
  • axis.Y
  • angleA
  • angleB
  • dist
  • num1
CAM_TYPE_RACE_FOLLOW レース用フォロー CameraRaceFollow
  • angleA
  • wpoint
  • num1
CAM_TYPE_WATER_FOLLOW 水中フォロー CameraWaterFollow
  • dist
  • axis.Y
  • axis.Y
CAM_TYPE_WATER_PLANET 水中プラネット CameraWaterPlanet
  • angleA
  • axis.X
  • axis.Y
CAM_TYPE_WATER_PLANET_BOSS 水中プラネットボス CameraWaterPlanetBoss
  • up
  • num1
  • wpoint
  • axis
  • dist
CAM_TYPE_TRIPOD_PLANET 三脚惑星 CameraTripodPlanet
  • up
  • dist
  • wpoint
  • axis
CAM_TYPE_TRIPOD_BOSS 三脚ボス CameraTripodBoss n/a
  • up
  • dist
  • axis
  • wpoint
CAM_TYPE_TRIPOD_BOSS_JOINT 三脚ボスジョイント CameraTripodBossJoint n/a
  • num1
  • dist
  • angleA
  • angleB
  • axis
CAM_TYPE_CHARMED_TRIPOD_BOSS 三脚ボスジョイント注視 CameraCharmedTripodBoss n/a
  • up
  • axis.X
  • axis.Y
  • num1
  • wpoint
CAM_TYPE_FOO_FIGHTER フーファイター CameraFooFighter
  • dist
  • axis.X
  • axis.Y
CAM_TYPE_FOO_FIGHTER_PLANET フーファイタープラネット CameraFooFighterPlanet
  • dist
  • axis.X
  • axis.Y
CAM_TYPE_RAIL_WATCH レール注目 CameraRailWatch
  • num1
  • num2
  • axis.X
  • dist
  • angleA
CAM_TYPE_RAIL_DEMO レールデモ CameraRailDemo
  • num1
  • num2
  • dist
CAM_TYPE_RAIL_FOLLOW レールフォロー CameraRailFollow
  • num1
  • num2
  • dist
  • wpoint.X
  • wpoint.Y
CAM_TYPE_OBJ_PARALLEL オブジェ並行 CameraObjParallel
  • dist
  • angleA: Pitch in radians.
  • angleB
CAM_TYPE_MTXREG_PARALLEL マトリクスレジスタ並行 CameraMtxRegParallel
  • string
  • angleA
  • angleB
  • dist
CAM_TYPE_SLIDER スライダー CameraBehind
  • angleA
  • angleB
  • dist
  • axis.X
CAM_TYPE_2D_SLIDE 2Dスライド CameraSlide
  • axis
  • up
  • dist
  • angleA
  • wpoint
CAM_TYPE_GROUND 地面 CameraGround
  • angleA
  • angleB
  • dist
  • up
CAM_TYPE_SPIRAL_DEMO 螺旋デモ CameraSpiral
  • num1
  • num2
  • axis
  • wpoint
CAM_TYPE_TWISTED_PASSAGE ねじれ回廊 CameraTwistedPassage
  • num1
  • axis.X
  • axis.Y
CAM_TYPE_FRONT_AND_BACK 表裏カメラ CameraFrontAndBack
  • axis
  • angleA
  • angleB
  • dist
  • wpoint
CAM_TYPE_FREEZE その場完全固定 CameraFreeze n/a Stops and freezes the camera completely based on the last camera position and rotation. ?
CAM_TYPE_TALK 会話 CameraTalk
  • wpoint
  • up
  • axis.X
  • axis.Y
CAM_TYPE_ANIM アニメ CameraAnim
  • num1
  • dist
CAM_TYPE_DEAD 通常死亡 CameraDead
  • num1
  • num2
  • dist
CAM_TYPE_BLACK_HOLE ブラックホール CameraBlackHole
  • axis
  • wpoint
CAM_TYPE_DPD DPD CameraDPD
  • num2
  • up.X
  • wpoint
  • angleA
  • angleB
  • dist
  • num1
CAM_TYPE_SUBJECTIVE 主観 CameraSubjective n/a

Aliases

Likely for the purpose of preserving compatibility with test camera files, the developers added aliases for some camera classes. These exist in both Galaxy games. However, these aliases only apply if the camera version is greater or equal to the required version. Interestingly, it also contains an alias for CAM_TYPE_BOSS_DONKETSU, a camera class that has been removed from the actual game.

Alias Name Actual Name Required Version
CAM_TYPE_DONKETSU_TEST CAM_TYPE_BOSS_DONKETSU 196612
CAM_TYPE_BEHIND_DEBUG CAM_TYPE_SLIDER 196614
CAM_TYPE_INWARD_TOWER_TEST CAM_TYPE_INWARD_TOWER 196614
CAM_TYPE_EYE_FIXED_THERE_TEST CAM_TYPE_EYEPOS_FIX_THERE 196614
CAM_TYPE_ICECUBE_PLANET CAM_TYPE_CUBE_PLANET 196617

Common Properties

Property Description
General
version Camera engine version. Usually 196630 in Super Mario Galaxy 1 and 196631 in Super Mario Galaxy 2.
camtype Class identifier name. See the tables above for possible values.
id The camera's identifier name. See the respective section for more details.
woffset.X
woffset.Y
woffset.Z
A constant offset from the target relative to the Zone the camera belongs to.
loffset An offset from the target's forward vector. Higher values move the camera further in front of the target and lower values move it behind the target.
loffsetv An offset from the target's upward vector. Higher values move the camera further above the target and lower values move it below the target.
roll Rotates the camera. 180 will flip the camera upside down
fovy The field of view angle in degrees. Huge numbers cause visual issues, so it's best to keep this between 0 and 179.9
camint The amount of time in frames it takes for the camera to get into it's active position
upper Upper screen bound relative to the center of the screen
lower Lower screen bound relative to the cetner of the screen
gndint
uplay How high in the world the target needs to go before the camera physically starts moving upwards
lplay How low in the world the target needs to go before the camera physically starts moving downwards
pushdelay The activation time in frames for when the Upper bound activates
pushdelaylow The activation time in frames for when the Lower bound activates
udown
vpanuse Enables the use of the Camera Height Arrangement
vpanaxis.X
vpanaxis.Y
vpanaxis.Z
flag.noreset
flag.nofovy If enabled, the FoV can be changed
flag.lofserpoff If enabled, the loffset and loffsetv will not interpolate into position and snap to where it needs to be.
flag.antibluroff If enabled, rotating the camera will be not be smooth
flag.collisionoff Disables collision with map geometry if enabled. This means that the camera will move through collision if necessary.
flag.subjectiveoff Disables the first-person camera if enabled.
Game
gflag.thru
gflag.enableEndErpFrame If enabled, a "Camera deactivation time" (gflag.camendint) will be enabled, and deactivating this camera will have this time be used instead of the new camera's time
gflag.camendint Determines the time in frames that this camera will need to deactivate
Event
eflag.enableErpFrame
eflag.enableEndErpFrame
camendint
evfrm The time in frames that this event camera is active for
evpriority Always 1.

Trivia

  • The oldest available camera version is 196617 and can be found in HellLavaFloatingZone.
  • The function CameraParamChunk::load references a removed camera class labeled as CAM_TYPE_PLANET.
  • Intro cameras dynamically create a CAM_TYPE_ANIM camera with the ID o:スタートアニメカメラ. It is not possible to overwrite this in a BCAM file.