Env projectedtexture

From Valve Developer Community

This Point-based Entity is available in all Source Games using the Orange Box engine.

Table of contents

Entity Description

Casting shadows.
Enlarge
Casting shadows.

Creates a dynamic shadow-casting light that affects all objects in the world. Used for the Episode Two flashlight.

Bug.png Bug: Does not accept a configurable texture value from Hammer - will always default to the flashlight. You must use the SpotlightTexture input instead.

Enabling multiple shadow maps

Valve's games only allow one projected texture to cast shadows at a time - including the player's flashlight! To surmount this, shadow casting can be disabled on each entity with the enableshadows KV, or for a proper solution a programmer can perform this C++ fix:

CClientShadowMgr::Init()
	- bool bTools = CommandLine()->CheckParm( "-tools" ) != NULL;
	- m_nMaxDepthTextureShadows = bTools ? 4 : 1;	// Just one shadow depth texture in games, more in tools

	+ m_nMaxDepthTextureShadows = YOUR_CHOSEN_MAX;

Garry's Mod has already had this done. Thanks to Garry for sharing the code!

Keyvalues

Projecting shadows.
Enlarge
Projecting shadows.
  • target <target_destination>
The entity will rotate to point at its target, no matter where it is in the world. See also lightonlytarget.
Bug.png Bug: Can get glitchy.
  • lightfov <float>
The angle at which the texture is projected. The projection is square, but the texture can make it appear of any shape.
Remember the default Player FOV is 75°.
  • nearz <float>
Near Z for projected texture. Default value is 4.0.
Objects closer than this will not receive the projection.
  • farz <float>
Far Z for projected texture. Default value is 750.0.
Objects beyond this distance will not receive the projection. Think of it as the range limit.
Should I cast (dynamic) shadows?
0 = No, 1 = Yes.
Quality of (dynamic) shadows?
0 = Low, 1 = High.
Should I light only the entity that is my target?
0 = No, 1 = Yes.
Bug.png Bug: Non-functional.
Should I light world brushes?
Display relative to player's view. Breaks things horribly unless the entity moves with the player.
Projected color
Specifies the targetname of this entity's Parent in a movement hierarchy. Child entities move with their Parent.
Pitch Yaw Roll (Y Z X)
This entity's angular orientation in the world (also used for angular effect entities).
Defines the name that other entities refer to this entity by.
  • hammerid [Episode Two Update]
<integer readonly> This id is used for debugging purposes in Hammer.

Flags

  • 1 : Enabled

Inputs

  • TurnOn
  • TurnOff
  • FOV <float>
See lightfov keyvalue above.
Changes the entity's parent in the movement hierarchy.
Change this entity to attach to a specific attachment point on its parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment.
Change this entity to attach to a specific attachment point on it's parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment. The entity will maintain it's position relative to the Parent's Origin and Angles at the time it is attached.
Removes this entity from its current movement hierarchy.
  • Kill
Removes this entity from the world.
Removes this entity and all its children from the world.
  • AddOutput <string>
Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>
Causes this entity's OnUser1-4 outputs to be fired. See User Inputs and Outputs.

Inputs not in FGD

These inputs are not known to Hammer, but are still accepted by the entity:

  • target <entity>
Specify a new <target_desination> entity.
  • cameraspace <bool>
See above keyvalues.
  • LightOnlyTarget <bool>
See above keyvalues.
Bug.png Bug: Non-functional.
  • LightWorld <bool>
See above keyvalues.
Bug.png Bug: Cannot be re-enabled.
  • EnableShadows <bool>
See above keyvalues.
  • Ambient <float>
    SpotlightTexture <VTF/string>
A VTF file (not VMT), relative to /models.

Outputs

Fired in response to FireUser1-4 inputs. See User Inputs and Outputs.
!activator = activator