Cleanup is going to take awhile, so the site is back up but editing has been disabled.

Dynamic Lights

From HalfLife 2 Knowledge Base

Jump to: navigation, search

Contents


Intro

Dynamic lights seem to be the one light entity that causes most problems for mappers. Granted, it is one of the more tricky ones to use. Once you get the hang of it though, it is quite simple.

Basically what we have here is a light entity like anyone else, only it is dynamic, which means that it can move, and even more important; it has a parent field.

So lets have a look at it:

Getting Started

Make a room, place an info_player_start. Now make a prop_physics_override:

  • Worldmodel: 'props_c17/lamp_bell_on.mdl'
  • Name: 'lamp01'

Place it where you want it. Now make a move_rope entity at your ceiling:

  • Name: 'rope_01'
  • Next Keyframe: 'rope_02'

Make a keyframe_rope on top of your lamp:

  • Name: 'rope_02'

Parent it to your lamp ('lamp01'). Now; in Hammer you now have a lamp hanging from the ceiling in a cable, but if you compile and run, the lamp will fall to the floor. So we'll put in a phys_pulleyconstraint around the middle of the rope and as attachment 1 we'll choose 'rope_01', as attachment 2 we'll choose 'lamp01'. Now the lamp dangles at the end of the rope, and will react properly when hit with bullets (now some might complain that it goes nuts when shot at, remember you can alter the mass of the lamp).


Creating the light

Now to the light: Create a light_dynamic ent and place it right under your lamp:

  • Name: 'light_dyn_01'

parent it to the lamp. Now there is three fields in the properties of this entity that means something, and I'm pretty sure these are a stumbling block to most people w/ this entity: Pitch Yaw and Roll Light color and Light brightness

These are pretty simple: Make sure Pitch Yaw and Roll is set to "90 0 0" to angle the dynamic light straight at the ground. The Light color field acts as with any other light entity, its a hexadecimal for lightcolor and intensity (first three groups of numbers are the color and the last group is intensity).

Image:Lightdynamic1.jpg

Here I've chosen some yellowish light, but the last group of numbers (for intensity), is not needed and can be omitted (as I have done in the pic).

The intensity for dynamic lights are set in the other field, Light brightness. Here you choose a number between 1-10 (you *can* choose numbers higher than this, but things start to look weird then) I've chosen '3' as it works fairly good with what I'm doing here.

Image:Lightdynamic2.jpg

Now the big wireframe globe sets how far your light reaches (Maximum distance), you can pull the handles, or enter a number. It should reach beyond what floors and walls you have (to make the light shine on them). The angle settings work pretty much like they do for the light_spot entity.

Additional Adjustments

Angle is measured from a vertical line down (if Pitch=-90), this means that an angle of say 30 degrees effectively covers 60 degrees. Angle settings maxes out at 90 degrees ( as far as I can see its actually 89 degrees) effectively covering around 180 degrees. You can then adjust spotlight end radius to your room size. I havent been able to get one dynamic light to cover all 360 degrees, but if you really need to you'll just have to use 2. By default light_dynamic's shine downwards (Pitch -90), so thats good for this purpose.

If you look at the flags for dynamic lights there are four of these: No world light & no model light shouldn't need explaining. The other two had me puzzled for a while; but they're pretty obvious: These add or subtract alpha layers to displacement maps. The effect is demonstrated in the new addition to the test map, with a displacement map w/ a blended texture, now in the test alpha is SUBTRACTED, if I went into displacement properties and inverted alpha it would have to be ADDED. The effect is kinda weird, but I'm sure it will prove useful.

Now if you compile now, your map probably turns up as 'fullbright'. For some reason, if dynamic lights are the only light source, the compile skips them, as they are not 'direct lights'. You can change this in console (mat_fullbright 0), or just add a light_spot somewhere in your map (away from the 'dynamic lamp').

Now you're set. Get in there, and shoot that lamp.

Heres the example files:

http://nonpronoia.net/files/test_dynlitA.vmf

http://nonpronoia.net/files/test_dynlitA.bsp

  • Tutorial written by unsane


Dynamic Spotlight Beam

The point_spotlight entity can be used with or instead of the light_dynamic entity, allowing you to create a moving Spotlight beam. I say "with or instead of" because point_spotlight entities will create their own dynamic light by default unless the 'No Dynamic Light' flag is checked. This dynamic light has very limited properties compared to the normal light_dynamic entity; however, that may be all you need for certain situations. If you want more control over the dynamic light, use a light_dynamic entity in conjunction with a point_spotlight entity. Just orient them in the same direction and parent them to the same model. Also be sure to check the 'No Dynamic Light' flag in the spotlight's properties, since there is no need to have two dynamic lights doing the same job.

Image:Point spotlight dynamic.jpg

In this screenshot a point_spotlight has replaced the light_dynamic used in unsane's tutorial. As the lamp swings from the rope the light beam moves accordingly as does the dynamic light being cast on the ground.

  • Dynamic Spotlight Beam written by rokitlawnchair
Personal tools