Lighting
Improving lighting to make use of new
Counter-Strike 2 lighting features should always be the top priority as these can significantly improve the quality of the map.
For that reason, it is important to understand what different lightning options do:
- Static: a standard light that only provides baked lightning and baked shadows within an area. Most of the lights in the map will be static. They don’t have a dynamic specular highlight but it can still be baked to cubemaps; i.e. they are unresponsive to real-time changes, with the benefit of being very cheap.
- Stationary: a light as the name suggests is stationary, but provides more capabilities than a static light. It is a mix of both static and dynamic, where static objects cast baked shadows and dynamic objects cast dynamic shadows. In this case, baked shadows are in a separate shadowmap. Stationary lights can be toggled or change colors, but cannot be moved. They also have a dynamic specular highlight.
There is a limit of 4 overlapping stationary lights at any given luxel, which may include one for light_environment (unless baked shadowing is disabled, or for any VIS clusters that are "indoors"). Any more stationary lights will not show up properly and cause lighting artefacts.
- Each stationary light uses up a channel in the shadow map, and there are 4 channels in total (red, green, blue, alpha). This overlap is entirely dependent on the radius and shape of the light, hence lights separated by the void may still affect each other!
By disabling Baked Shadowing in light_environment, an extra channel can be freed up. Be warned that this will disable CSM (or in layman's terms this will disable shadows casted from the light_environment).
- Dynamic: Dynamic lights, as the name implies, are fully dynamic. It casts dynamic shadows of the entire scene (unless the object has disabled dynamic shadows) and is thus the most expensive type. Dynamic lights can be fully manipulated in real time and spawned at will. However, if shadows are enabled, it will be limited to the dynamic shadow atlas, which depends on the user’s shadow quality setting as follows:
- Very high: 6144 x 4096
- High: 3072 x 2048
- Medium: 1536 x 1536
- Low: 1280 x 640
Thus, having medium or low video settings may disable any non-stationary lights if dynamic shadows are enabled.
Should the baked lighting lightmap of the map be viewed, use
Source2 Viewer to open the map .vpk file, and navigate to lightmaps/irradiance.vtex. If there are any abnormally large faces in the lightmap, have a look at them in hammer and make sure they are properly addressed.
Specular Lightning
Static lights in the map should have bake specular to cubemaps enabled. This allows the light itself to be reflected on reflective surfaces via cubemaps.
Stationary and Dynamic Lights
Any lights that need to change at run time should at least be a stationary light. If the light needs to change positions as well, then it should be a dynamic light.
Dynamic Shadows
A stationary/dynamic light can support dynamic shadows by enabling Baked Shadowing. This will allow shadows to be dynamically drawn from players (including yourself), prop objects, or any moving entities.
These can greatly change the atmosphere of an area; try to use dynamic shadows whenever possible, but the limit of 4 overlapping stationary lights still applies here. Any additional stationary lights with dynamic shadows will not work properly. Because of this limit, dynamic shadows should only be used for lightning that can benefit the most from dynamic shadows.
Light Entities
light_environment: equivalent to S1, gives environmental light to the map.
CSM properties of a light_environment can be modified after enabling these properties in the hammer .fgd.
light_omni: legacy entity equivalent to light entity in S1; do not use this light entity!light_omni2: new S2 light that has equal properties to the light entity in S1, provides uniform lighting around the source. A basic light but also highly customisable.- Shape:
- Point (default): Light is emitted from a single point in space - sharp shadows.
- Sphere: Light is emitted from the outer layer of a sphere - viable for any hanging lights that have a considerable volume/size, baked shadows will be softer the bigger the light source is.
- Tube without end cap: Light is emitted from the outer layer of the cylinder, with no light from the top or bottom of the cylinder - perfect for fluorescent lights.
- Tube with end cap: Light is emitted from all areas of the cylinder.
- Angles: The inner and outer angles can be modified so that the light becomes directional. This is vital for any lightning from the ceiling, or any lightning that has a cap that prevents light to go through. Changing the angle does not impact the brightness of the light.
- Cookies: A texture to apply on top of illuminated areas. A great way to mimic complex shadows, for example lighting through a window frame, without having to use stationary light for sharper shadows.
- Shape:
light_omni2 is a very powerful light entity in source 2 with the most customization possible.
light_barn: new S2 light that is best suited for 'barn' lighting; i.e. any light that illuminates in a specific direction, mainly to illuminate the floor in an area. Great for ceiling lamps, hanging lamps with caps, and outside lamps such as street lamps.- Shape: the shape of the projected light can be changed with three numbers given in the shape parameter: size of light source in x-axis, size of light source in y-axis, and angle of projection. Increasing the angle of projection will increase the area the light illuminates at a cost of light resolution.
light_rect: a light that is emitted from a flat plane. Best suited when creating fake ambient lighting from outside such as behind windows and skylights.
Unlike S1, it is now possible to have these light entities directly inside the lightning models instead.