Rayne@Posted: Fri Aug 13, 2004 6:04 pm :
Hi to all, this is my first “little tutorial” so please, don’t be harsh and have patience! :wink:

Ok, I'll try to introduce the “security” cameras of DooM, a cool feature that hit me since the first time i saw it! I’ve spended a lot of time finding good ideas to implement this system to map, and just thought how cool will be if in a multiplayer map, you can just watch your enemy by monitors to know where he’s hidin’.

Basically, we have 2 items that works for that purpose: a func_securitycam with attached a model of a... ehm... camera :D and a GUI that will display what the Camera see.

If you want to skip this part about creating the GUI, you can go directly to the second part of the tutorial, the “in-editor” part.

Creating a GUI that fits our needs

Since I really hate to use the default ID GUI that can show up the camera view (it’s only a material parameter afterall) I’ve created a quick and dirty GUI to fit my needs. I assume you have readed the superb tutorial from ZEH HERE so basically you can import your own assests in a GUI. I’ve created two simple tga images that looks like this

Image


I saved the pic above in two separated files, one for the green lines and one for the red text, so I can make a little effect later in my GUI. (REMEMBER TO SAVE an additional channel for the alpha information in each .tga file)

Ok, let’s start the GUI EDITOR (i hope you know how to launch it! Make sure you have DooM running in windowed mode, and in the console type editguis ) .

Choose “file -> new “ and you must have something like this

Image


Let’s create the first windowdef (rightclick on the grid and select “new-> windowdef” and in the trasformer window, set the new window size to W(idth) 640 per H(eight) 480 since we want the video fit all the GUI screen. Now, set the properties of this new window: under the GENERAL tab set the name of to something like “video_layer” .. Check the NOCURSOR box (in this case we don’t need any cursor on our GUI) . Now, in the IMAGE tab, select “material” and write in the field the following line

textures/cameraView1

and hit OK. Nothing happened, but it’s normal, cause this layer of the GUI will be updated in real time in the engine, so there are no texture to show up, only the 3D view from the camera entity! :wink: Now, i create a new 640x480 window def and apply on it my green lines .tga.. I have now something like this:



Image


Let’s add another windowdef and apply the red REC text ( for this the size is 129x50 ). Now, we are going to add a little script in this layer of the gui, cause i really liked if my rec text will blink from invisible to visible every second..so use right muose button on the layer of your red text stuff and select the “script...” option. Will popup a simple window, like notepad so we can write a script we like. Add this script

Code:
onTime 900
{
   set    "cam_rec::visible" "0" ;
}

onTime 1800
{
   set    "cam_rec::visible" "1" ;
   resetTime "0" ;
}



where “cam_rec” is the name of my layer with the red stuff, so basically, after 900 ms the layer cam_rec will be set to “visible” “0” (invisible). After 1800 ms it come back visible... click on X to close the window

For a little more eye candy, we finally add the last windowdef (size 640x480) and apply to it the following material

gui/static


This will add the snowy effect, some trasmission noise.. with the alpha slider, you can tweak the trasparency to adjust how strong the effect will be.

Image



Save your GUI, and you can now close the GUI editor.



RADIANT STUFF (setting up camera)

Ok, launch the editor, and open your map. First thing first, we need “a screen” where our camera will trasmit data. You can use every func_static that can display a GUI. I choose this model cause I really like the monitor

models/mapobjects/com/modconsole6.lwo

Image


EDIT: Ok, this is the update for all problems (see for this for more explanations ).
Create a simple patch mesh, and place it on the screen of your desk, leaveing 0.5 units between the patch mesh and the monitor (to avoid z-fight)... Make it func_static, and apply our new gui on it hittin the GUI... button in the entity menu... Done? Ok, now simply assign to our patch mesh this texture

textures/cameraimg


( IMPORTANT: IF YOU JUMPED THE FIRST PART FOR CREATING A NEW GUI, CHOOSE THIS GUI INSTEAD guis/cameras/cam_on.gui )


Image



Let’s continue: we got a screen, a GUI to display stuff, now we need... YES! The Security camera!

Place a func_securitycamera in your map, and assign a model to it. ID obviously use

models/mapobjects/camera/camera01.ase

ATTENTION: when you have your func_securitycam in your map, with the model attached, you can notice that sometimes the white arrow of the entity (the direction that point the view) will not point in the same direction where the camera model is oriented (depend on how the model is built in the original 3D package).You have to specify which axis will use the entity camera, to match the direction of the model. To do this use the modelAxis keypar with a value of 0 1 or 2 ( 0 = x 1 = y 2 = z ).

EXAMPLE: Let’s say your func_securitycamera is pointing the y axis, and your camera model point in the x axis: I add “modelAxis” “0” so the entity know that my model are pointed on the x axis. For last thing, sometimes when you specify the axis to your entity, it will use the opposite axis direction (for example, you want to point the camera to the X+ axis, so you add modelAxis to the entity, but the view is headed on the X- axis) . In this case, add flipAxis 1 in your entity so it flips the view on the opposite axis..

At this point you can adjust the fov of the camera, the viewdistance and the sweepAngle (the camera will rotate back and forth by a number of degrees you specify with this command)play 2 mins with that stuff.

Last thing (really): we have finally to tell to the GUI to show the data of the camera view in the video_layer (remember?) Select the patch mesh and add


Key: cameraTarget
Value: name_of_the_security_cam_entity

Very self explanatory.. Now save your map, compile it, and say “hello Mom! I’m in tv!” :D

Image



BNA!@Posted: Fri Aug 13, 2004 7:05 pm :
Nice one!



Magical Gnome@Posted: Fri Aug 13, 2004 9:00 pm :
Very neat... I'll have to try this. I believe people have also asked about this before. Nice work! :)



six_storm@Posted: Fri Aug 13, 2004 11:19 pm :
Nice tutorial man, I still have some problems. I did EVERYTHING that has been listed and I still can't get it to work. Can someone help me on this? I've been trying different tutorials and ways to get it to work and still no progress. Thanks for your help.



six_storm@Posted: Sat Aug 14, 2004 3:24 am :
Thanks for helping, I thought you guys knew how to get this to work? Oh well, so much for asking for help.



Rayne@Posted: Sat Aug 14, 2004 5:30 am :
six_storm wrote:
Thanks for helping, I thought you guys knew how to get this to work? Oh well, so much for asking for help.



exactly, what is your problem?



RedWolf@Posted: Sat Aug 14, 2004 6:39 am :
Don't feel bad I can't get it to work yet either.



Rayne@Posted: Sat Aug 14, 2004 6:44 am :
Yes, but if you tell me what is your problem (what goes wrong when you try to let it work) I could help you :lol:


If you tell me only "don't work" I can't help ya :wink:



psychonub@Posted: Sat Aug 14, 2004 11:48 am :
im having the same problem. was tinking with it for like 2 hours lastnight with no luck. ive tried all the modelAxis and the flipAxis. didnt get any errors it just didnt work



RedWolf@Posted: Sat Aug 14, 2004 2:25 pm :
Ok, Thanks for trying to help Rayne.

I've also spent hours, with several dif options, checking (I think) evervy avail option. It seems to me that it could be just a simple issue. For instance on the storage cabinate tut, Some people were haveing problems over a simply have the patch a "func_static" or not , being the dif, of weather it worked or not.

First off, I can't seem to get the camera model to rotate at all, even after a save, and reload of the map. I've tried every concievable way of linking the camera to the monitor/gui/com model. Including cameraTarget, and target, and using ctrl+k selecting each brush first several times. I can see the cam_on gui on the model. I've changed the fov, and dist settings.

I get nothing. Btw, I can get the entitys linked via the line (you can see the line linking them)


Things that would be nice to know.

1. Does the model have to be correctly aligned to the direction of the white arrow in order for this to work?
2. Do any default settings need to be added or altered for this to work?
(Such as fov, dist, rotation ect.)
3 Is it posible you missed a tiny detail (or taken for granted that we know something or a setting ect that would normaly be on/off) in your tut?


TIA, BTW could you maybe explain how to get the model to rotate, I've never done it with entity keypairs?

Also, I had the same Idea as, I've a got a door to room where I thought a camper might be, and if you go in the door your really going in "blind" Since I didn't design it to be a camping spot as you come in the door, I though it might be nice to have a camera monitor by the button that opens the door so you could see if there was someone waiting when the door opens... In my multiplayer map. (Also showing that I can link a gui/model to another entity correctly)



six_storm@Posted: Sat Aug 14, 2004 3:08 pm :
My problem is that I can get all the keys and values right, but nothing appears on my screen. There has to be something that you've missed on your tutorial, no offense. I tried three or four different times and I've had no luck with it at all. If you can, edit the tutorial in more detail. That would really really help. But thanks on giving us this info bro.



powmia@Posted: Sat Aug 14, 2004 10:36 pm :
ITS NOT CAMERA ON thats why thanks dude for not responding.



six_storm@Posted: Sun Aug 15, 2004 9:21 pm :
The GUI isn't camera on? You didn't make any sense at all. I guess no one besides myself wants to know how to get this to work. Oh well, mapping is starting to suck sense nobody knows how to work the frickin editor lol. It's cool, I'm not worried.



dmc1078@Posted: Mon Aug 16, 2004 9:32 am :
Anyone know what level the Camselect.gui is on? I haven't played single player much.

Since I can't get a single cam working with the instructions above, I wanted to model my cams off of how ID used the camselect.gui.

I've tried making 2 GUI's: One has camselect.gui, and the other is the gui for the camera display ( I forgot the name now of the .gui, but it's in the comments when you select the GUI model in the editor ). I have it working to the point where I click on a camera selection on camselect.gui, and the display changes on the guicam entity, but no video displays.

I called my camera Cam1 like the comments say, and tried pointing it at guicam with cameraTarget = guicam, but no luck. I'm basically having the same problem as trying to use the tuturial above-- My camera display GUI doesn't display video.



RedWolf@Posted: Mon Aug 16, 2004 12:07 pm :
Tried that too. Stoped working on it for a bit, But when I figure it out I'll let you know



doxxan@Posted: Mon Aug 16, 2004 12:31 pm :
Hey guys, I've finally gotten this tutorial to work. I placed a func_static inside the func_static that was holding the display. I then textured it with "cameraimg1". Last, I added "cameraTarget" key to the func_static. Tadaa. Don't really know why this is needed. One thing though, you must make sure that the cameraimg func_static is in view at all times aslong as you can see the display (not visible, hide it somewhere, like inside the display like I did), otherwise the display will only show a static image.

Hope this helps.



six_storm@Posted: Mon Aug 16, 2004 1:16 pm :
So . . . let me get this straight.

1) Create a func_static inside (in my case, flat monitor).
2) "Texture" with Cameraimg1
3) Create a func_securitycamera with camera01.ase model
4) Name actual camera (Ie "mycam")
5) Add the "cameraTarget" key with the "mycam" value to flat monitor.

Sound about right, doxxan? I tried looking on Id's game levels and trying to figure them out bu tno luck here. Keep fooling around with it guys, we'll get it to work soon enough . . .



doxxan@Posted: Mon Aug 16, 2004 1:24 pm :
yeah, exactly. I've just tried to skip "targetCamera" on the monitor. It works without it. The "targetCamera" key needs to be on the cameraimg func_static though.

So, checklist:
(quoted from six_storm)
1) Create a func_static inside (in my case, flat monitor).
2) "Texture" with Cameraimg1
3) Create a func_securitycamera with camera01.ase model
4) Name actual camera (Ie "mycam")
5) Add the "cameraTarget" key with the "mycam" value to flat monitor.

This should work flawlessly. Oh yeah, the gui on the monitor, needs to have a windowDef with "textures/CameraView1" background. See origional post.



six_storm@Posted: Mon Aug 16, 2004 1:36 pm :
I just got a PM from a guy at PlanetDoom and here is what he said:

I'm not the greatest at indepth explanations but i'll try

First create a brush then goto patch>simple patch mesh.
http://lonnie.creativemediaart.com/imag ... epatch.jpg

Apply the cameragui texture textures/cameraimg1
then with the patch selected press S to load the surface inspector and
hit the fit button W=1 H=1
i'm not sure if fitting it to 1 is necessary

Now with the patch selected right click in the viewport and select func>func_Static
http://lonnie.creativemediaart.com/imag ... static.jpg

Add the key cameratarget with the value of the camera name

then resize and position it as you want and that should work

I hope i didn't miss anything

http://lonnie.creativemediaart.com/down ... amera2.pk4
this map should help some


I'll have to try this when I get home. I still got another 5-6 hours before I get to go home. Thanks doxxan for the help. Peace.



doxxan@Posted: Mon Aug 16, 2004 1:51 pm :
ok, I've tried that and it works. The thing is, you still need to
#1. look at it for the display to work
#2. resize and hide it somewhere where the player will look, preferably inside the monitor.

oh well, atleast I've gotten security cameras to work :)

pic:
Image