Point spotlight: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
 Bug:In
Bug:In  Portal 2 and
 Portal 2 and  Black Mesa keyvalue
 Black Mesa keyvalue 
 Note:This entity creates an beam and a spotlight_end to accomplish its sprite effects. This means a single
Note:This entity creates an beam and a spotlight_end to accomplish its sprite effects. This means a single 
 Warning:This entity generates 3 edicts (for itself, the beam visual and beam target respectively: point_spotlight, beam, spotlight_end! In
Warning:This entity generates 3 edicts (for itself, the beam visual and beam target respectively: point_spotlight, beam, spotlight_end! In  Team Fortress 2 and
 Team Fortress 2 and  Garry's Mod, the
 Garry's Mod, the  Team Fortress 2, when no targetname and parentname is assigned, the
 Team Fortress 2, when no targetname and parentname is assigned, the 
 Note:beam collides only with prop_static and world geometry, this means that beam of point_spotlight and dynamic light will ignore any dynamic objects (with the exception of func_physbox), NPCs, physics objects, e.t.c.
Note:beam collides only with prop_static and world geometry, this means that beam of point_spotlight and dynamic light will ignore any dynamic objects (with the exception of func_physbox), NPCs, physics objects, e.t.c.
 Note:In
Note:In  Alien Swarm Deferred this entity is not supported and on loading a map all point_spotlight entities will be converted to Light deferred!
 Alien Swarm Deferred this entity is not supported and on loading a map all point_spotlight entities will be converted to Light deferred!
 Important:
Important: Xengine are using deferred lighting for light source from this entity.
 Xengine are using deferred lighting for light source from this entity.
 Code:By default, point_spotlight uses the material sprites/glow_test02.vmt. You can change this if you are shipping your own binaries by going into point_spotlight.cpp in the server project, navigating to line 351 and replacing the file path with your own material or a reference to a variable set via a KV.
Code:By default, point_spotlight uses the material sprites/glow_test02.vmt. You can change this if you are shipping your own binaries by going into point_spotlight.cpp in the server project, navigating to line 351 and replacing the file path with your own material or a reference to a variable set via a KV.
 Bug:In
Bug:In  Left 4 Dead 2 alpha of spawned spotlight_end is set wrongly causing no light to be visible.
 Left 4 Dead 2 alpha of spawned spotlight_end is set wrongly causing no light to be visible.  Fix:Use following script as point_spotlight's Entity script
Fix:Use following script as point_spotlight's Entity script 
		
	
|  (→Keyvalues:  Latest edit was partly correct, but it is actually exclusive to 2013MP/2025MP! With exception to Gmod and Black Mesa, it does not exist in any future games or engine branches. At least to my knowledge, it doesn't exist in Portal 2, L4D, and CS:GO. As such, saying it exists "in all games since 2013MP" is incorrect. While that should be fine for most things, that is sadly not the case here. Anyway, I've marked it as existing in both 2013MP/2025MP, rather than only the latter.) | SirYodaJedi (talk | contribs)   (→Keyvalues:  use this then. TF2branch is the only "since src13mp" branch, as source 13 is divergent from portal 2/csgo/etc, which diverged with L4D emerging from src07) | ||
| Line 16: | Line 16: | ||
| == Keyvalues == | == Keyvalues == | ||
| {{KV Targetname}} | {{KV Targetname}} | ||
| {{KV|Ignore Solid|intn=IgnoreSolid|bool|If set, this spotlight won't trace for solids, emitting at its full length and ignoring potential obstructions.| | {{KV|Ignore Solid|intn=IgnoreSolid|bool|If set, this spotlight won't trace for solids, emitting at its full length and ignoring potential obstructions.|since={{src13mp}}|also={{gmod}}{{bms}}}} | ||
| {{KV|Spotlight Length|intn=SpotlightLength|integer|Length of the spotlight beam.}} | {{KV|Spotlight Length|intn=SpotlightLength|integer|Length of the spotlight beam.}} | ||
| {{KV|Spotlight Width|intn=SpotlightWidth|integer|Width of the spotlight beam.}} | {{KV|Spotlight Width|intn=SpotlightWidth|integer|Width of the spotlight beam.}} | ||
Revision as of 16:50, 25 March 2025
|  Class hierarchy | 
|---|
| CPointSpotlight | 
|  point_spotlight.cpp | 
point_spotlight  is a   point entity  available in all  Source games. Creates two glow sprite effects: a beam effect for viewers outside the light cone and a halo effect for viewers inside the cone. Also creates dynamic light at the end of the beam if desired flags are set which is achieved using spotlight_end.
 Source games. Creates two glow sprite effects: a beam effect for viewers outside the light cone and a halo effect for viewers inside the cone. Also creates dynamic light at the end of the beam if desired flags are set which is achieved using spotlight_end.
The spotlight_end functionality can be disabled with the 'No Dynamic Light' spawnflag. In that state, the spotlight will not actually illuminate other objects on its own and can be used with an accompanying light_spot or env_projectedtexture instead.
 Bug:In
Bug:In  Portal 2 and
 Portal 2 and  Black Mesa keyvalue
 Black Mesa keyvalue renderamt is not functional at all, use HDRColorScale instead. Note:This entity creates an beam and a spotlight_end to accomplish its sprite effects. This means a single
Note:This entity creates an beam and a spotlight_end to accomplish its sprite effects. This means a single point_spotlight actually represents three different entities, including the point_spotlight itself. All of these contribute to the entity limit. Warning:This entity generates 3 edicts (for itself, the beam visual and beam target respectively: point_spotlight, beam, spotlight_end! In
Warning:This entity generates 3 edicts (for itself, the beam visual and beam target respectively: point_spotlight, beam, spotlight_end! In  Team Fortress 2 and
 Team Fortress 2 and  Garry's Mod, the
 Garry's Mod, the point_spotlight itself has been converted to a server-only edict (does not take up an edict), and in  Team Fortress 2, when no targetname and parentname is assigned, the
 Team Fortress 2, when no targetname and parentname is assigned, the point_spotlight and spotlight_end entity is also killed, thus consuming 1 edict in total for a static spotlight. Note:beam collides only with prop_static and world geometry, this means that beam of point_spotlight and dynamic light will ignore any dynamic objects (with the exception of func_physbox), NPCs, physics objects, e.t.c.
Note:beam collides only with prop_static and world geometry, this means that beam of point_spotlight and dynamic light will ignore any dynamic objects (with the exception of func_physbox), NPCs, physics objects, e.t.c. Note:In
Note:In  Alien Swarm Deferred this entity is not supported and on loading a map all point_spotlight entities will be converted to Light deferred!
 Alien Swarm Deferred this entity is not supported and on loading a map all point_spotlight entities will be converted to Light deferred! Important:
Important: Xengine are using deferred lighting for light source from this entity.
 Xengine are using deferred lighting for light source from this entity. Code:By default, point_spotlight uses the material sprites/glow_test02.vmt. You can change this if you are shipping your own binaries by going into point_spotlight.cpp in the server project, navigating to line 351 and replacing the file path with your own material or a reference to a variable set via a KV.
Code:By default, point_spotlight uses the material sprites/glow_test02.vmt. You can change this if you are shipping your own binaries by going into point_spotlight.cpp in the server project, navigating to line 351 and replacing the file path with your own material or a reference to a variable set via a KV.Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentnameortarget).
 Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Ignore Solid (IgnoreSolid)  <boolean> (in all games since  ) (also in ) (also in  ) )
- If set, this spotlight won't trace for solids, emitting at its full length and ignoring potential obstructions.
- Spotlight Length (SpotlightLength) <integer>
- Length of the spotlight beam.
- Spotlight Width (SpotlightWidth) <integer>
- Width of the spotlight beam.
- Color (R G B) (rendercolor) <color255>
- Spotlight color.
- HDR color scale. (HDRColorScale) <float>
- Float value to multiply sprite color by when running in HDR mode.
- Halo size scale. (HaloScale)  <float> (in all games since  ) (also in ) (also in ) )
- Float value to determine the size of the halo.
- Halo material (HaloMaterial)  <string> (only in  ) )
- Material to use for the halo.
- Spotlight beam material (SpotlightMaterial)  <string> (only in  ) )
- Material to use for the spotlight's beam.
- Minimum / Maximum DX Level (mindxlevel / maxdxlevel)  <integer choices> (removed since  ) )
- The entity will not exist if the engine is running outside the given range of DirectX Versions.
- Choices  Warning:If these are used, the object may break when the user switches their DirectX settings.[missing string] Warning:If these are used, the object may break when the user switches their DirectX settings.[missing string]- 0 - Default (no bounding)
- 60 - DirectX 6 (!FGD for mindxlevel)
- 70 - DirectX 7
- 80 - DirectX 8 (GeForce4 Ti & FX 5000 series)
- 81 - DirectX 8.1 (GeForce FX 5800, 5900 & Radeon 8500/9100 and 9000/9200)
- 90 - DirectX 9 Shader Model 2
- 92 - OpenGL аналогичен DirectX 9 Shader Model 2 (using ToGL;   only) !FGD only) !FGD
- 95 - DirectX 9 Shader Model 3 (in all games since  ) )
- 98 - DirectX 9 Shader Model 3 on Xbox 360 ( only) !FGD only) !FGD
 
- Minimum / Maximum Effect Details Level (mincpulevel / maxcpulevel)  <integer choices> (in all games since  ) )
- Don't render for players with Effect Details levels that exceed the minimum or maximum.
- Choices - 0: Default ("Low" for mincpulevel, "High" formaxcpulevel)
- 1: Low
- 2: Medium
- 3: High
 
- 0: Default ("Low" for 
- Minimum / Maximum Shader Details Level (mingpulevel / maxgpulevel)  <integer choices> (in all games since  ) )
- Don't render for players with Shader Details levels that exceed the minimum or maximum.
- Choices - 0: Default ("Low" for mingpulevel, "Very High" formaxgpulevel)
- 1: Low
- 2: Medium
- 3: High
- 4: Very High
 See also: cpu_level / gpu_level convars
- 0: Default ("Low" for 
Flags
- Start On : [1]
- No Dynamic Light : [2]
 Bug:In
Bug:In  Left 4 Dead 2 alpha of spawned spotlight_end is set wrongly causing no light to be visible.
 Left 4 Dead 2 alpha of spawned spotlight_end is set wrongly causing no light to be visible.  Fix:Use following script as point_spotlight's Entity script
Fix:Use following script as point_spotlight's Entity script 
function L4D2PointSpotlightFix() {
    for(local ent; ent = Entities.FindByClassname(ent, "spotlight_end");) {
        if(NetProps.GetPropEntity(ent, "m_hOwnerEntity") == self) {
            local clrrender = NetProps.GetPropInt(self, "m_clrRender");
            NetProps.SetPropInt(ent, "m_clrRender", clrrender);
            return;
        }
    }
}
function OnPostSpawn() {
    if((NetProps.GetPropInt(self, "m_spawnflags") & 3) == 0) {
        L4D2PointSpotlightFix();
    }
    self.ConnectOutput("OnLightOn", "L4D2PointSpotlightFix")
}
Inputs
- LightOn
- Turn the spotlight on.
- LightOff
- Turn the spotlight off.
- SetColor  <color255> (in all games since  ) (also in ) (also in ) )
- Change the color of the spotlight. Light must be turned off then back on for dynamic light to update.
 Note:Functionally identical to the Color input. A delay of at least 0.01 is required before the spotlight is turned back on, or else it will remain off. Note:Functionally identical to the Color input. A delay of at least 0.01 is required before the spotlight is turned back on, or else it will remain off.
- ForceUpdate   (in all games since  ) (also in ) (also in ) )
- Force an update of the spotlight position and orientation.
Outputs
- OnLightOn
- Fires when light turns on.
- OnLightOff
- Fires when light turns off.



























