Dynamic Light
by cbk (view all articles)

1 rating / 5 stars
Introduction to the light_dynamic entity
by cbk (view all articles)

1 rating / 5 stars

This tutorial is basically a continuation of my tire swing tutorial, which describes how to make a hanging prop that will move around if shot, but with different props and dynamic lighting. So having read that tutorial, make a light using similar methods:
I have used the props_c17/lamp_bell_on.mdl model for the prop_physics in this example.
Before you start reading on, all your entities and your
prop_physics must be named. I will be using these names for this tutorial:
prop_physics = dynamic01_lamp01
move_rope = dynamic01_rope01
keyframe_rope = dynamic01_keyframe01
phys_lengthconstraint = dynamic01_constraint01
Now, go into the properties of your prop_physics light. Now, this is very important: you MUST change it from a prop_physics to a prop_physics_override. This is done from the drop down menu where it gives the name of the entity currently selected. After that change is made press apply.
Now it's time to create the light that will follow the lamp and light up the area the lamp points. Create a light_dynamic right below your lamp. Press enter to create it. When you do you should notice that your 3D View gets filled up with all sorts of lines and cones and stuff.
That?s what if should look like. Go into the properties of your dynamic light. Set these properties:
name = dynamic01_light01
parent = dynamic01_lamp01
pitch yaw roll = 90 0 0 (this is down)
brightness = 4 (4 is the maximum and 0 is minimum, you may need to play around abit)
Spotlight end radius = 200 (This is quite large, you may want to fool around. It is the radius of the big white cone you see in your 3D view)
Make sure you press apply to set all these changes.
Run your map and hopefully you have something that looks like that. Now, HL2 doesn?t recognize light_dynamic as a light source and sets the map to fullbright by default if you don't have any other 'normal' lights. If this is the case, go into your console and type sv_cheats 1 and then mat_fullbright 0.
If after you do that you don?t have something that looks like the picture, one thing you might want to try is selecting your light_dynamic and looking in your side view- there should be a circle. Drag this so it?s the size of your room and press apply. Another thing you should check is your brightness. The brightness is VERY important: if it is 0 then you will have no light at all, so make sure it is at 4.
When that is all working, and you?ve had some fun shooting your light around the room, its time come back to Hammer and add a spotlight. Create a point_spotlight entity right below your lamp. Go into its properties and set these following settings:
name = dynamic01_spotlight01
parent = dynamic01_lamp01
You might want to tick the no dynamic light flag too as we've already got a light source and doing so will save processing power. Now press apply, and compile/run your map!
You should have something that looks like this:
And that?s pretty much it. You may want to add a dim light in the room so you can sort of see the walls. But besides that, this tutorial is over.

I have used the props_c17/lamp_bell_on.mdl model for the prop_physics in this example.
Before you start reading on, all your entities and your
prop_physics must be named. I will be using these names for this tutorial:
prop_physics = dynamic01_lamp01
move_rope = dynamic01_rope01
keyframe_rope = dynamic01_keyframe01
phys_lengthconstraint = dynamic01_constraint01
Swinging light
Now, go into the properties of your prop_physics light. Now, this is very important: you MUST change it from a prop_physics to a prop_physics_override. This is done from the drop down menu where it gives the name of the entity currently selected. After that change is made press apply.
Now it's time to create the light that will follow the lamp and light up the area the lamp points. Create a light_dynamic right below your lamp. Press enter to create it. When you do you should notice that your 3D View gets filled up with all sorts of lines and cones and stuff.

That?s what if should look like. Go into the properties of your dynamic light. Set these properties:
name = dynamic01_light01
parent = dynamic01_lamp01
pitch yaw roll = 90 0 0 (this is down)
brightness = 4 (4 is the maximum and 0 is minimum, you may need to play around abit)
Spotlight end radius = 200 (This is quite large, you may want to fool around. It is the radius of the big white cone you see in your 3D view)
Make sure you press apply to set all these changes.

Run your map and hopefully you have something that looks like that. Now, HL2 doesn?t recognize light_dynamic as a light source and sets the map to fullbright by default if you don't have any other 'normal' lights. If this is the case, go into your console and type sv_cheats 1 and then mat_fullbright 0.
If after you do that you don?t have something that looks like the picture, one thing you might want to try is selecting your light_dynamic and looking in your side view- there should be a circle. Drag this so it?s the size of your room and press apply. Another thing you should check is your brightness. The brightness is VERY important: if it is 0 then you will have no light at all, so make sure it is at 4.
Spotlight effect
When that is all working, and you?ve had some fun shooting your light around the room, its time come back to Hammer and add a spotlight. Create a point_spotlight entity right below your lamp. Go into its properties and set these following settings:
name = dynamic01_spotlight01
parent = dynamic01_lamp01
You might want to tick the no dynamic light flag too as we've already got a light source and doing so will save processing power. Now press apply, and compile/run your map!
You should have something that looks like this:

And that?s pretty much it. You may want to add a dim light in the room so you can sort of see the walls. But besides that, this tutorial is over.