Env projectedtexture: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (minoro)
(cleanup + how to enable multiple shadow maps)
Line 1: Line 1:
{{wrongtitle|title=env_projectedtexture}}
{{wrongtitle|title=env_projectedtexture}}


== Entity description ==
[[Image:Shadowmap.jpg|thumb|Casting shadows.]]
[[Image:Gmbricks0051mn4.jpg|thumb|150px|Example of an env_projectedtexture.]]


A light emitting entity that casts dynamic shadows; similar to the flashlight.
Creates a dynamic shadow-casting light that affects all objects in the world. Used for the [[Episode Two]] flashlight.


This entity, when used, disables the use of your flashlight. Only use it if you do not need a flashlight at any time in your map. However, this limitation has been fixed in the latest version of [[Garry's Mod]].
== Enabling multiple shadow maps ==
{{clr}}
 
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 with the <code>enableshadows</code> KV, or for a proper solution a programmer can perform this fix:
 
''CClientShadowMgr::Init()''
- <span style="color: red">bool bTools = CommandLine()->CheckParm( "-tools" ) != NULL;</span>
- <span style="color: red">m_nMaxDepthTextureShadows = bTools ? 4 : 1; // Just one shadow depth texture in games, more in tools</span>
+ <span style="color: green">m_nMaxDepthTextureShadows = YOUR_CHOSEN_MAX;</span>
 
[[Garry's Mod]] has already had this done. Thanks to Garry for sharing the code!


==Keyvalues==
==Keyvalues==
[[Image:Gmbricks0051mn4.jpg|thumb|Projecting a texture.]]
* {{kv targetname}}
* {{kv targetname}}
* '''target'''
* '''target'''
Line 39: Line 50:


[[Category:Half-Life 2: Episode One Entities]]
[[Category:Half-Life 2: Episode One Entities]]
[[Category:Snippets]]

Revision as of 10:28, 6 April 2008

Template:Wrongtitle

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 with the enableshadows KV, or for a proper solution a programmer can perform this 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_destination> Light target
  • lightfov
<float> Light's FOV
  • enableshadows
<boolean> Cast shadows
  • lightonlytarget
<boolean> Light only target
  • lightworld
<boolean> Light world
  • cameraspace
<boolean> Relative to player's view
  • lightcolor
#000000 Projected color

Flags

  • 1 : Enabled

Inputs

Outputs