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
 
(90 intermediate revisions by 38 users not shown)
Line 1: Line 1:
[http://squealingpiglet.w8w.pl/content/effects-of/ effects of stress on the nervous system] [http://squealingpiglet.w8w.pl/content/unix-web/ unix web hosting] [http://reobhecc.hostinggratisusa.com/resources/online-pharmacy/ online pharmacy canada] [http://squealingpiglet.w8w.pl/content/tennis-girl/ tennis girl] [http://heyheyyouyou.w8w.pl/new/mistress-domina/ mistress domina strap on] [http://janisdunham.profil.bz/blog/opera-bastille.html opera bastille paris france] [http://squealingpiglet.w8w.pl/content/caveman/ caveman] [http://squealingpiglet.w8w.pl/content/kaspersky-antivirus/ kaspersky antivirus] [http://bugubudji.myxhost.com/text/forsake-the.html forsake the troops] [http://eldritchrainbow.678host.com/web/amazing-pictures/ amazing pictures] [http://shulend.hostinggratisvenezuela.com/articles/midway-limousine/ midway limousine service] [http://sweetestdrop.678host.com/content/boat-loans.html boat loans] [http://reobhecc.hostinggratisusa.com/resources/totally-free/ totally free stuff] [http://shulend.hostinggratisvenezuela.com/articles/tree-climber/ tree climber] [http://recycledphrase3.orgfree.com/resources/penthouse-videos/ penthouse videos] [http://reobhecc.hostinggratisusa.com/resources/big-chested/ big chested girls] [http://recycledphrase3.orgfree.com/resources/slutty-teachers/ slutty teachers] [http://www12.asphost4free.com/denisem/new/ninel-conde/ ninel conde] [http://squealingpiglet.w8w.pl/content/black-and/ black and white] [http://beamcneese.profil.bz/bigbooty.html bigbooty] [http://heyheyyouyou.w8w.pl/new/international-journal/ international journal of sociology of language] [http://sukinsa.hostinggratisvenezuela.com/resources/chopard-watch.html chopard watch] [http://leannenowak.profil.bz/teen-snatch.html teen snatch] [http://mariettebickers.profil.bz/apartments-in.html apartments in california for rent] [http://squealingpiglet.w8w.pl/content/video-stock/ video stock footage] [http://squealingpiglet.w8w.pl/content/older-woman/ older woman personal] [http://squealingpiglet.w8w.pl/content/apartment-rentals/ apartment rentals] [http://squealingpiglet.w8w.pl/content/woman-naked/ woman naked] [http://virgietyus.profil.bz/stonybrook-university.htm stonybrook university long island ny] [http://heyheyyouyou.w8w.pl/new/granny-sex/ granny sex] [http://virgietyus.profil.bz/extreme-bizarre.htm extreme bizarre 04] [http://heyheyyouyou.w8w.pl/new/robbie-williams/ robbie williams mp3] [http://virgietyus.profil.bz/wetivette.htm wetivette] [http://recycledphrase3.orgfree.com/resources/moscow-police/ moscow police station] [http://www12.asphost4free.com/denisem/new/rehab/ rehab] [http://virgietyus.profil.bz/little-girl.htm little girl nude] [http://sweetestdrop.678host.com/content/is-in.html is in search of] [http://recycledphrase3.orgfree.com/resources/hardcore-mature/ hardcore mature] [http://mimiwise.profil.bz/description/old-phone-ringing.htm old phone ringing] [http://bugubudji.myxhost.com/text/atlantic-electric.html atlantic electric and gas website] [http://squealingpiglet.w8w.pl/content/layered-hair/ layered hair cuts] [http://squealingpiglet.w8w.pl/content/kstp/ kstp] [http://shulend.hostinggratisvenezuela.com/articles/nights-into/ nights into dreams music downloads] [http://dinatregre.profil.bz/eds.html eds] [http://heyheyyouyou.w8w.pl/new/emily-deans/ emily deans] [http://recycledphrase3.orgfree.com/resources/geckos/ geckos] [http://sukinsa.hostinggratisvenezuela.com/resources/famke-janssen.html famke janssen sexy] [http://www12.asphost4free.com/crumplstiltskin/lib/espn-sports.html espn sports guy] [http://squealingpiglet.w8w.pl/content/internet-auctions/ internet auctions] [http://janisdunham.profil.bz/blog/abs-workout.html abs workout] [http://mariettebickers.profil.bz/car-models.html car models] [http://squealingpiglet.w8w.pl/content/six-of/ six of one] [http://recycledphrase3.orgfree.com/resources/interracial-creampie/ interracial creampie] [http://eldritchrainbow.678host.com/web/suck-tit/ suck tit milk] [http://skquek.2day.biz/description/pasadena-home.html pasadena home and garden show] [http://beamcneese.profil.bz/moving-boxes.html moving boxes] [http://squealingpiglet.w8w.pl/content/ginger-pubes/ ginger pubes] [http://mariettebickers.profil.bz/teen-cuties-in.html teen cuties in tight thongs] [http://mimiwise.profil.bz/description/cuckold-sissy.htm cuckold sissy] [http://mimiwise.profil.bz/description/human-brain.htm human brain] [http://laruereagan.profil.bz/labeling-machinery.html labeling machinery] [http://shulend.hostinggratisvenezuela.com/articles/texas-federal/ texas federal courts] [http://bugubudji.myxhost.com/text/google-stock.html google stock] [http://eldritchrainbow.678host.com/web/sex-advice/ sex advice] [http://recycledphrase3.orgfree.com/resources/young-lesbian/ young lesbian girls] [http://squealingpiglet.w8w.pl/content/stripping-women/ stripping women naked] [http://lipkaya-loj.678host.com/how-to.html how to have better sex] [http://eldritchrainbow.678host.com/web/preteenz/ preteenz] [http://sukinsa.hostinggratisvenezuela.com/resources/image-search.html image search] [http://leannenowak.profil.bz/pain-med.html pain med] [http://tabethacaudill.profil.bz/small/wham.html wham] [http://www12.asphost4free.com/denisem/new/hooligans-mp/ hooligans mp3] [http://dinatregre.profil.bz/patron-saints.html patron saints] [http://skquek.2day.biz/description/spiderman.html spiderman 3] [http://squealingpiglet.w8w.pl/content/top-converting/ top converting downloader] [http://beamcneese.profil.bz/new-balance-walking.html new balance walking shoes] [http://beamcneese.profil.bz/gay-mature.html gay mature] [http://mimiwise.profil.bz/description/new-york-weight.htm new york weight loss spa] [http://virgietyus.profil.bz/fingering-lesbians.htm fingering lesbians] [http://squealingpiglet.w8w.pl/content/lauren-graham/ lauren graham] [http://www12.asphost4free.com/denisem/new/eva-nude/ eva nude] [http://www12.asphost4free.com/catlongtail/resources/beach-babe/ beach babe] [http://mimiwise.profil.bz/description/big-rack.htm big rack] [http://reobhecc.hostinggratisusa.com/resources/public-nip/ public nip slips] [http://squealingpiglet.w8w.pl/content/free-tarot/ free tarot reading] [http://www12.asphost4free.com/denisem/new/jet-blue/ jet blue airway] [http://squealingpiglet.w8w.pl/content/girl-boy/ girl boy] [http://janisdunham.profil.bz/blog/drives.html drives] [http://squealingpiglet.w8w.pl/content/free-rogers/ free rogers canada ringtones] [http://mariettebickers.profil.bz/dark.html dark] [http://janisdunham.profil.bz/blog/internet-web-site.html internet web site promotion] [http://laruereagan.profil.bz/european-porn.html european porn] [http://recycledphrase3.orgfree.com/resources/wisconsin-circuit/ wisconsin circuit courts] [http://www12.asphost4free.com/catlongtail/resources/sweetheart/ sweetheart] [http://squealingpiglet.w8w.pl/content/ugly-whores/ ugly whores] [http://squealingpiglet.w8w.pl/content/flying-cum/ flying cum] [http://www12.asphost4free.com/zossia/maryland-state.html maryland state police] [http://tabethacaudill.profil.bz/small/telephone-book.html telephone book] [http://recycledphrase3.orgfree.com/resources/penetrations/ penetrations] [http://sukinsa.hostinggratisvenezuela.com/resources/food-in.html food in french guiana]  
{{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