rich_is_bored@Posted: Sun Apr 20, 2003 11:05 am :
WARNING: This tutorial was written for use with the alpha leak. The information contained within is now outdated and does not apply to the retail game. In the retail version, the camera inspector is now completely defunct. Once a new method is worked out this tutorial will be revised or replaced.

Camera Tutorial

Introduction

First things first, I would like to thank Rayne, Zapp, and BNA for bringing this knowledge to my attention. Thanks to them not only do I know how to make a camera in game but I have expanded upon that knowledge. Guess what? You can make spline paths for cameras! :)

I have only been fooling around with this for a day. I know very little of what every little button in the camera inspector does. I'll figure out what peaks my curiosity but if I don't have any luck after about an hour or so I stop playing with it for a couple of weeks. That's how I am.

I already am the go to guy for scripting. Trust me on this one folks. I am passing this baby off to somebody else. If you start figuring out things that are not in this tutorial, guess what? You're the camera guy and it's time to start writing up tutorials.

Okay, now I'll get off my soapbox and try to teach you all something. :D

Apparently the camera system is functional in D3Radient. However, it has it's share of bugs.

Some of the buttons in the camera inspector don't work. Namely the delete button.

Also, if you make a mistake, your in trouble because there is no undo and since you can't delete you have to close out the editor and start all over again.

What does that mean? You have to have a game plan. Once an idea pops up in your head sit down and think about what you are trying to acheive and what combination of options will achieve it.

Basics of Cameras

Oh boy a new file type! That's right folks you'll make your first camera and a new file and folder will appear under the base directory. It's simple enough. The extention is *.camera and you can find them in base\cameras.

Just for show here is what the contense of a camera file looks like.

Code:
cameraPathDef {
   time 30.000000
   camera_Spline {
      time 30000
      type 2
      name position
      baseVelocity 0.000000
      target {
         granularity 0.025000
         ( -9.000000 -32.000000 -30.000000 )
         ( 2.000000 -80.000000 -78.000000 )
         ( 0.000000 -137.000000 -60.000000 )
         ( -130.000000 -179.000000 -81.000000 )
         ( -231.000000 -121.000000 -80.000000 )
         ( -198.000000 -31.000000 -60.000000 )
         ( -73.000000 -116.000000 -48.000000 )
      }
   }
   target_Fixed {
      time 30000
      type 0
      name POA
      baseVelocity 0.000000
      pos ( -175.000000 -95.000000 -44.000000 )
   }
   event {
      type 4
      param "POA"
      time 0
   }
   fov {
      fov 90.000000
      startFOV 0.000000
      endFOV 0.000000
      time 0
   }
}


What does it all mean? I dunno but some of it looks familiar. I didn't make it the Camera Inspector in D3Radient did. This just goes to show you that just about everything in Doom III is text based.

So, for all of you that are confused there is this neat little thing called the Camera Inspector. You can bring it up in D3Radient by clicking the camera button in the tool bar(4th from the right). If you hover your mouse over it you should see the text Spline Options. Interesting enough, I didn't know this button existed along with the buttons to the right of it. You may have this problem too if you run at a resolution equal to or less than 1024x768. If so, you can undock the toolbar from the editor by clicking a blank spot and dragging down. From there you should have a long window that is resizable.

Okay, a camera consists of at least two things. A path and a point of aim. You create a path to control the position of the camera and a point of aim so the camera knows which direction to face.

First off there are three terms you should get familiar with right away. Not only do these terms apply to the path of a camera but also the point of aim.

Fixed: This type is static.
Interpolated: This type moves from point A to point B in a straight line.
Spline: This type moves along a series of points to form a curve.

Now a *.camera file isn't all that you will need in order for it to function. You will have to create a trigger to trigger the event, and you will also need a level script to switch the view from the player to your camera and back.

Before we get into making a camera make yourself a simple box shaped map. Add a info_player_start and a light. Save it.

Creating a Simple Camera

You should have a simple map ready to learn the basics. This would be confusing if you had a couple hundred entities floating around.

First thing we need to do is create a func_camera_spline on the map. Disregard the name. Regardless of what type of camera path or point of aim being used you will always need a func_camera_spline. Place this entity anywhere you like and ensure you name it in this case Camera_Spline01. Now create a new key called pathfile and set its value to cameras\mycamera.camera.

Next you will need a trigger. Create a trigger_once entity. Set its target key to camera_spline01. Create a key named call and set its value to camera_1. Place it so it intersects the info_player_start entity. This will cause the camera to trigger as soon as the map starts.

Now you are going to create the camera file referenced above. Click the camera inspector button. Select New Camera and then Spline. A window should pop up with all sorts of weird looking garbage.

Take note of the name. You can change it to anything you want but in this case I am going to leave it camera01.

Notice the type is listed as Spline and for the most part the remainder of the window is enclosed in a border labeled Path and Target editing.

Take a look at the drop down menu labeled Edit >. Right now it is set to path. Directly underneath it is a set of radio buttons labeled Edit Points and Add Points.

We can't edit points if they don't exist so to start we will select the radio button labeled Add Points.

Keep in mind that we are creating a Spline path for the camera to travel. This means we will need several points. So start plotting points in a quarter circle shape in top down view. After the fourth point you will notice a blue curve appear between the second and third points. This is your spline taking shape.

Note: Spline curves must have a minimum of 4 points to function.

After making around 5 or 6 points you should have enough to work with so stop there.

Now select the Edit Points radio button. Now you can freely drag points to shape the curve however you see fit. Don't be afraid to drag them in different viewports as well.

Once your satisfied with the overall shape of your camera's path we can move on the the point of aim.

Press the Add Target button. Just to make things simple name it POA and select Fixed as its type. Press Okay.

You should see a blue point appear in the viewports labeled Fixed point. Now we are no longer interested in editing the camera path so select POA in the drop down menu if it isn't already selected. Also ensure that the Edit Points button is selected.

You should be able to drag this point into position in the viewports. Remember this is the point where you camera will be facing during the course of its motion.

Now, there is a textbox labeled Length. This is the length of time it will take for your camera to move from one end of the curve to the other. 30 is a little on the long side but its your map. We'll Trim it down to 10 seconds.

Almost ready to save your camera file. First click the Apply button. Then click the Save button. Type in mycamera for your camera name (without the .camera extention) and remember the name. You'll need it later.

Now if you click the right scroll arrow underneath Length you'll notice the preview viewport change to the perspective of the camera. If you continue to click it repeatedly it will traverse the path you set one small increment at a time.

Your not completely finished with D3Radient yet. Save your map. Some form of camera data is stored in your map as well as the camera file you created. Anytime you change your camera you must save your map, camera, and recompile the map.

Close the Camera Inspector if you haven't done so and select an unimportant brush in your map. Press the N key to bring up the Entity Properties window. You should see the properties of your Worldspawn entity. Right now the only key listed is the classname. Create a new key called script and set it to camera.script

Now save your map again and exit the editor.

Open up Editpad or Notepad if your stubborn and copy and paste the following code.

Code:
////////////////////////////////////////////////////
//
//   Setup binds and times etc...
//
////////////////////////////////////////////////////
void setup_objects()
{
}

////////////////////////////////////////////////////
//
//   Block movement...
//
////////////////////////////////////////////////////

void camera_1 ()            // Here is the function that is called when the trigger is hit
{
   sys.setCamera($camera_spline01);   // This will change the view to that of the camera using the pathfile key
   $camera_spline01.start();      // This will start the camera's movement
   sys.fadeIn( '0 0 0', 0.75 );      // This will begin a fade in from black that will take 3/4 a second
   sys.wait(10);            // This will make the engine wait 10 sec (The same as the length)
   sys.firstPerson();         // This will change the view back to that of the player
   sys.fadeIn( '0 0 0', 0.75 );      // Again this will begin a fade in

}

////////////////////////////////////////////////////
//
//   MAIN
//
////////////////////////////////////////////////////

void main ()
{
   
}


Now you should have a working camera in your map. Give it a shot. Compile that map and run it.

Now, get it yet? Maybe not. Don't worry I am gonna try to avoid leaving you in the dark. Here is a quick run through of how it all comes together to create a "cinema".

First you load the map.

Now, when the player comes in contact with the trigger the call key is referenced. This calls the function camera_1.

sys.setCamera($camera_spline01); is executed. The game looks for the pathfile key in the entity camera_spline01. The value is the name of your camera file. The camera file contains the path and point of aim data for your camera. Once this data is loaded it switches the view to that of the camera.

$camera_spline01.start(); will execute. This will set the camera and its point of aim in motion.

sys.fadeIn( '0 0 0', 0.75 ); will execute. This will set the view to the color black and fade in to normal over a period of 0.75 seconds.

sys.wait(10); will execute. This will halt the execution of any other script for a period of 10 seconds. This is also the length of the cameras movement.

sys.firstPerson(); will execute. This will return the view to that of the player.

sys.fadeIn( '0 0 0', 0.75 ); will execute. Again this will set the view to the color black and fade in to normal over a period of 0.75 seconds.

Conclusion

Now, do you get it? I hope so because I don't know how to explain things better. Anyway, post your questions and I will try to answer them.

Have fun making cameras. :)



BNA!@Posted: Sun Apr 20, 2003 11:17 am :
Damnit rich - you are the man and you know that!

Many many thanks - I have a very great interest in Doom3 camera work, so your quality tutorial comes eastereggshaped and godsent!

As soon as I'm finished with the darn Doom3 database I'm digging into all the scripting issues - can't wait!



Zapp@Posted: Sun Apr 20, 2003 7:21 pm :
Yes great tutorial.. im sure many more will come soon.'


On another note: Spline Type Cameras are very buggy and do not work in game. I do not suggest wasting your time trying to make them work. I wasted a good hour trying to get it to work. No luck. Make sure to save your map before you make a camera for your map. The function is very buggy.



rich_is_bored@Posted: Sun Apr 20, 2003 11:10 pm :
Hey Zapp, I can send you a working copy of a Spline camera if you like.

It's not the spline camera type that is buggy. It is the Camera Inspector itself.



Rayne@Posted: Thu Apr 24, 2003 7:55 am :
I've tried to figure out camera's stuff on the last two months, and I've used spline for practice, but now i'm workin on " .md5anim files" for creating cameras in Maya (the way ID use to work on cinematics) but I can't export .mb to md5 'cause The engine tell me "Mayaimport is not loaded" like this http://www.doom3world.org/phpbb2/viewtopic.php?t=820


Now, Thanks RICH! Image sys.firstperson MAKE THE DIFFERENCE!!! :shock: I've missed it! :x


Please, help me with the mayaimport problem, so i can post how to make cinematics with md5 files! :cry::cry::cry:



rich_is_bored@Posted: Thu Apr 24, 2003 8:04 am :
Hey, nice to meet you finally. :D

I'm afraid I have no idea how to convert Maya format to MD5. I don't own a copy of Maya. I wish I could help you.

All i can suggest is that you add a post of your own to that thread you linked to in your last post and keep tabs on it. I am sure someone in this community has some experience and can assist you.



Rayne@Posted: Thu Apr 24, 2003 8:28 am :
I'm spending nights mapping with zapp, and to figure out how to solve this fucking problem...


By the way, I know scripting now, thanks for your tutorials! They rocks! :wink:


I've just readed this http://www.doom3world.org/phpbb2/viewtopic.php?t=838 so...

For now, Fred Nilson use Maya to make a camera, but i don't know if he use joints to attach and move it around, or simply a normal path animation... But, if you look in radiant, there are three func_camera stuff...

One of these is the func_cameraspline , another is just something like func_camera , and if you look in the description, there is something like

Key "joint" description "the joint to attach the camera"


I hope to fix the maya problem soon...


Ps: the D3X forums are dead... You can post tons of image, but if you missing the "idea", there is nothing to do... :wink:

This Forum is really great, 'cause even without images, maps, etc is the best for a DooM modder. Great work.



Dj Dooms Day@Posted: Thu Apr 24, 2003 9:03 am :
hey nice tutorial! :wink: keep em coming!



BNA!@Posted: Fri Apr 25, 2003 4:49 am :
Rayne wrote:
For now, Fred Nilson use Maya to make a camera, but i don't know if he use joints to attach and move it around, or simply a normal path animation...


The .md5.xxx files are plain text - you can open them with a text editor and get a feeling how he did it. Might be an a bit cryptical hackers style approach to gain insight, but I'm sure it'll add to the deeper undesrstanding hence it'll turn you into a better mapper later.

Quote:
Ps: the D3X forums are dead... You can post tons of image, but if you missing the "idea", there is nothing to do... :wink:


Wasn't the D3X forum an attention seeking attempt which turned into a try to establish a real forum? I mean NIZMO was rather bigmouthing here and had no problem to sling dirt on us on his forum literally screaming how leet and cool he is and how much we suck.
Quote:
This Forum is really great, 'cause even without images, maps, etc is the best for a DooM modder. Great work.


Thanks - great compliment for the people who post here, write tutorials, provide support and so on!

I found out that the quality of the posts and the posters skyrockets once you're limited to explain / describe a problem / solution without an image.
This forces you to really think first and post later.

Keeps the attention seekers away too :)



rich_is_bored@Posted: Sun Apr 27, 2003 10:08 am :
Just a heads up to those of you who are playing with this and don't want to change your resolution so you can see all the buttons....

Be very careful undocking the toolbar from the editor. If you don't dock it properly when you close the editor it will disappear. You'll have to edit your registry to get it back. I learned the hard way. Heh. :D



BNA!@Posted: Fri May 02, 2003 8:28 pm :
Just had the chance to test out the camera tutorial - works great!

Did set up a corkscrew cam around my player as fixed target, funny stuff and quite intuitive to use.

A little sidenote:

The first and the last point you set as spline curve controll points are head and tail controlls to tweak the camera direction at the end and beginning.
So if you make your camera, place the second point at where you want your ride to start and the pre-last point where you want it to stop.

The first and last allow you to let the path begin / end without unwanted curvatures.



rich_is_bored@Posted: Sat May 03, 2003 2:25 am :
I wasn't too sure what those two points were for. Thanks. :)

Of course, we still need to figure out how to create the maya based cameras.

But as a side note, I know there are three axises to control rotation on a typical camera. You have Heading, Yaw, and Pitch. You have no trouble making cameras with heading and pitch adjustments however how do you adjust yaw?

Any ideas?



BNA!@Posted: Sat May 03, 2003 5:39 am :
rich_is_bored wrote:
Any ideas?


No, but how do you adjust the heading and the pitch?

A few questions:
- how can I let the cam wait on a position
- how can I tweak the path for smoothness
- can I set "keyframes"



rich_is_bored@Posted: Sat May 03, 2003 6:20 am :
BNA wrote:
No, but how do you adjust the heading and the pitch?


You've been fooling with the heading and pitch without realizing it. When your camera pans left and right it is adjusting the heading. When your camera tilts up or down it is adjusting the pitch.

If your camera rotated on its side that would be yaw.

BNA wrote:
A few questions:
- how can I let the cam wait on a position
- how can I tweak the path for smoothness
- can I set "keyframes"


I'm not sure how you could do these either. Hmmmph :?

If or when I get sick of trying to figure out guis I'll play with the camera system some more. I might figure some more stuff out. I dunno. :roll:



rich_is_bored@Posted: Sat May 03, 2003 6:31 am :
I decided to take a quick look at the camera inspector for the hell of it.

There is a small listbox at the bottom of the camera inspector called "events". To the right of it is an add and delete button. Directly above is your camera's timeline. If you click add you will see some events like "speed", "wait" and "feather". Thats probably what your looking for.

I figure you click the right and left scroll buttons on the timeline to advance or backtrack your camera to the time you wish for your event to take place. Then you would add your event one at a time. What the parameters are... hell if I know.

Anyway, if your up to it go ahead and put on a labcoat and do some experimenting. :wink:



BNA!@Posted: Sat May 03, 2003 8:26 am :
rich_is_bored wrote:
Anyway, if your up to it go ahead and put on a labcoat and do some experimenting. :wink:


I wish id software would show a heart and hint us the scripting functions :)

But so far I'm pretty pleased with the camera system.
It's a bit annoying to delete path control points manually from the .camera file if needed, or to add them manually some place within the existant path, but hey - no one has asked us to mess with it!

While looking at it I don't wonder why id software has created their cameras with animations :)



BNA!@Posted: Sat May 03, 2003 9:17 am :
rich_is_bored wrote:
What the parameters are... hell if I know.


You just enter what seems most fitting :)

To change the target, just enter the new target name, to wait enter the wait time in seconds and so on.

Haven't figured out many of the other things, but some challenges need to stay with us, don't they?

Fred Nilsson was right when he said gamers coul create movie like quality cinemtics.



Rayne@Posted: Sat May 03, 2003 9:42 am :
BNA! wrote:

Haven't figured out many of the other things, but some challenges need to stay with us, don't they?


:wink:


Some events are buggy, and crash the editor every step... But the product is very very nice!

I'm working with a friend (that has Maya 4.0) and trying to figure out the cinematics stuff with joints... Mmhhh sounds criptic!

But I've not so much time, studing bass, working, three bands... :x

Hope I find the way...........



BNA!@Posted: Sat May 03, 2003 9:44 am :
Rayne wrote:
Some events are buggy, and crash the editor every step... But the product is very very nice!


I agree that the camera inspector isn't in it's final stages.

Can you tell me please which events crash your editor?



Crisis@Posted: Sun May 04, 2003 1:44 pm :
the camera tools seem pretty easy. Are they done the same as in RTCW with externam .camera files? Or is it slightly different? I just wanna know cause RTCW cameras are easy to do and D3 uses the same editor so I put the 2 togther and I am hoping its the same.