Env projectedtexture: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(updated)
Line 1: Line 1:
{{wrongtitle|title=env_projectedtexture}}
{{wrongtitle|title=env_projectedtexture}}
{{base_point_ep1}}[[Category: GUI Entities]][[Category:Snippets]]
{{base_point_ep2}}[[Category: GUI Entities]][[Category:Snippets]]


== Entity Description ==
[[Image:Shadowmap.jpg|thumb|Casting shadows.]]
[[Image:Shadowmap.jpg|thumb|Casting shadows.]]


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


<!-- feature appears to be disabled
{{bug|Does not accept a configurable texture value from Hammer - will always default to the flashlight. You must use the <code>SpotlightTexture</code> [[input]] instead.}}
{{bug|Does not accept a configurable texture value from Hammer - will always default to the flashlight. You must use the <code>SpotlightTexture</code> [[input]] instead.}}
 
-->
== Enabling multiple shadow maps ==
=== 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 <code>enableshadows</code> KV, or for a proper solution a programmer can perform this C++ fix:
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 <code>enableshadows</code> KV, or for a proper solution a programmer can perform this C++ fix:
Line 24: Line 26:
[[Image:Gmbricks0051mn4.jpg|thumb|Projecting a texture.]]
[[Image:Gmbricks0051mn4.jpg|thumb|Projecting a texture.]]


* {{kv targetname}}
*; target <target_destination>  
;target
: The entity will rotate to point at its target, no matter where it is in the world. See also <code>lightonlytarget</code>.
: <target_destination> The entity will rotate to point at its target, no matter where it is in the world. See also <code>lightonlytarget</code>.
: {{bug|Can get glitchy.}}
:{{bug|Can get glitchy.}}
 
;lightfov <float>
*; lightfov <float>
: The angle at which the texture is projected. The projection is square, but the texture can make it appear of any shape.
: The angle at which the texture is projected. The projection is square, but the texture can make it appear of any shape.
;enableshadows {{boolean}}
: Remember the default Player FOV is 75&deg;.
: Should I cast shadows?
 
;lightonlytarget {{boolean}}
*; 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.
 
*; enableshadows {{boolean}}
: Should I cast (dynamic) shadows?
: 0 = No, 1 = Yes.
 
*; shadowquality {{boolean}}
: Quality of (dynamic) shadows?
: 0 = Low, 1 = High.
 
*; lightonlytarget {{boolean}}
: Should I light only the entity that is my <code>target</code>?
: Should I light only the entity that is my <code>target</code>?
:{{bug|Non-functional.}}
: 0 = No, 1 = Yes.
;lightworld {{boolean}}
: {{bug|Non-functional.}}
 
*; lightworld {{boolean}}
: Should I light world [[brush]]es?
: Should I light world [[brush]]es?
;cameraspace {{boolean}}
 
*; cameraspace {{boolean}}
: Display relative to player's view. Breaks things horribly unless the entity moves with the player.
: Display relative to player's view. Breaks things horribly unless the entity moves with the player.
;lightcolor {{color}}
 
*; lightcolor {{color}}
: Projected color
: Projected color
:{{bug|Non-functional.}}
<!-- : {{bug|Non-functional.}} // appears to be fixed in ep2 test -->
 
* {{kv parentname}}
* {{kv angles}}
* {{kv targetname}}


==Flags==
==Flags==
*1 : Enabled
* 1 : Enabled


==Inputs==
==Inputs==
* {{i targetname}}
*; TurnOn
;TurnOn
 
;TurnOff
*; TurnOff
;FOV <float>
 
:See above keyvalues.
*; FOV <float>
;target <entity>
: See lightfov keyvalue above.
:See above keyvalues.
 
;cameraspace <bool>
<!-- the special inputs below are not specified in base.fgd ... have they been removed?
:See above keyvalues.
*; target <entity>
;LightOnlyTarget <bool>
: Specify a new <target_desination> entity.
:See above keyvalues.
*; cameraspace <bool>
:{{bug|Non-functional.}}
: See above keyvalues.
;LightWorld <bool>
*; LightOnlyTarget <bool>
:See above keyvalues.
: See above keyvalues.
:{{bug|Cannot be re-enabled.}}
: {{bug|Non-functional.}}
;EnableShadows <bool>
*; LightWorld <bool>
:See above keyvalues.
: See above keyvalues.
: {{bug|Cannot be re-enabled.}}
*; EnableShadows <bool>
: See above keyvalues.
;Ambient <float>
;Ambient <float>
;SpotlightTexture <VTF/string>
;SpotlightTexture <VTF/string>
:A [[Valve Texture Format|VTF]] file (not VMT), relative to <code>/models</code>.
:A [[Valve Texture Format|VTF]] file (not VMT), relative to <code>/models</code>.
-->
* {{i parentname}}
* {{i targetname}}


==Outputs==
==Outputs==
* {{o targetname}}
* {{o targetname}}

Revision as of 15:52, 13 April 2008

Template:Wrongtitle Template:Base point ep2

Entity Description

Casting shadows.

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

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 a texture.
  • target <target_destination>
The entity will rotate to point at its target, no matter where it is in the world. See also lightonlytarget.
Icon-Bug.pngBug:Can get glitchy.  [todo tested in ?]
  • 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.
Icon-Bug.pngBug:Non-functional.  [todo tested in ?]
Should I light world brushes?
Display relative to player's view. Breaks things horribly unless the entity moves with the player.
  • lightcolor #000000
Projected color

Flags

  • 1 : Enabled

Inputs

  • TurnOn
  • TurnOff
  • FOV <float>
See lightfov keyvalue above.

Outputs