Difference between revisions of "KMP Editing/Cameras"

From Custom Mario Kart
Jump to navigation Jump to search
Line 1: Line 1:
 
This page is a part of the '''Custom Track Tutorial'''. [[Custom Track Tutorial|Back to the main tutorial page]].
 
This page is a part of the '''Custom Track Tutorial'''. [[Custom Track Tutorial|Back to the main tutorial page]].
 
{{KMP}}
 
{{KMP}}
==Introduction==
+
== Introduction ==
 
This page explains the basics of how cameras found in [[KMP]] files works in  [[Mario Kart Wii]]. There are two basic types of camera: opening pan and replay. Opening pans play before the start of VS and Grand Prix races. Replay cameras play after a VS or Time Trial race ends, during live view of an online race and during ghost replay. Good cameras can make your track look much better, but can be difficult to make. Improperly set cameras can make the game crash in any of these points. Make sure you always have backups of your KMP when editing. You can use any KMP editor for this. This page will use pictures of [[KMP Cloud]] with the KMP file from Mario Circuit (castle_course.szs) and the [[KCL]] exported to OBJ with Wiimms Tools used as background.
 
This page explains the basics of how cameras found in [[KMP]] files works in  [[Mario Kart Wii]]. There are two basic types of camera: opening pan and replay. Opening pans play before the start of VS and Grand Prix races. Replay cameras play after a VS or Time Trial race ends, during live view of an online race and during ghost replay. Good cameras can make your track look much better, but can be difficult to make. Improperly set cameras can make the game crash in any of these points. Make sure you always have backups of your KMP when editing. You can use any KMP editor for this. This page will use pictures of [[KMP Cloud]] with the KMP file from Mario Circuit (castle_course.szs) and the [[KCL]] exported to OBJ with Wiimms Tools used as background.
  
Line 117: Line 117:
 
Cameras are found in the [[CAME]] section of the [[KMP Editing|KMP Editor]]. They can be placed like any normal object. The position only matters on certain camera types. Make sure the Route being used by each camera is unique to it; The same route should not be shared between multiple cameras or between cameras and objects.
 
Cameras are found in the [[CAME]] section of the [[KMP Editing|KMP Editor]]. They can be placed like any normal object. The position only matters on certain camera types. Make sure the Route being used by each camera is unique to it; The same route should not be shared between multiple cameras or between cameras and objects.
  
==Camera types==
+
== Camera types ==
 
{|class="wikitable"
 
{|class="wikitable"
 
|+CAME Types
 
|+CAME Types
Line 145: Line 145:
 
Types 04 and 05 are used for opening pans. Types 01 to 04 are used as replay cameras. Type 00 is the default replay camera, activated as soon as you pass the finish line or when no other camera is active.
 
Types 04 and 05 are used for opening pans. Types 01 to 04 are used as replay cameras. Type 00 is the default replay camera, activated as soon as you pass the finish line or when no other camera is active.
  
==Opening Pans==
+
== Opening Pans ==
 
Opening pans are a set of cameras that are shown before a race starts. [[Nintendo]] always use three cameras, usually with type 05 (although some tracks use camera type 04) with time values of ''220'', ''257'' and ''294'' in this order. This makes the cameras sync up with the song that plays; each camera is linked by the "Next Camera" value in the entry, the last one being -1 (0xFF). Any number of cameras playing for any amount of time is supported, though. If the cameras are too short, the sound will end early; if they are too long, the sound will finish but the cameras will keep playing.
 
Opening pans are a set of cameras that are shown before a race starts. [[Nintendo]] always use three cameras, usually with type 05 (although some tracks use camera type 04) with time values of ''220'', ''257'' and ''294'' in this order. This makes the cameras sync up with the song that plays; each camera is linked by the "Next Camera" value in the entry, the last one being -1 (0xFF). Any number of cameras playing for any amount of time is supported, though. If the cameras are too short, the sound will end early; if they are too long, the sound will finish but the cameras will keep playing.
 
The first camera of the opening pans is set in the header of the CAME section. It can be edited using KMP Cloud or Wiimms Tools. The next cameras are each set in the CAME entry, as seen above.
 
The first camera of the opening pans is set in the header of the CAME section. It can be edited using KMP Cloud or Wiimms Tools. The next cameras are each set in the CAME entry, as seen above.
Line 157: Line 157:
 
When testing the camera pans, it's a good idea to set the "Next" value of the last camera for it to loop back to the first one. The cameras will loop endlessly (until you press a button to skip them), allowing you to view them as many times as you want to.
 
When testing the camera pans, it's a good idea to set the "Next" value of the last camera for it to loop back to the first one. The cameras will loop endlessly (until you press a button to skip them), allowing you to view them as many times as you want to.
  
=== Replay Cameras ===
+
=== Using [[3ds Max]] for the cameras ===
 +
It is possible to use 3ds Max to have a preview on how the camera's going to work, and find good values for the cameras and routes there. You need some knowledge of how to work with 3ds Max cameras, splines and animations for this.
 +
 
 +
#Open or import your course model in 3ds Max.
 +
#Create a new camera object. Make sure it's a camera with a fixed view point.
 +
#Set the number of frames in the scene to the duration of the camera. For example, if it's the first camera of the opening pans, it would be 220 frames. Make sure the scene is set to 60 frames per second.
 +
#Create a spline. This is going to be your route.
 +
#Make the camera follow the spline. Set it so that in the first (key) frame of the animation, the camera is at the first point of the spline, and in the last frame, the camera is in the last point of the spline.
 +
#Create another spline. This one should only have two vertices. These are going to be the view start and view end points.
 +
#Make the camera view point follow this spline in a similar way that the camera itself follows the first one.
 +
#Set zoom values for the camera, one at the first frame and one at the last frame.
 +
#The camera should now follow a route, have its view point follow a route, and zoom from one opening to the other all in the same amount of time. You can play the animation with the view set to the camera to have a preview on it, and even edit it in real time.
 +
#When you're happy with the animation, export the spline the camera's following as a route using the OBJ exporter and use Wiimms Tools to get the spline into the text KMP file:
 +
##To do this, open the OBJ in a text editor, replace all the "v"s with 1s in the spline and paste that as a new route in the text KMP; Wiimms Tools will fix it when compiling.
 +
#Get the total lenght of the camera spline. Divide it by the number of frames in the scene. This is going to be the speed you'll put in each route point, except the last one which shouold be 0.
 +
#Copy the coordinates of the two vertices of the view point spline as view point start and end coordinates in the CAME entry.
 +
#Get the total lenght of the view point spline. Divide it by the number of frames in the scene and multiply it by 100. This is going to be the view point speed set in the CAME entry.
 +
#Get the initial and final values for zooming and copy them to the CAME entry. Take note of the difference between the two values. Divide it by the number of frames and multiply it by 100. This is going to be the zoom speed set in the CAME entry.
 +
*Note: the final result will be very approximate to the 3ds Max view, but not identical. This is specially true when it comes to the zooming, as there are other camera settings which can be set in 3ds Max which are not available for editing in Mario Kart Wii.
 +
*You can also do this for the other camera types (the replay cameras, listed below) but it's harder to know how the outcome will be, since it's hard to replicate the movement of players inside 3ds Max.
 +
 
 +
== Replay Cameras ==
 
Replay cameras are much harder to edit and test than opening pans; they require knowledge about KMP [[AREA]]s too. When viewing the replay or live feed, a camera is activated when the player being observed enters an AREA region. It does not deactivate automatically when the player leaves it. See [[KMP Editing#Areas (AREA)|this section]] for information on placing an AREA entry.
 
Replay cameras are much harder to edit and test than opening pans; they require knowledge about KMP [[AREA]]s too. When viewing the replay or live feed, a camera is activated when the player being observed enters an AREA region. It does not deactivate automatically when the player leaves it. See [[KMP Editing#Areas (AREA)|this section]] for information on placing an AREA entry.
  
Line 181: Line 202:
 
With your AREA region moved, rotated and scaled the way you want it to be and linked to the ID of a camera, it's time to set the camera settings. Depending on which camera type you choose (from 00 to 04), it will be set up differently.
 
With your AREA region moved, rotated and scaled the way you want it to be and linked to the ID of a camera, it's time to set the camera settings. Depending on which camera type you choose (from 00 to 04), it will be set up differently.
  
====Camera Type 00 (Goal)====
+
=== Camera Type 00 (Goal) ===
 
This is the default camera that looks directly at you as soon as the race finishes. It does not need an AREA to be activated, but it can be activated by one if needed. It does not use a route, so the route should be set to -1 (0xFF). The camera point place is ignored. It's recommended to just copy all the settings that were present in the type 00 camera of a Nintendo track. There should be only one type 00 camera in your KMP.
 
This is the default camera that looks directly at you as soon as the race finishes. It does not need an AREA to be activated, but it can be activated by one if needed. It does not use a route, so the route should be set to -1 (0xFF). The camera point place is ignored. It's recommended to just copy all the settings that were present in the type 00 camera of a Nintendo track. There should be only one type 00 camera in your KMP.
  
====Camera Type 01 (FixSearch)====
+
=== Camera Type 01 (FixSearch) ===
 
It does not use a route, so the route should be set to -1 (0xFF). It also does not have a view point start, end or speed; only zoom start, end and speed values are set. This camera stays in the camera point place and looks directly at the player. It's the easiest camera type to set up.
 
It does not use a route, so the route should be set to -1 (0xFF). It also does not have a view point start, end or speed; only zoom start, end and speed values are set. This camera stays in the camera point place and looks directly at the player. It's the easiest camera type to set up.
  
====Camera Type 02 (PathSearch)====
+
=== Camera Type 02 (PathSearch) ===
 
This camera is similar to the opening pan. It follows a route at the speed specified in the route, so the camera point place is ignored. It does not have a view point start, end or speed; only zoom start, end and speed values are set. The camera always looks directly at the player.
 
This camera is similar to the opening pan. It follows a route at the speed specified in the route, so the camera point place is ignored. It does not have a view point start, end or speed; only zoom start, end and speed values are set. The camera always looks directly at the player.
  
====Camera Type 03 (KartFollow)====
+
=== Camera Type 03 (KartFollow) ===
 
''With the player as the origin, the camera's ''View Start'' position both follows and looks at the player, it does not use a route''
 
''With the player as the origin, the camera's ''View Start'' position both follows and looks at the player, it does not use a route''
  
====Camera Type 04 (KartPathFollow)====
+
=== Camera Type 04 (KartPathFollow) ===
 
This camera is similar to the opening pan, and can be used as an opening pan camera. It stays in the camera point place and does not use a route, so the route should be set to -1 (0xFF). It has a view point start, end and speed; and also zoom start, end and speed. The camera looks from the view start point to the view end point, which moves at the specified speed.
 
This camera is similar to the opening pan, and can be used as an opening pan camera. It stays in the camera point place and does not use a route, so the route should be set to -1 (0xFF). It has a view point start, end and speed; and also zoom start, end and speed. The camera looks from the view start point to the view end point, which moves at the specified speed.
  
 
{{Camera Links}}
 
{{Camera Links}}
  
==Links==
+
== Links ==
 
{{Custom Track Tutorial}}
 
{{Custom Track Tutorial}}
 
[[category:Tutorials]][[category:Custom Track Tutorial]]
 
[[category:Tutorials]][[category:Custom Track Tutorial]]

Revision as of 07:41, 8 November 2016

This page is a part of the Custom Track Tutorial. Back to the main tutorial page.

Introduction

This page explains the basics of how cameras found in KMP files works in Mario Kart Wii. There are two basic types of camera: opening pan and replay. Opening pans play before the start of VS and Grand Prix races. Replay cameras play after a VS or Time Trial race ends, during live view of an online race and during ghost replay. Good cameras can make your track look much better, but can be difficult to make. Improperly set cameras can make the game crash in any of these points. Make sure you always have backups of your KMP when editing. You can use any KMP editor for this. This page will use pictures of KMP Cloud with the KMP file from Mario Circuit (castle_course.szs) and the KCL exported to OBJ with Wiimms Tools used as background.

When working with cameras, speed values are usually set in units per frame (speeds set in Route entries) or units per hundred frames (speeds set in CAME entry). Mario Kart Wii usually runs at 60 frames per second, so you can divide the values by 60 to convert them to units per second.

These are the main values set in a Camera point entry. Not all settings are known:

CAME entry data structure
Setting Description Names in
Wiimms Tools
Column name in
KMP Modifier
Box name in
KMP Cloud
Type Camera type. type Type Type
Next Next camera entry index. Value 0xFF means: no next camera. next Next Next
? Camshake. Unknown (always 0). unknown Shake Shake
Route ID Route used by the camera. This is index link into the POTI section. -1 (0xFF) means "no route". route Route Route
Camera Speed Velocity of the camera point in units per 100 frames (=units/1.67 sec). v(came) V(Cam) Pointspeed
Zoom Speed Velocity of zooming in units per 100 frames (=units/1.67 sec). v(zoom) V(Zoom) Zoomspeed
View Speed Velocity of the view point in units per 100 frames (=units/1.67 sec). v(v.pt) V(View) Viewspeed
? Start flag. Unknown. unknown Flag
(First 2 digits)
Start
? Movie flag. Unknown. unknown Flag
(Second 2 digits)
Movie
Position (X, Y, Z) A 3D position vector of the camera. Ignored if the camera uses routes. position (x,y,z) X, Y and Z PositionX, PositionY and PositionZ
Rotation (X, Y, Z) A 3D rotation vector. Almost always (0, 0, 0). rotation (x,y,z) Roll, Yaw and Pitch RotationX, RotationY and RotationZ
Zoom Start Zoom start: Starting field of view. Angles >180 create curious effects. zoom beg Zoom Zoomstart
Zoom End Zoom end. Final field of view. "Zoom speed" controls the speed of zooming. zoom end Zoom2 Zoomend.
View Position Start/Relative Position (X, Y, Z) Start vector of the view point (camera type 5) or the relative camera position (camera type 3). view point beg (x,y,z) View(x), View(y) and View(z) ViewStartX, ViewStartY and ViewStartZ
View Position End (X, Y, Z) (Destination) vector of the view point. view point end (x,y,z) View2(x), View2(y) and View2(z) ViewEndX, ViewEndY and ViewEndZ
Time The time for how long this Camera is active, in frames. sec*60 Time Time

→ See more in-depth information on the page: CAME

KMP Cloud open in Mario Circuit's cameras; notice the route for the selected camera is also shown

Cameras are found in the CAME section of the KMP Editor. They can be placed like any normal object. The position only matters on certain camera types. Make sure the Route being used by each camera is unique to it; The same route should not be shared between multiple cameras or between cameras and objects.

Camera 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 looks at the player.
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 View Start location, and always looks towards the player No
02 PathSearch Replay Route controlled, always looks at the player Yes
03 KartFollow Replay With the player as the origin, the camera's View Start position both follows and looks at the player No
04 KartPathFollow Replay/Opening From its position, it looks at View Start and shifts view to View End No
05 OP_FixMoveAt Opening Opening camera, follows route; from its position, it looks at View Start and shifts view to View End Yes
06 OP_PathMoveAt Opening Opening camera onboard with same effects as normal drive Camera (unsure) Yes
07 MiniGame Unknown Unused ???
08 MissionSuccess Unknown Unused ???

Types 04 and 05 are used for opening pans. Types 01 to 04 are used as replay cameras. Type 00 is the default replay camera, activated as soon as you pass the finish line or when no other camera is active.

Opening Pans

Opening pans are a set of cameras that are shown before a race starts. Nintendo always use three cameras, usually with type 05 (although some tracks use camera type 04) with time values of 220, 257 and 294 in this order. This makes the cameras sync up with the song that plays; each camera is linked by the "Next Camera" value in the entry, the last one being -1 (0xFF). Any number of cameras playing for any amount of time is supported, though. If the cameras are too short, the sound will end early; if they are too long, the sound will finish but the cameras will keep playing. The first camera of the opening pans is set in the header of the CAME section. It can be edited using KMP Cloud or Wiimms Tools. The next cameras are each set in the CAME entry, as seen above.

The cameras follow a route, always at the speed set in the route settings. The point where the camera looks at is initially the view point start, and it shifts from it to the view point end in the specified speed. At the same time, the field of view, changes from the starting to the ending one at the specified speed. If any of the movements (route, view point or zoom) ends before the set time for the camera passes, it will just stay where it is.

So, to edit the opening cameras, first you should set the routes for them. Make sure the speed set in each point is correct and the camera takes about the same time to follow the route it is set to last. After that, set view point start and end and finally zoom values. Note that the speed of the view point is usually a much higher value, compared to zoom speeds. In KMP Cloud the values are read as hexadecimal.

Nintendo always shows the racers before the finish line in the third camera pan. You can follow this if you want to.

When testing the camera pans, it's a good idea to set the "Next" value of the last camera for it to loop back to the first one. The cameras will loop endlessly (until you press a button to skip them), allowing you to view them as many times as you want to.

Using 3ds Max for the cameras

It is possible to use 3ds Max to have a preview on how the camera's going to work, and find good values for the cameras and routes there. You need some knowledge of how to work with 3ds Max cameras, splines and animations for this.

  1. Open or import your course model in 3ds Max.
  2. Create a new camera object. Make sure it's a camera with a fixed view point.
  3. Set the number of frames in the scene to the duration of the camera. For example, if it's the first camera of the opening pans, it would be 220 frames. Make sure the scene is set to 60 frames per second.
  4. Create a spline. This is going to be your route.
  5. Make the camera follow the spline. Set it so that in the first (key) frame of the animation, the camera is at the first point of the spline, and in the last frame, the camera is in the last point of the spline.
  6. Create another spline. This one should only have two vertices. These are going to be the view start and view end points.
  7. Make the camera view point follow this spline in a similar way that the camera itself follows the first one.
  8. Set zoom values for the camera, one at the first frame and one at the last frame.
  9. The camera should now follow a route, have its view point follow a route, and zoom from one opening to the other all in the same amount of time. You can play the animation with the view set to the camera to have a preview on it, and even edit it in real time.
  10. When you're happy with the animation, export the spline the camera's following as a route using the OBJ exporter and use Wiimms Tools to get the spline into the text KMP file:
    1. To do this, open the OBJ in a text editor, replace all the "v"s with 1s in the spline and paste that as a new route in the text KMP; Wiimms Tools will fix it when compiling.
  11. Get the total lenght of the camera spline. Divide it by the number of frames in the scene. This is going to be the speed you'll put in each route point, except the last one which shouold be 0.
  12. Copy the coordinates of the two vertices of the view point spline as view point start and end coordinates in the CAME entry.
  13. Get the total lenght of the view point spline. Divide it by the number of frames in the scene and multiply it by 100. This is going to be the view point speed set in the CAME entry.
  14. Get the initial and final values for zooming and copy them to the CAME entry. Take note of the difference between the two values. Divide it by the number of frames and multiply it by 100. This is going to be the zoom speed set in the CAME entry.
  • Note: the final result will be very approximate to the 3ds Max view, but not identical. This is specially true when it comes to the zooming, as there are other camera settings which can be set in 3ds Max which are not available for editing in Mario Kart Wii.
  • You can also do this for the other camera types (the replay cameras, listed below) but it's harder to know how the outcome will be, since it's hard to replicate the movement of players inside 3ds Max.

Replay Cameras

Replay cameras are much harder to edit and test than opening pans; they require knowledge about KMP AREAs too. When viewing the replay or live feed, a camera is activated when the player being observed enters an AREA region. It does not deactivate automatically when the player leaves it. See this section for information on placing an AREA entry.

Important values for the AREA entry:

AREA entry data structure
Setting Description
Type Area type. Type 0 is the one which refers to a camera.
Camera ID Index of CAME. Camera this AREA refers to.
Position (X, Y, Z) A 3D position vector of the area.
Rotation (X, Y, Z) A 3D rotation vector of the area.
Scale (X, Y, Z) A 3D scale vector of the area.

All other AREA settings shouold be left untouched, if you're working with the AREAs only for the cameras. Areas are also used for other things, see AREA type for this.

With your AREA region moved, rotated and scaled the way you want it to be and linked to the ID of a camera, it's time to set the camera settings. Depending on which camera type you choose (from 00 to 04), it will be set up differently.

Camera Type 00 (Goal)

This is the default camera that looks directly at you as soon as the race finishes. It does not need an AREA to be activated, but it can be activated by one if needed. It does not use a route, so the route should be set to -1 (0xFF). The camera point place is ignored. It's recommended to just copy all the settings that were present in the type 00 camera of a Nintendo track. There should be only one type 00 camera in your KMP.

Camera Type 01 (FixSearch)

It does not use a route, so the route should be set to -1 (0xFF). It also does not have a view point start, end or speed; only zoom start, end and speed values are set. This camera stays in the camera point place and looks directly at the player. It's the easiest camera type to set up.

Camera Type 02 (PathSearch)

This camera is similar to the opening pan. It follows a route at the speed specified in the route, so the camera point place is ignored. It does not have a view point start, end or speed; only zoom start, end and speed values are set. The camera always looks directly at the player.

Camera Type 03 (KartFollow)

With the player as the origin, the camera's View Start position both follows and looks at the player, it does not use a route

Camera Type 04 (KartPathFollow)

This camera is similar to the opening pan, and can be used as an opening pan camera. It stays in the camera point place and does not use a route, so the route should be set to -1 (0xFF). It has a view point start, end and speed; and also zoom start, end and speed. The camera looks from the view start point to the view end point, which moves at the specified speed.

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.

Links