Camera

From Custom Mario Kart
Jump to navigation Jump to search

This article explains the camera techniques used in Mario Kart Wii.

KMP Sections

Each KMP file contains 3 sections that are related to the Camera setup: AREA, CAME and POTI:

  • Section AREA defines areas. Some types of areas trigger cameras for the finish (after race) view.
  • Section CAME defines cameras. Cameras can be linked together for a sequence of Cameras.
  • Section POTI defines routes for different things. Some camera need routes.

Data Structure

Here are the section headers of AREA and CAME:

AREA entry data structure (0x30 bytes)
Offset Type Description
0x00 Byte Area shape. 0 = box, 1 = cylinder.
0x01 Byte Area type. Values 0–A.
0x02 Byte Index of CAME if type = 0x00, 0xFF else.
0x03 Byte Priority value. A higher number means a higher priority to choose which area activates if multiple areas are intersected.
0x04 Float[3] A 3D position vector of the area.
0x10 Float[3] A 3D rotation vector of the area's rotation.
0x1C Float[3] A 3D scale vector of the area's scale.
0x28 UInt16 AREA setting 1. Used by AREA type 2, 3, 6, 8 and 9.
0x2A UInt16 AREA setting 2. Used by AREA type 6 and 3.
0x2C Byte Route ID used by AREA type 3.
0x2D Byte Enemy point ID. This value is used by AREA type 4.
0x2E UInt16 Padding? Always 0 in Nintendo tracks.
CAME entry data structure (0x48 bytes)
Offset Type Description Box name in
SZS Modifier
Names in
Wiimms Tools
Column name in
KMP Modifier
Box name in
KMP Cloud
0x00 Byte Camera type. Settings
(box 1, first 2 digits)
type Type Type
0x01 Byte Next camera entry index. Value 0xFF means: no next camera. Settings
(box 1, second 2 digits)
next Next Next
0x02 Byte Camshake. Exact meanings unknown (always 0). Settings
(box 1, third 2 digits)
unknown Shake Shake
0x03 Byte Route used by the camera. This is index link into the POTI section. The value 0xFF means "no route". Settings
(box 1, last 2 digits)
route Route Route
0x04 UInt16 Velocity of the camera point in units per 100/60 sec (=distance/1.67 sec). Settings
(box 2, first 4 digits)
v(came) V(Cam) Pointspeed
0x06 UInt16 Velocity of zooming in units per 100/60 sec (=units/1.67 sec) (tested with camera type 5). Settings
(box 2, last 4 digits)
v(zoom) V(Zoom) Zoomspeed
0x08 UInt16 Velocity of the view point in distance per 100/60 sec (=distance/1.67 sec) (tested with camera type 5). Settings
(box 3, first 4 digits)
v(v.pt) V(View) Viewspeed
0x0A Byte Start flag. Exact meanings unknown. Settings
(box 3, third 2 digits)
unknown Flag
(First 2 digits)
Start
0x0B Byte Movie flag. Exact meanings unknown. Settings
(box 3, last 2 digits)
unknown Flag
(Second 2 digits)
Movie
0x0C Float[3] A 3D position vector of the camera. X, Y and Z position (x,y,z) X, Y and Z PositionX, PositionY and PositionZ
0x18 Float[3] A rotation 3D vector. Almost always 0,0,0. X2, Y2 and Z2 rotation (x,y,z) Roll, Yaw and Pitch RotationX, RotationY and RotationZ
0x24 Float Zoom start: The angle of view (field of view). Angles >180 create curious effects. X3 zoom beg Zoom Zoomstart
0x28 Float Zoom end. The camera changes the zoom to this value. Offset 0x06 (Velocity) controls the speed of zooming. Y3 zoom end Zoom2 Zoomend.
0x2C Float[3] Start vector of the view point (camera type 5) or the relative camera position (camera type 3). Z3, X4 and Y4 view point beg (x,y,z) View(x), View(y) and View(z) ViewStartX, ViewStartY and ViewStartZ
0x38 Float[3] (Destination) vector of the view point. Z4, X5 and Y5 view point end (x,y,z) View2(x), View2(y) and View2(z) ViewEndX, ViewEndY and ViewEndZ
0x44 Float The time how long this Camera is active. (in units of 1/60 seconds). Z5 sec*60 Time Time

CAME Types

CAME Types
Value Name Type Explication Route controlled?
00 Goal Goal Activates immediately after passing the goal; with the player as the origin, the camera's View Start position both follows and points towards View End.
It can be reactivated as a replay camera if linked to an AREA, but does not display in spectator (online/waiting) mode.
No
01 FixSearch Replay Camera stays static in Position location, and always looks towards the player. It is almost the same as PathSearch but with no route. No
02 PathSearch Replay Route controlled, always looks at the player. Only the position of the first route point is used and will always face the player. Yes
03 KartFollow Replay With the player as the origin, the camera's location is at View Start and it follows and points towards View End. If View Start and View End are 0, it will directly face the player backwards. This is similar to the Goal camera type. No
04 KartPathFollow Replay / Opening From its position, it looks at View Start and shifts view to View End. If neither are set, it will just look at the player from wherever it is positioned. No
05 OP_FixMoveAt Opening Opening camera, follows route; from its position, it looks at View Start and shifts view to View End if set, otherwise looks at player. This camera type only requires a route. It does not need an AREA Entry. Yes
06 OP_PathMoveAt Replay This camera will move along a route with the player and turn with the player as well. The camera is affected by things like turning and tricking. Only the first point of the route is used. Yes
07 MiniGame Unknown Unused ???
08 MissionSuccess Unknown Unused ???
09 Unknown MSPT Static camera from the position initially used in the Giant Pokey tournament that can use Zoom (speed, start, and end). Copy view start and view end values from Camera type 0. No

Examples for good custom camera setups

The following video shows camera setups (opening + finish cameras) of 6 tracks:

Cameras 6 example tracks

Camera related articles

»Camera«
Technical information, includes an analysis.
»KMP«
File, where the camera setup is hold.
»KMP Editing/Cameras«
A KMP and camera tutorial.
»Wiimms SZS Tools/KMP«
How to edit KMP files using Wiimms SZS Tools.