In this post will go through different types of lights available in the Counter-Strike:Global Offensive-SDK. I’ll also give tutorials on how add some of these lights, show how they work and show how they would look like in-game.
The types of lighting in source sdk can be split up into two:
Static Sources, static lighting is compiled into Lightmaps, which illuminate brushes and models, and Cubemaps, which provide static reflection. Dynamic Sources, dynamic lighting is calculated at runtime, which makes it expensive to render. This includes entity lights:
- light – A static, omni-directional point light source (e.g. naked light bulb)
- light_spot – A static, uni-directional point light source (e.g. torch or flashlight).
- light_environment (Covered this in the last post here: http://goo.gl/VxnKGw )
- light_directional – It is a directional light with no falloff.
- light_dynamic -A simple, uni-directional dynamic light that can be moved, turned, and adjusted.
- point_spotlight – A dynamic spotlight beam effect, with an optional dynamic light source where it hits a surface.
- beam_spotlight – Will draw a beam when the player views it side on, and a halo when it’s facing towards the player.
MAT_FULLBRIGHT
If you compile your map and run it in-game, Source will default your lighting to full bright. Once you insert a light into your map, the engine will switch full bright off and begin calculating your lighting. The console command for full bright are:
- mat_fullbright 0
- mat_fullbright 1
Mat_Fullbright is a useful command in Source. You can use it to gameplay test your map without worrying about setting up lights. Unfortunately right now, mat_fullbright is buggy and does not produce full bright map.
Adding Light to Map
Enough with the back ground lecture, now I’ll show you how to add certain light entities into your map. I’ll go through these light entities; light, light_spot, point_spotlight and beam_spotlight.
To add light entity first select the entity tool
Then type in the bottom right hand side of the hammer editor, under object ‘light’
Then to add the light entity just left click somewhere in the world (Where you would like to place it, just make sure not add it within an existing brush/object)
Hint – The x simple on the entity represents the centre, but can also represent the point of where the light starts emitting. So make sure if you want to light the objects/brushes around do not have x within an object/brush or prop.
Double click the entity to display the properties to alter any necessary settings.
Useful fields that you need to take into consideration when using light entity:
- Name – Could give name to the light entity for reference or parenting.
- Brightness – takes four values, first three (255 255 255) is the colour of the light. The fourth (200) is the brightness of the light.
- Appearance – Is how the light could appear in-game. Normal is constant light emission, Fluorescent flicker is that light will flicker and you will get the rest.
Here is in-game view of light at with different values for fields. (R-L) Standard light, Brightness set at 750, Colour change to blue and final appearance set to flicker (unfortunately unable to view the flicker in action with a screenshot).
Now we move on to light_spot. This entity only works by emitting light in one direction and it is not as bright as light entity. To add the entity select the entity tools and filter for ‘light_spot’ under objects in the right hand side of the hammer editor.Left-click where you would like to place the entity in the world.
Useful fields that you need to take into consideration when using light_spot entity:
- The ones that were included in the light entity properties (Name, brightness and appearance).
- Pitch Yaw Roll (X Y Z) – The direction of where the light is emitting.
- Inner (Bright) angle – Focus light.
- Outer (Fade) angle – Outer fade light.
Here is in-game view of light_spot at with different values for fields. (R-L) Standard light_spot, Brightness set at 750, Colour change to blue and last has its Inner and outer set to 60 and 75 (Notice the light cover more surface area and first one)
beam_spotlight and point_spotlight are similar so I’ll cover them together (I sometimes forger which does what). Again after selecting the entity tool, filter the object for either ‘beam_spotlight’ or ‘point_spotlight’ (depending on what you need). Left-click on the in the world to add the entity. The arrow should indicate the direction of where the entity will emit.
The additional field provided in their properties that will interest you are:
- Spotlight Length
- Spotlight Width
I do not need to need explain these, I’m sure you already understand what they point to.
Here is in-game view of beam_spotlight(top) and point_spotlight(bottom). Main and most notisable difference is that point_spotlight is stronger and brighter than beam_spotlight. (R-L) Standard values, Colour change to red, then I halved the spotlight length and width. The last one is mistake, its the same as standard values.
I think you have noticed that beam_spotlight and point_spotlight do not provide any light to the environment. They are more than an effect that helps make the map or objects more interesting.
I’ll not show light_directional because there isn’t much use for it, as well as I’m not sure how to set it up, as I never was required to use it. light_dynamic cannot be used alone, and as I haven’t introduced props yet I have decided to save this for a future post.