Cleanup is going to take awhile, so the site is back up but editing has been disabled.
Cameras
From HalfLife 2 Knowledge Base
by RomeoJGuy
This tutorial teaches you how to make a basic camera and monitor system
Contents |
Prerequisities
- Basic Room Knowledge
- Basic Entity Knowledge
- Entity Input/Output System Knowledge
Required Files
Additional/Optional Features
Breakable Screen: To add a breakable screen just make a brush with nodraw textures on all sides and tie it to a func_breakable entity. Also parent it to the monitor_screen. Next go to the func_breakable's Output tab and add a new output. For its name give it OnBreak, for target entity select monitor_screen and for input used select kill.
Dynamic Light: Add a light dynamic to your map, and line it up to the centre of the screen facing the same direction as the screen. Set the Light Color to 80 113 226, and set the Light Brightness to 4. Make the parent the monitor_screen and now you have a light that is given off by the monitor.
Modifying Resolution of the Camera Feed: To modify the resolution of the camera is somewhat complex process. First youll need to fit the monitor texture to the face of the screen. If you are going to increase resolution it is best to do it by numbers that can be easily divisible into each other. Like 512 divided by 256 is 2. So if you use 512 then the scalar factor is 2. The scalar is important because the Monitor texture is designed to receive a 256x256 camera feed. Therefore if you set the resolution to 512x512 the camera feed will be bigger than what the screen displays. Therefore you have to use the scalar factor on the textures scale to get the proper scale on the texture to show the whole camera feed. So following my example with 512, I would divide the texture's scale by 2. After compiling you should have a higher res picture of the camera feed.
ViewScreen in HUD: Lets say your making a futuristic map where the player has a built-in camera in the HUD. To add a veiwscreen to the HUD, when in-game, type mat_showcameraendertarget 1 into the console. But that only works if you type it in every time you play your map. (Will be updated with the new source entity point_clientcommand)
I will update with Zoom feature soon.
Textures and effects
The texture used on the monitor brush produces visual effects on the camera view. The simplest is dev/dev_tvmonitornonoise which produces an un-altered picture from the camera.
The standard HL2 textures are:
- dev/dev_tvmonitornonoise - normal picture
- dev/dev_tvmonitor1a - vertically moving light/dark bands
- dev/dev_tvmonitor2a - 'Matrix'-style black & white picture with crawling dot noise
- dev/dev_combinemonitor1 - bright translucent with checkerboard noise
- dev/dev_combinemonitor2, 3, 4, 5 - progressively darker versions of combinemonitor1
- dev/dev_combinemonitor_r, _g, _b - green, red and blue tinted translucent pictures (note red and green are swapped)
The dev_combine* textures work best with a dark brush behind them. The dev/dev_monitor texture does not directly work as a monitor target.
If you are creating your own monitor texture, the identifier _rt_Camera should be set as the $baseTexture in the texture's .vmt file. In this case, the dev_monitor texture can be simply made to work by creating a .vmt file for this texture.
Other camera features
Instead of using func_monitor, you can use an info_camera_link point entity. Set the entity's Camera Name to the name of the point_camera entity, and the Entity Whose Material Uses _rt_camera to any brush entity or model entity using one of the special textures (a func_wall will work). Both func_monitor and info_camera_link can be activated with a SetCamera input, to allow switching between multiple cameras.

