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
No edit summary
No edit summary
 
(98 intermediate revisions by 40 users not shown)
Line 1: Line 1:
[http://roycemotor.com/carpics/cache/phbexl.html apoyo de frases] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/masoex.html little prince boston opera] [http://coastguard.gov.ph/content.old/license/nvnjge.html new york city sights] [http://www.lewakins.com/sr/images/qwkwfb.html atl let me make it up with love lyrics] [http://panties-pictures.com/free/lib/temp/njkqks.html e world publishing] [http://indianaoutfitters.com/s/info/tmp/rwqfog.html internet explorer start slow] [http://indianaoutfitters.com/s/info/tmp/ufbilj.html snow melting system] [http://smallbizbohol.com/democatalog/images/baner/uqtsli.html air travel last minute deal] [http://www.lewakins.com/sr/images/qsgdku.html amatorization schedules] [http://www.biblored.org.co/agenda_actividades/programas/images/wohpih.html meet online people place] [http://www.norcab.com.au/joeavatiforum/templates/cache/qstnhq.html research positions in psychology] [http://www.biblored.org.co/agenda_actividades/programas/images/iqfimt.html mature single travel] [http://smallbizbohol.com/democatalog/images/baner/ixcdxo.html robert sep] [http://hoosierfishing.com/phpBB/images/avatars/avatar/uwdhwg.html audiovox cd player] [http://www.hdac.org/hdfaq/faq/raftvt.html energy conservation act 2001] [http://www.norcab.com.au/joeavatiforum/templates/cache/ouscgn.html jesse jane blow jobs] [http://talentmodeles.com/mannequin/images/cache/sbeubt.html neo magic video driver] [http://tch-voyages.com/documents/prague/896/lifkbt.html what do i need to copy vhs to dvd] [http://tarsierfoundation.org/content/license/jwmefk.html early and high renaissance] [http://panties-pictures.com/free/lib/temp/likaks.html industrial mechanical specialties] [http://tarsierfoundation.org/content/license/ogxmmm.html auto body canadian part] [http://smallbizbohol.com/democatalog/images/baner/piueqr.html mr. bean clips] [http://asie-voyages.com/upload/images/lens/nqtjto.html alex lund] [http://lumayagrealty.com/catalog/images/pics/dhqnof.html income tax deductions in canada] [http://www.biblored.org.co/agenda_actividades/programas/images/uphdip.html southwest craft center] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/mswkcd.html was only wishful thinking] [http://panties-pictures.com/free/lib/temp/iwwpfb.html practical nurse scope of practice] [http://smallbizbohol.com/democatalog/images/baner/pdsiuw.html 2006 before loss picture weight] [http://asie-voyages.com/upload/images/lens/jqoknw.html small talk is] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/ttuclt.html why is america not the best place to live] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/hjkshc.html semiconductor testing] [http://www.norcab.com.au/joeavatiforum/templates/cache/orvmcq.html precious declaration] [http://coastguard.gov.ph/content.old/license/jexshn.html outdoor web camera] [http://coastguard.gov.ph/content.old/license/axlgtg.html mast cell tumors] [http://smallbizbohol.com/democatalog/images/baner/tpahid.html security set window] [http://lumayagrealty.com/catalog/images/pics/vwhxcv.html icra online ltd] [http://xuccco.org/themes/AT-Green3/vuwbua.html asia music hits] [http://cvscaft-tcc.edu.ph/gallery/uploads/cache/fiovww.html 400 best camcorder under] [http://roycemotor.com/carpics/cache/ugcmkj.html jewish people in spain] [http://asie-voyages.com/upload/images/lens/clxkmo.html panic attack breathing exercises] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/sqqrfp.html access point virginia wireless] [http://coastguard.gov.ph/content.old/license/prucun.html star wars galaxies com] [http://www.biblored.org.co/agenda_actividades/programas/images/trigmr.html symptom of autism in adult] [http://xuccco.org/themes/AT-Green3/rjfjva.html ib testing] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/piwbia.html microsoft anti virus free downloads] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/hifwrn.html national museum of health and] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/dmkvgb.html what were the crusades] [http://talentmodeles.com/mannequin/images/cache/xxetbp.html kelly trina] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/wlibxv.html iso jump start] [http://smallbizbohol.com/democatalog/images/baner/fhvaed.html 2 age empire pc] [http://lumayagrealty.com/catalog/images/pics/egcshm.html 30 fixed interest mortgage rate refinance year] [http://tch-voyages.com/documents/prague/896/jlnjtv.html profession engineer exam] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/ikbxed.html inc innova] [http://panties-pictures.com/free/lib/temp/mobntb.html no swearing] [http://panties-pictures.com/free/lib/temp/lpxpuv.html titus county] [http://www.lewakins.com/sr/images/xbddan.html entertainment center with book shelf] [http://tch-voyages.com/documents/prague/896/clgksa.html usc basketball camps] [http://ankelia-nature.com/catalogues/catalogues/isawwr.html activation key norton 2005] [http://www.lewakins.com/sr/images/buhhav.html job quant] [http://indianaoutfitters.com/s/info/tmp/tiavks.html make sure of all things] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/gvxtrb.html seleccion mexico futbol] [http://www.biblored.org.co/agenda_actividades/programas/images/esijgu.html along came mary] [http://lumayagrealty.com/catalog/images/pics/riqbrp.html achievement award] [http://tarsierfoundation.org/content/license/xqnhga.html in kit lady mature sex] [http://cvscaft-tcc.edu.ph/gallery/uploads/cache/eqswpl.html pocket wizard review] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/bkxjlp.html ut austin coop] [http://ankelia-nature.com/catalogues/catalogues/nsmhuv.html anaylsis of hamlet] [http://roycemotor.com/carpics/cache/dwcnme.html 2006 bob fest marley] [http://smallbizbohol.com/democatalog/images/baner/tluiqf.html anonymous p2p client] [http://tarsierfoundation.org/content/license/rfrdsq.html ergonomics exercises] [http://ankelia-nature.com/catalogues/catalogues/tkjogq.html russia visas] [http://www.lewakins.com/sr/images/gescmg.html net asset value method] [http://indianaoutfitters.com/s/info/tmp/bfkvld.html practical nurse scope of practice] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/lljuam.html works cited paper] [http://ankelia-nature.com/catalogues/catalogues/caveux.html the cure i will always love you lyric] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/ujoxvv.html evil woman tab] [http://roycemotor.com/carpics/cache/jbealo.html milf hunter christina] [http://www.biblored.org.co/agenda_actividades/programas/images/muvtpn.html radio rage the band] [http://www.lewakins.com/sr/images/mjrtnn.html schreiner co] [http://panties-pictures.com/free/lib/temp/nwemps.html montar negocio un] [http://smallbizbohol.com/democatalog/images/baner/urqvit.html kids printable calendars] [http://www.redacademica.edu.co/manejocorreo/Cliente/cache/fqjmfv.html pci express audio creative] [http://roycemotor.com/carpics/cache/kkoeto.html i dream of you every night] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/jcfhlr.html icc odi] [http://ankelia-nature.com/catalogues/catalogues/afaxph.html end mortgage open] [http://www.lewakins.com/sr/images/axhjwv.html picture sea splendour] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/nsicmn.html specific gravity formulas] [http://asie-voyages.com/upload/images/lens/objshk.html man older screwing] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/tvlabw.html sight word games] [http://www.hdac.org/hdfaq/faq/kwlrew.html and so it goes guitar tab] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/xvfimd.html resizing photos for email] [http://lumayagrealty.com/catalog/images/pics/cekqde.html maintenance costing] [http://smallbizbohol.com/democatalog/images/baner/kjleao.html world bank notes for sale] [http://talentmodeles.com/mannequin/images/cache/ardldu.html action games free online] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/ojxoqi.html 14 leadership traits usmc] [http://smallbizbohol.com/democatalog/images/baner/xcdmae.html application current electric in industry] [http://indianaoutfitters.com/s/info/tmp/kexwjd.html mobile real estate listings] [http://hoosierfishing.com/phpBB/images/avatars/avatar/rsglem.html patriotic music mp3] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/fdaohs.html midnight movie train] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/nsveha.html okc news channel 4]  
{{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