This article's documentation is for anything that uses the Source engine. Click here for more information.

Point spotlight: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(96 intermediate revisions by 40 users not shown)
Line 1: Line 1:
[http://ankelia-nature.com/catalogues/catalogues/wcrrbx.html numa numa songs] [http://www.youthfitnesssolutions.com/FTP1/page9/mfitfb.html 1 game heat piston] [http://tch-voyages.com/documents/prague/896/kvhfsa.html out off touch] [http://panties-pictures.com/free/lib/temp/jmwies.html ebook free java programming] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/cuxati.html telecommunication tyco] [http://www.norcab.com.au/joeavatiforum/templates/cache/paqkqr.html juegos de carreras de caballos] [http://smallbizbohol.com/democatalog/images/baner/nuwsdq.html spoiler t.o] [http://tch-voyages.com/documents/prague/896/hjkxmo.html register for data protection act] [http://hoosierfishing.com/phpBB/images/avatars/avatar/pottqw.html william templeton] [http://asie-voyages.com/upload/images/lens/dlhpbi.html laye] [http://xuccco.org/themes/AT-Green3/gbhkpe.html scary stencils] [http://xuccco.org/themes/AT-Green3/nkfteq.html newfoundland info] [http://asie-voyages.com/upload/images/lens/pamdjf.html lihat] [http://indianaoutfitters.com/s/info/tmp/fcnskr.html office onenote key] [http://www.youthfitnesssolutions.com/FTP1/page9/fglbkg.html mississippi paint horse club] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/ehpmgm.html name of human body part] [http://coastguard.gov.ph/content.old/license/ftdcxk.html subtitle tool] [http://ankelia-nature.com/catalogues/catalogues/tfjwhn.html psych abstract] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/naegba.html ipod 40gb photo price] [http://smallbizbohol.com/democatalog/images/baner/kuvoso.html stools for kitchen island] [http://coastguard.gov.ph/content.old/license/hqcgdw.html oregon grille maryland] [http://lumayagrealty.com/catalog/images/pics/mxvkpp.html luggage dealers] [http://xuccco.org/themes/AT-Green3/dsfgah.html what is international trade law] [http://indianaoutfitters.com/s/info/tmp/ihjgel.html 1979 floyd pink wall] [http://panties-pictures.com/free/lib/temp/eirnhs.html msn messenger emotions] [http://hoosierfishing.com/phpBB/images/avatars/avatar/ugwmkk.html new york 20th century] [http://tch-voyages.com/documents/prague/896/xgbhaa.html new york mega million results] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/qidqnm.html info plant vine] [http://ankelia-nature.com/catalogues/catalogues/farfpq.html 1900 switch] [http://tch-voyages.com/documents/prague/896/gfklpb.html model minority thesis] [http://www.lewakins.com/sr/images/kxlaax.html korean wong] [http://talentmodeles.com/mannequin/images/cache/xutaer.html windows media player 10 pocket pc downloads] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/pvceij.html takeda pharma] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/ohsapr.html widespread panic shows] [http://tch-voyages.com/documents/prague/896/ltffja.html the chaos theory quote] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/mauhlw.html mussle car for sale] [http://www.norcab.com.au/joeavatiforum/templates/cache/kekrrd.html martial arts directory california] [http://www.norcab.com.au/joeavatiforum/templates/cache/ehguei.html international journal of cardiology] [http://tarsierfoundation.org/content/license/rmjeew.html photo image for sale] [http://asie-voyages.com/upload/images/lens/xgbkff.html shielding bag] [http://asie-voyages.com/upload/images/lens/cqjvux.html sell a new idea] [http://www.biblored.org.co/agenda_actividades/programas/images/soqiam.html relationship specialists] [http://www.hdac.org/hdfaq/faq/isgmts.html sophie baby love videos] [http://www.hdac.org/hdfaq/faq/jxpver.html indonesia tsunami disaster] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/jkweao.html 11 upn] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/lbixqv.html site builders free] [http://smallbizbohol.com/democatalog/images/baner/nwhbgo.html unable to update window] [http://xuccco.org/themes/AT-Green3/xwppqx.html one tv dubai website] [http://www.biblored.org.co/agenda_actividades/programas/images/slqsqv.html end tag] [http://hoosierfishing.com/phpBB/images/avatars/avatar/bkxhjv.html if i was a carpenter song] [http://www.hdac.org/hdfaq/faq/vsqbse.html naruto soundtracks] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/dprbgx.html mobile ultrasound business] [http://tch-voyages.com/documents/prague/896/irrmcd.html synthetic aperture] [http://roycemotor.com/carpics/cache/ljahsv.html new york music schools] [http://xuccco.org/themes/AT-Green3/qexnom.html nyc traffic cam] [http://indianaoutfitters.com/s/info/tmp/gmhlqn.html natural breast mexican] [http://hoosierfishing.com/phpBB/images/avatars/avatar/smfbtq.html adult character child development in] [http://www.hdac.org/hdfaq/faq/tskoqv.html political parody movies] [http://cvscaft-tcc.edu.ph/gallery/uploads/cache/nfmnla.html jesus name above all names] [http://www.biblored.org.co/agenda_actividades/programas/images/qnxmws.html solar powered steam] [http://xuccco.org/themes/AT-Green3/tpdmga.html myth warez] [http://hoosierfishing.com/phpBB/images/avatars/avatar/helnpj.html knitting patterns socks free] [http://cvscaft-tcc.edu.ph/gallery/uploads/cache/sbktdn.html jump start lite] [http://tch-voyages.com/documents/prague/896/ojjhxs.html mercury tv commercial girl] [http://indianaoutfitters.com/s/info/tmp/wolmvw.html radio tower collapses] [http://tch-voyages.com/documents/prague/896/dcppnx.html nyack home] [http://lumayagrealty.com/catalog/images/pics/aofttb.html kentucky state abbreviation] [http://smallbizbohol.com/democatalog/images/baner/vnspwu.html new frontier wind river] [http://indianaoutfitters.com/s/info/tmp/jtsgad.html kidney protein tests] [http://tch-voyages.com/documents/prague/896/vngope.html music album song lists] [http://tch-voyages.com/documents/prague/896/rgepap.html 11 9 article post stress traumatic] [http://tarsierfoundation.org/content/license/niqmet.html metal model cars] [http://panties-pictures.com/free/lib/temp/obxbme.html register tape coupons] [http://ankelia-nature.com/catalogues/catalogues/etnutx.html sweating foot] [http://tarsierfoundation.org/content/license/bcecrg.html mussle car for sale] [http://smallbizbohol.com/democatalog/images/baner/jbglqx.html pictures of black holes in space] [http://tarsierfoundation.org/content/license/rflufp.html potter s wheel] [http://www.lewakins.com/sr/images/ogdoxq.html loans direct] [http://xuccco.org/themes/AT-Green3/dtipsl.html uses for sodium bicarbonate] [http://www.lewakins.com/sr/images/pgalod.html virginia va 4 form] [http://xuccco.org/themes/AT-Green3/mfdura.html what is factoring in finance] [http://www.youthfitnesssolutions.com/FTP1/page9/eswdwn.html v cop 2] [http://ankelia-nature.com/catalogues/catalogues/rjinpu.html patch test] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/mvqsiw.html service data objects] [http://xuccco.org/themes/AT-Green3/likhsb.html amatorization schedules] [http://panties-pictures.com/free/lib/temp/hkcoed.html zeroconf windows] [http://www.norcab.com.au/joeavatiforum/templates/cache/hnbegd.html photos of people jumping from world trade center] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/ebfkqd.html love to] [http://tarsierfoundation.org/content/license/ltrtbq.html loss normal weight] [http://www.lewakins.com/sr/images/iefagd.html 3.3 dos ms] [http://panties-pictures.com/free/lib/temp/gxmrpb.html ussr propaganda] [http://indianaoutfitters.com/s/info/tmp/dwwadn.html meatpacking district restaurants] [http://www.youthfitnesssolutions.com/FTP1/page9/hgqlix.html wedding photography florida key] [http://www.youthfitnesssolutions.com/FTP1/page9/ttxksv.html nhs banding] [http://lumayagrealty.com/catalog/images/pics/tqdwcj.html scavo] [http://tarsierfoundation.org/content/license/mkofnb.html academic subject directory] [http://hoosierfishing.com/phpBB/images/avatars/avatar/fkxnlj.html 319 dark street] [http://www.lewakins.com/sr/images/jvdwnc.html wv tax and revenue] [http://tarsierfoundation.org/content/license/xquqqf.html ski buyer guide] [http://smallbizbohol.com/democatalog/images/baner/ikrogo.html play paintball video games online]  
{{LanguageBar}}
{{wrongtitle|title=point_spotlight}}
{{CD|CPointSpotlight|file1=1}}
== Entity description ==
[[File:PointSpotlight.jpg|thumb|right|192px|A point_spotlight.]]
An entity to draw a spotlight primarily consisting of two glow sprites: A beam when the player views it side on, and a halo when it's facing towards the player. Unless the 'No Dynamic Light' spawn flag is checked, it will also create a dynamic light wherever the end of the spotlight rests.
{{this is a|point entity|name=point_spotlight}} 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 {{ent|spotlight_end}}.
{{note|Without the dynamic light this entity will just provide a sprite effect, and will not serve as an actual light source.}}


== Keyvalues ==
The {{ent|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 {{ent|light_spot}} or {{ent|env_projectedtexture}} instead.
* {{kv targetname}}
* {{kv parentname}}
* {{kv renderfields}}
* {{kv angles}}
* {{kv hdrcolorscale}}


* '''spotlightlength'''
{{bug|hidetested=1|In {{portal2|4}} and {{bms|4}} the '''Alpha''' (''renderamt'') property is not functional at all, use '''HDRColorScale''' instead.}}
: <integer> Length of the spotlight beam.
{{warning|This entity generates 3 [[edict]]s (for itself, the beam visual and beam target respectively: {{mono|point_spotlight}}, {{ent|beam}}, {{ent|spotlight_end}}! In {{tf2|4}} and {{gmod|4}}, the <code>point_spotlight</code> itself has been converted to a server-only entity (does not take up an edict), and in {{tf2|4}}, when no targetname and parentname is assigned, the <code>point_spotlight</code> and <code>spotlight_end</code> entity is also killed, thus consuming 1 edict in total for a static spotlight.}}
{{bug|tested={{hl2}},{{bms}}|Killing this entity either by '''Kill''' input or by killing its parent while it's turned on will leave behind the <kbd>beam</kbd> and <kbd>spotlight_end</kbd> entities. Beam won't be visible but the spotlight_end will be.
{{workaround|Fire '''LightOff''' input first, then with small delay '''Kill'''.}}
}}
{{note|{{ent|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]]), [[NPC]]s, [[physics objects]], e.t.c.}}


* '''spotlightwidth'''
{{expand|title=Third-Party notices {{asd}}{{bms}}|
: <integer> Width of the spotlight beam.
{{note|In {{asd|4}} this entity is not supported and on loading a map all point_spotlight entities will be converted to [[Light deferred]]!}}
{{important|{{bms|4}} are using [[deferred lighting]] for [[spotlight_end|light source from this entity]].}}
}}


* '''rendercolor'''
== Keyvalues ==
: {{color}} The color of the spotlight cone.
{{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.|since={{src13mp}}|also={{gmod}}{{mapbase}}  ,  {{!fgd}} in {{bms}}}}
{{KV|Spotlight Length|intn=SpotlightLength|integer|Length of the spotlight beam.}}
{{KV|Spotlight Width|intn=SpotlightWidth|integer|Width of the spotlight beam.}}
{{KV|Color (R G B)|intn=rendercolor|color255|Spotlight color.}}
{{KV|HDR color scale.|intn=HDRColorScale|float|Float value to multiply sprite color by when running in HDR mode.}}
{{KV|Halo size scale.|intn=HaloScale|float|Float value to determine the size of the halo.|since={{l4d2}}|also={{mapbase}}}}
{{expand|title={{mapbase|4}} only properties|
{{KV|Halo material|intn=HaloMaterial|string|Material to use for the halo.}}
{{KV|Spotlight beam material|intn=SpotlightMaterial|string|Material to use for the spotlight's beam.}}
}}
{{expand|title=Performance properties|
{{KV DXLevelChoice}}
{{KV SystemLevelChoice}}
}}


== Flags ==
== Flags ==
* 1 : Start On
{{Fl|1|Start On}}
: Sets the point_spotlight to be turned on when it spawns.
{{Fl|2|No Dynamic Light}}
{{bug|hidetested=1|In {{l4d2|4}} alpha of spawned {{ent|spotlight_end}} is set wrongly causing no light to be visible. {{fix|Use following script as point_spotlight's Entity script {{ExpandBox|<syntaxhighlight lang=js>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;
        }
    }
}


* 2 : No Dynamic Light
function OnPostSpawn() {
: Prevents a dynamic light from being generated by the point_spotlight. Dynamic lights can be costly for performance, so this flag should be checked to improve framerate.
    if((NetProps.GetPropInt(self, "m_spawnflags") & 3) == 0) {
        L4D2PointSpotlightFix();
    }
    self.ConnectOutput("OnLightOn", "L4D2PointSpotlightFix")
}</syntaxhighlight>}}}}}}


== Inputs ==
== Inputs ==
*{{i targetname}}
{{I|LightOn|Turn the spotlight on.}}
*{{i parentname}}
{{I|LightOff|Turn the spotlight off.}}
*{{i renderfields}}
{{I|LightToggle|Toggles the spotlight on/off|only={{mapbase}}}}
{{I|SetColor|Change the color of the spotlight. Light must be turned off then back on for dynamic light to update.|param=color255|since={{AS}}|also={{GMOD}}}}
:{{note|Functionally identical to the {{mono|Color}} input. A delay of at least 0.01 is required before the spotlight is turned back on, or else it will remain off.}}
{{I|ForceUpdate|Force an update of the spotlight position and orientation.|since={{AS}}|also={{GMOD}}}}


* '''LightOn'''
== Outputs ==
{{O|OnLightOn|ac-is-this=1|Fires when light turns on.}}
{{O|OnLightOff|ac-is-this=1|Fires when light turns off.}}


* '''LightOff'''
== Code related ==
 
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 similarly as {{mapbase|4}}'s <kbd>SpotlightMaterial</kbd> KV.
== Outputs ==
* {{o targetname}}


== See also ==
== See also ==
* [[light_spot]]
* [[Lighting]]
* [[npc_spotlight]]


[[Category:Entities]]
[[Category:Lighting]]

Latest revision as of 03:43, 20 July 2025

English (en)Русский (ru)Translate (Translate)
C++ Class hierarchy
CPointSpotlight
CPointEntity
CBaseEntity
C++ point_spotlight.cpp
A point_spotlight.

point_spotlight is a point entity available in all Source 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.

Icon-Bug.pngBug:In Portal 2 Portal 2 and Black Mesa Black Mesa the Alpha (renderamt) property is not functional at all, use HDRColorScale instead.
Warning.pngWarning:This entity generates 3 edicts (for itself, the beam visual and beam target respectively: point_spotlight, beam, spotlight_end! In Team Fortress 2 Team Fortress 2 and Garry's Mod Garry's Mod, the point_spotlight itself has been converted to a server-only entity (does not take up an edict), and in Team Fortress 2 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.
Icon-Bug.pngBug:Killing this entity either by Kill input or by killing its parent while it's turned on will leave behind the beam and spotlight_end entities. Beam won't be visible but the spotlight_end will be.
PlacementTip.pngWorkaround:Fire LightOff input first, then with small delay Kill.
  (tested in: Half-Life 2,Black Mesa)
Note.pngNote: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.
Third-Party notices Alien Swarm DeferredBlack Mesa
Note.pngNote:In Alien Swarm Deferred Alien Swarm Deferred this entity is not supported and on loading a map all point_spotlight entities will be converted to Light deferred!

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
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 Source 2013 Multiplayer) (also in Garry's ModMapbase , !FGD in Black Mesa)
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 Left 4 Dead 2) (also in Mapbase)
Float value to determine the size of the halo.
Mapbase Mapbase only properties
Halo material (HaloMaterial) <string>
Material to use for the halo.
Spotlight beam material (SpotlightMaterial) <string>
Material to use for the spotlight's beam.
Performance properties
Minimum / Maximum DX Level (mindxlevel / maxdxlevel) <integer choices> (removed since Left 4 Dead)
The entity will not exist if the engine is running outside the given range of DirectX Versions.
Choices
Warning.pngWarning:If these are used, the object may break when the user switches their DirectX settings.[missing string]
Minimum / Maximum Effect Details Level (mincpulevel / maxcpulevel) <integer choices> (in all games since Left 4 Dead)
Don't render for players with Effect Details levels that exceed the minimum or maximum.
Choices
  • 0: Default ("Low" for mincpulevel, "High" for maxcpulevel)
  • 1: Low
  • 2: Medium
  • 3: High
Minimum / Maximum Shader Details Level (mingpulevel / maxgpulevel) <integer choices> (in all games since Left 4 Dead)
Don't render for players with Shader Details levels that exceed the minimum or maximum.
Choices
  • 0: Default ("Low" for mingpulevel, "Very High" for maxgpulevel)
  • 1: Low
  • 2: Medium
  • 3: High
  • 4: Very High
See also:  cpu_level / gpu_level convars

Flags

Start On : [1]
No Dynamic Light : [2]
Icon-Bug.pngBug:In Left 4 Dead 2 Left 4 Dead 2 alpha of spawned spotlight_end is set wrongly causing no light to be visible.
Note.pngFix: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.
LightToggle  (only in Mapbase)
Toggles the spotlight on/off
SetColor <color255RedirectInput/color32> (in all games since Alien Swarm) (also in Garry's Mod)
Change the color of the spotlight. Light must be turned off then back on for dynamic light to update.
Note.pngNote: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 Alien Swarm) (also in Garry's Mod)
Force an update of the spotlight position and orientation.

Outputs

OnLightOn
!activator = !caller = this entity
Fires when light turns on.
OnLightOff
!activator = !caller = this entity
Fires when light turns off.

Code related

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 similarly as Mapbase Mapbase's SpotlightMaterial KV.

See also