|
|
|
|
|
|
|
|
| Links |
|
|
|
Light Tricks - By Stadric |
|
This tutorial was last updated on Aug 20, 2006.
Part 1: Volumetric Light
There are four basic ways to make volumetric light, I’ll list them in order of how good they are, starting with the best.
For these examples, make a room, 512 units long and wide, but 640 units high. You have to give the model a lot of head room. Texture the ceiling of your room with the tools/toolsskybox texture, and add a light_environment entity anywhere on your map to get the full effect.
A Model
More specifically, the models/Effects/vol_light.mdl model.
This is definitely the superior method, the model itself is volumetric light, and it looks quite good if used correctly.
You’ve got a room, now make the prop itself: make a prop_static, and change the “world model” field to models/Effects/vol_light.mdl, then make sure it fits into the room you’ve made, and put it as close to the ground as possible.
This works best when it looks like it’s coming out of a hole in a roof, or a window, so I made a brush in-between the skybox and the rest of your room. Make a hole in the brush big enough to fit the model, using any method. Carving is discouraged as always.

Compile and run the map. It looks cool, but there’s no light source, you need to add that yourself, I recommend it.
A Point_Spotlight
This is by far the easiest way to use volumetric light, all it takes is a single entity, with its default values.
Place a point_spotlight entity in your map. By default, it’s pointing to the side, not down, which is where you want it to point, so rotate it(Ctrl+M) –90 degrees on Y. Now it’s pointing down.
By default, point_spotlights give off light, but that light is dynamic, which is a major drain on system resources, so we can get rid of that dynamic light by checking the “no dynamic light” flag in the entity’s flags. To replace the light that we lost by checking that box, we can put a light_spot entity in the same place as the point_spotlight, and that wil give off light instead. The light_spot’s default settings will do.
The light needs a source, so put in a prop_static, and place models/props_c17/light_industrialbell01_on.mdl in it’s “world model” field, then put the model above the point_spotlight and light_spot.
Compile your map and run it.
A Func_Illusionary
This method consists of a brush entity, textured right, that looks like shaped light.
First, make a window for the setting. Since we already have a room from the earlier example, we can use that one, by adding another wall, and adding a window onto that.
I used a model with the models/props_building_details/Courtyard_Template002_Window.mdl model.
Next, make a brush, and clip it so that it looks like it’s slanting out of the window, then texture it with the models/effects/vol_light001 texture on all sides that can be seen, and tools/toolsnodraw on all faces that can’t be seen.

You can improve the look of it by using the texture applicator tool(Shift+A) to rotate the texture on the sides of the brush to that it looks like it’s slanting with the brush. It’s very hard to see the texture using this method, so it takes good eyesight and finesse. If you have neither, use another texture, and rotate it until it’s slanting with the brush, then retexture the brush with models/effects/vol_light001.
Right now, you can still walk into the brush, so to remedy this, and give a little effect, we’re going to make it into a func_illusionary (Ctrl+T and select func_illusionary from the list of classes.
Give the func_illusionary these properties:
disable shadows: yes
Disable receiving shadows: yes(light doesn’t cast a shadow, or block shadows)
FX amount: 150 (experiment with this number, it determines your brush’s transparency)
Now the brush will render partially transparent, it won’t cast or take shadows.
For maximum effect, add a light entity right behind the window, a dark window doesn’t cast light.
Compile your map and run it.
This method works best from a distance, so don’t use it if the player can walk through it.
An Env_Particlelight
Combined with an env_smokestack, this can give a nice effect for illuminating smoke.
Place an env_particlelight in your map, anywhere, and then change the “color” property to 255 0 0.
Next, place an env_smokestack next to your env_particlelight, and give it these properties:
Length of Smoke Trail: 250
Initial State: On
Base Color (R B G): 150 150 150
Compile your map and run it.
I really don’t see the point of this method aside from two-toned smoke.
The End Result of All Four:

Part 2: Fake shadows
This is a pretty easy technique, once you get the hang of it. You can use this to make awesome shadows on walls, floors, ceilings, whatever.
Let’s begin, shall we?
Make a room, put a player start in it, yadda, yadda, yadda.
Divide your room in half with another wall, and put a square hole in it.
Fill the hole with another square, a standard window (all sides but the front covered in the tools/toolsnodraw texture). For the window texture, use the glass/glasswindow005c texture. Use the texture applicator tool’s ‘fit’ button on the side with the window texture on it.
For the last part of the setup, texture the wall on the side of the central wall without the player with the lights/white001 texture. This texture is special because it emits light, which will be used for the effect.
Now that we have a setup, it’s time to add the effect.
Right not, all we have is a wall with a window in it, it gives a pretty good effect, but that’s still pretty limited. We want a more highly-defined shadow from the window. Notice how the window has bars, but those bars themselves don’t cast shadows.
We can fix that.
The trick is a single texture: tools/toolsblocklight.
Go to your window, and make brushes that coincide with the bars on the texture. They don’t have to coincide, it just gives the best effect.

You can alternate the effect in two ways:
1) You can make the bars of tools/toolsblocklight bigger/thicker/whatever.
2) You can change the lightmap scale property of each face that you want the shadow on to a low number, this makes higher defines shadows, but the compile lasts longer, and it pulls on system resources.
For this example, I used both, I changed the lightmap scale to 8, and I doubled the blocklight bars in width.
The end result:

You can alter this further by changing the location of the light source, changing the type of light source, or the angle of the light source.
Example Map:
http://www.editlife.net/files/maps/example/stadric/LightTricks.zip
Still need help? Ask your questions in one of our HELP FORUMS
|
|
|
| Comments |
| Samuka97 - Dec 26, 2007 |
Wow man! Nice tutorial! I loved the window trick ^.^
Thx for the tut! |
| Limpet - May 5, 2007 |
| In CS that is... |
| Limpet - May 5, 2007 |
| The whitelight texture trick doesn't seem to work. |
| 3o - Apr 8, 2007 |
the second one im having trouble with... there are no flags witht the entity
otehr than that awesome stuff |
| Sentientv2 - Sep 4, 2006 |
| Great tutorial. I'll try to post what I come up with from what you've taught! Thanks a bunch. |
|
|
|
|