Panning & Magically Appearing Text

Tutorial collection, comprehensive listings on main site.

Panning & Magically Appearing Text

Postby Tutorial on Tue Aug 18, 2009 6:57 pm

category
General Half-Life 2/Effects

description
Create text that magically appears when a camera pans past an object. Useful for introductory credits or a main menu.

keywords
panning, text, camera, effect, point_viewcontrol, train, track, path_track.

Hi!

I'm going to show you how to create text that magically appears when a camera pans past an object between them. This'd be useful for introductory credits or a main menu.

The finished product looks like this (High-Def):



Image

Alright, first off, we're going to make a little train that travels from point A to point B.
Figure out where you'd like the pan to start, and place a path_track there, and name it train_point01. Place another path_track where the pan ought to end, and name it train_point02. Go back to train_point01 and make sure it's "Next Stop Target" points to train_point02.

Now, you have two choices, and it doesn't really matter which one you choose: either edit the angles of both path_tracks so that they face in the direction you'd like the camera to face whilst panning and change the "Orientation Type" of both to "Face this path_track's angles," OR face the camera itself the correct way (once we've made the camera, of course), and set the path_track's "Orientation Type" to "No change." Again, doesn't really matter which you do, they oughtta have the same end result.


Image

Now, before we make the camera, we need to make the train that it'll be parented to. Create a simple brush textured entirely with tools/nodraw, and place it somewhere. For convenience, I've placed it right on train_point01, so I don't have to worry about how or when it's going to move to the first point. As usual, name it something snappy and memorable, like train. Make sure it's "First Stop Target" points to train_point01, then go ahead and set the max and initial speed to whatever you want. 32u/s is what I've used in the example video, but if you want a really slow pan, try something like 16u/s or even 8u/s.


Image

Finally, time to make the camera. Actually, it's a point_viewcontrol, but I like to call it a camera. I've even named it camera. Create one of your very own, name it, then parent it to train, or whatever you named your func_tracktrain. Make sure only the "Freeze Player" and "Infinite Hold Time" flags are ticked.


Image

Create an info_player_start and a logic_auto. I like to keep them near each other, but you don't have to. We're going to add two outputs to the logic_auto: the first being OnMapSpawn Enable camera with a delay of 0.00s, and the second being OnMapSpawn StartForward train with a delay of 0.01s. If you can't understand that syntax, have a look at the screenshot.
If you want, you can now compile the map and watch your camera pan aimlessly.


Image

Alright, now we have to make some text to display. Make sure they are on a plane perpendicular to the camera; parallel to the direction of motion of the func_tracktrain.
For testing purposes, I've carved these letters our of separate world brushes. Texture ONLY the front faces of these brushes with something (I've used lights/white here, even though it's not going to be casting light), and put tools/nodraw on all the other faces.


Image

Turn each letter into a func_rot_button, and rotate them 180 degrees around the Z-axis. If you've applied some kind of custom texture to them, turn on texture lock before you rotate them (just remember to turn it back off when you're done).


Image

Give each letter a unique name (it helps if they go in numerical order, because many words end up repeating letters), parent each to train - your func_tracktrain - and set "Distance" to "180." Set "speed" to something relatively low; 720d/s or so. I have it set to 2280 because I've gotten the timing correctly (more on this later). Do this for each letter, and remember that the only setting that's going to change from letter to letter is it's name.

Remember also to change "Delay Before Reset" to "-1" so that the letters won't flip around again, and change "Sounds" to "Silent" so that it won't make any noise when moving.


Image

Create a func_physbox behind each letter, covered with tools/nodraw. All of these will be parented to train rather than to the letter. Name them - again, each name must be individual - I've chosen just to append the letter's name with _helper. Make sure "Disable shadows" is set to "Yes," set "Strength" to "1," and "Material Type" to "None." As far as Flags go, make sure "Break on Touch," "Break on Pressure," and "Break immediately on Physics" are all ticked. To be entirely honest, I'm not sure all these are even needed, but it doesn't hurt to have them.

Now, this next part might be a little confusing, but it will make sense in a bit. For each func_physbox, add the following output: OnBreak Press X with delay 0.00s, where X is the name of the accompanying letter. For instance, letter1_helper would have an output of OnBreak Press letter1, letter2_helper would have an output of OnBreak Press letter2, and so on.


Image

Hopefully all this will begin to make sense now.

Create a thin trigger_hurt perpendicular to the path that train will be traveling along. It doesn't need to be named, but make sure it's doing "Damage Type" of "Bullet." For flags, tick "Pushables," "Physics Objects," and "Everything."

Image

This trigger should be behind some vertical object that the camera will pass close to; in my case, a pillar. You could use a wall, tree, or person, but situate the trigger such that when the camera is facing the midpoint of the vertical object, the trigger is completely obstructed from view.

In the screenshot here, the path the camera will travel is the orange line at the top, the green rectangle near the bottom with the beveled edges is the pillar, and the trigger_hurt is the purple box at the very bottom.

So, to explain what's going on here; the train is moving down the path, carrying the camera and letters and letter helpers with it. As the letters and their helpers pass the trigger, it destroys the helpers, and when the helpers die, they cause the backwards-facing letters to rotate 180 degrees, becoming visible.


Image

Earlier I mentioned that it was a good idea to set the rotation speed of the buttons to a low number.

Well, go ahead and compile your map, and watch it run.

First, you'll notice that some of the letters begin turning too soon and some turn too late; this is because of the position of the helpers relative to the letters. The helpers need to be moved towards the center of the text span; as for how close to the center each individual helper needs to be moved, you're gonna have to do a little guesswork. I'm sure there's some sort of trigonometric formula or equation that could be used to easily determine how far each helper needs to be moved, but I'm too sick of trig at the moment to attempt to find one.

Keep the rotation speed low until each helper is in such a position that you cannot see it rotate at all by the time it emerges from behind the pillar.


Image

Remember when we made the text, a few steps ago? Well, if you want to use a specific font for your text, you can create a texture with a transparent background, apply it to one long brush, then chop that brush up with the knife/clip tool, and then turn each of those into a func_rot_button, again using texture lock to ensure the letters don't flip around or become misaligned.


Image


Now, repeat the same steps as with the brush-based letters, and you'll wind up with something like this

(High-Def):



That's about it for now - I hope I've given everyone plenty of ideas! If and when you create something involving or building off this technique, please share your results!

- dissonance
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Re: Panning & Magically Appearing Text

Postby source-maps on Tue Aug 18, 2009 7:05 pm

didnt read the tut but I saw this in an other thread a while back and I thought it would be awesome if the text disappeared if the camera reached another pillar

btw cool tut... Im going to try this out in l4d
User avatar
source-maps
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Feb 09, 2007 7:50 pm
Location: The Netherlands

Re: Panning & Magically Appearing Text

Postby TicTac on Wed Aug 19, 2009 8:38 pm

You could easily make it disappear again, just repeat the process for pillar#2
Competent Level Designer, 3D Artist.
I don't really look like my avatar
User avatar
TicTac
Veteran
Veteran
 
Joined: Sat Aug 02, 2008 1:30 am
Location: Philadelphia

Re: Panning & Magically Appearing Text

Postby Armageddon on Wed Aug 19, 2009 8:59 pm

Well here is my test map of this. I made it a whole mod!

http://www.filefront.com/14280053/mod.zip/
User avatar
Armageddon
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Sun Dec 14, 2008 5:53 am

Re: Panning & Magically Appearing Text

Postby FlynT on Fri Aug 21, 2009 9:33 pm

Awesome Dude! Simple but very useful indeed :)
Image
*Ahhrr, my Nipples they Hurt, they Hurt when i twist them*
User avatar
FlynT
Been Here A While
Been Here A While
 
Joined: Sun Jun 15, 2008 2:59 am
Location: Germany

Re: Panning & Magically Appearing Text

Postby chargers5583 on Mon Aug 24, 2009 9:15 pm

nice to know
User avatar
chargers5583
Member
Member
 
Joined: Thu Mar 12, 2009 3:22 am
Location: Home of the CHARGERS

Re: Panning & Magically Appearing Text

Postby MMmaster on Tue Sep 08, 2009 6:19 am

Good idea and nicely written tutorial, but I always ask myself is this the most optimal way of doing it or is there a better way?
The method explained above involves a lot of entities and their many interactions (damaging, turning)

You could achieve the same effect with the use of a multi layered texture where one layer would be transparent and the others would be the needed letters, then you would use some env_texturetoggle entities to set the texture index from the invisible one to the required letter when the brush passes behind the pillar.

I guess this would be more optimal as:
- it could be created with less work/in less time in the editor,
- would use fewer entities,
- would eliminate the damaging and turning of entities.

On the other hand you would have to time the texture index changes precisely:
- with delays, (takes long time to set precisely, and hard to modify later)
- simply with many path tracks next to each other, (the camera train activates the texture changes as it passes before the pillar)
- or you could use a trigger behind the pillar (same as in the tutorial) to increment a math counter with every letter passed and use the OutValue to activate the branches of a LogicCase and set the appropriate env_texturetoggle indexes in sequence.
MMmaster
Member
Member
 
Joined: Fri Apr 17, 2009 2:17 pm

Re: Panning & Magically Appearing Text

Postby Captain Terror on Mon May 23, 2011 9:51 pm

Great tutorial! I like the method you used to make the letters "render". =)

Btw, i don't understand how you got the point_viewcontrol to parent to the tracktrain without doing anything fancy. The only way i can get it to parent is to use a logic measure movement and a env_spark to mark/measure the location of the point_viewcontorl, and then parent the env_spark to the train.

Anyway, very interesting stuff!
Captain Terror
Regular
Regular
 
Joined: Sat Jan 24, 2009 9:19 am

Return to Tutorials

Who is online

Users browsing this forum: No registered users