env_projectedtexture

From Source Entities
Jump to navigation Jump to search

Code classes:

env_projectedtexture is a point entity present in all Source games. It projects a texture onto the environment, simulating a realistic spotlight.

Note: VDC has a page for code fixes related to this entity.

Note: Only one of these should be be active in the PVS at a time to avoid issues. This limit includes the player's own flashlight in games with one! Mods can fix these problems: [1]

Bug: In Portal 2, some Nvidia graphics cards render white specks or squares on certain textures.

Fix: This apparently happens due to Valve creating undefined behavior which Nvidia later did define. Until Valve actually fixes it, (and understand that they've already had years to) all that can be done is to remove the bumpmap ($bumpmap or $ssbump) or $detailblendmode 0 from the bugged textures.

Bug: Does not move correctly when parented in L4d2-small.png and earlier games.

Fix: See here for a code fix.

Bug: Does not work at all in P1.png.

Bug: Shadows are missing on some systems, even in Valve maps. Putting -force_vendor_id 0x10DE -force_device_id 0x1180 -dxlevel 95 in your launch options may fix this.

ConVars/Commands[edit | edit source]

ConVar/CommandParameters or default valueParameter TypeEffect
create_flashlight<optional string>targetnameCreates an env_projectedtexture with position and angles matching the player's view. Optionally, a targetname can be assigned.

Flags[edit | edit source]

  • 1: Start enabled
  • 2: Always Update (moving light) (available in all games since Asw.png)

Keyvalues[edit | edit source]

Target (target) <target_destination>
The entity will rotate to point at this target.
FOV (lightfov) <float>
The field of view cone/pyramid at which the texture is projected.
Confirm: This keyvalue does not work in Alien Swarm.
NearZ (nearz) <float>
Objects closer than this will not receive the light from the projection.
FarZ (farz) <float>
Objects beyond this distance will not receive the light from the projection.
Enable Shadows (enableshadows) <boolean>
Enables/disables shadows from this projected texture.
Shadow Quality (shadowquality) <choices>
Quality of shadows.
  • 0: Low (sharp, pixelated shadows)
  • 1: High (smooth edged shadows)
Light Only Target (lightonlytarget) <boolean>
Limit flashlight effect to only affect the Target entity. Does not change lighting on world geometry.
Light World (lightworld) <boolean>
Control whether flashlight affects static world geometry.
Light Color (lightcolor) <color255>
RGB light color. Fourth number is the brightness.
Camera Space (cameraspace) <boolean>
If the entity has a Target, makes the projected texture rotate relative to the player's camera. If used, set Pitch Yaw Roll to 0 0 0.
Texture Name (texturename) <material>
Texture this entity projects.
Texture Frame (Not in FGD) (textureframe) <int>
If the texture is animated, this is the frame it should begin on.
Simple Projection (simpleprojection) <boolean> (available in all games since Asw.png)
If set, textures that are projected onto will become missing.
Simple Projection Size (Not in FGD) (projection_size) <float> (available in all games since Asw.png)
To do: Description.
Simple Projection Rotation (Not in FGD) (projection_rotation) <float> (available in all games since Asw.png)
To do: Description.
Brightness Scale (brightnessscale) <float> (available in all games since Asw.png)
Multiplies the Light Color to otherwise unobtainable RGB values. Does affect the brightness setting.
Color Transition Time (colortransitiontime) <float> (available in all games since Asw.png)
Amount of time it takes for a color change to occur. Higher numbers cause faster transitions.
Appearance (style) <choices> (available in all games since P2.png)
Various Custom Appearance presets.
Custom Appearance (pattern) <string> (available in all games since P2.png)
Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where a is total darkness, and z is fully bright. i.e. aaggnnttzz would be a steppy fade in from dark to light.
Default Appearance (defaultstyle) <string> (available in all games since P2.png)
To do: Description.

Inputs[edit | edit source]

Note: In some FGDs, only TurnOn, TurnOff and FOV are present.

TurnOn
Turns on the texture.
TurnOff
Turns off the texture.
FOV <float>
Sets FOV.
EnableShadows <bool>
Sets Enable Shadows.
SpotlightTexture <string>
Sets the spotlight texture. In some games, this input is disabled.
Target <target_destination>
Sets Target.
CameraSpace <boolean>
Sets Camera Space.
LightOnlyTarget <boolean>
Sets Light Only Target.
LightWorld <int>
Sets Light World.
AlwaysUpdateOn  (available in all games since Asw.png)
Turn on per frame updating (for moving lights).
AlwaysUpdateOff  (available in all games since Asw.png)
Turn off per frame updating (for moving lights).
LightColor <color255> (available in all games since Asw.png)
Sets Light Color.
SetLightStyle <integer> (available in all games since P2.png)
Sets an Appearance.
SetPattern <string> (available in all games since P2.png)
Sets Custom Appearance.
SetNearZ <float> (available in all games since P2.png)
Sets NearZ.
SetFarZ <float> (available in all games since P2.png)
Sets FarZ.