Mapping:Adding a camera to your map

From Custom Map Makers Wiki
Revision as of 16:14, 21 August 2011 by John (talk | contribs) (Connect the entities together)
Jump to: navigation, search

A portal consists of 3 to 4 objects.

First you have an object is a brush you want to be the "viewer".

Then you have 2 entities, the misc_portal_surface and the misc_portal_camera.

This tutorial also uses an entity of target_position which is used to aim your camera, although you can give your misc_portal_camera an angle to aim instead.

Images

Download the following zip file Images it contains 2 images. Extract them tore these in your images folder.

Shader

Add the following shader to your shader file, you should change the paths to match your map.

textures/myfirstmap/tvscreen
{
	qer_editorimage textures/myfirstmap/monitor.tga
	q3map_lightimage textures/myfirstmap/monitor_colour.tga
	q3map_surfacelight 1200
	portal
	{
		map textures/myfirstmap/monitor_colour.tga
		blendFunc filter
		depthWrite
	}
	{
		map textures/myfirstmap/monitor_colour.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		alphagen portal 256
		rgbGen identityLighting	
	}
	{
		map textures/myfirstmap/monitor.tga
		blendfunc blend
	}
	{
		map $lightmap
		blendfunc filter
	}
}

Create a TV screen

Create a simple (detail) brush in your map where you'd like your TV to be.

Tut camera create tv.png

Texture the top and sides, perhaps the bottom if anyone is likely to look there.

Tut camera texture tv.png

Select the front face, the actual screen of your TV

Tut camera select face.png

Apply the monitor.tga to this face and fit it to size.

Tut camera front.png

Create the entities

First of all create an entity of misc_portal_surface and place it within 64 units of your "tv scren" surface.

Open the entity inspector with the misc_portal_surface selected (Press N) and enter

key   : target
value : screen1 

Tut camera item1.png

Then create a misc_portal_camera and place it in the other room.

Again, with this selected press N to open the entity inspector and enter

key   : targetname
value : screen1
key   : target
value : camera1

I am also going to us a target_position to tell the camera where to point. It is also possible to just give the misc_portal_camera an angle, but I find it easier to point it at a target.

Create a target_position where you'd like the camera to point, the values for this entity should be

key   : targetname
value : camera1

Tut camera item2.png

This should connect all the entities together and your map should look like this..

Tut camera connected.png