User:Yakumo koishi/env projectedtexture:zh-cn: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 24: Line 24:
*在多人游戏里,<code>mat_supportflashlight</code>必须被设置为1才能让手电筒正常工作,在[[Team Fortress 2|TF2]]中,这个[[Cvar|指令]]默认被禁用,故没有特殊修改的话,该实体无法在TF2中使用
*在多人游戏里,<code>mat_supportflashlight</code>必须被设置为1才能让手电筒正常工作,在[[Team Fortress 2|TF2]]中,这个[[Cvar|指令]]默认被禁用,故没有特殊修改的话,该实体无法在TF2中使用
*[[Viewmodel|手臂模型]]不会接收来自投射纹理的任何光照和阴影,除了[[Garry's mod|Gmod]]和[[Portal 2|传送门2]]您可以[[env_projectedtexture/fixes#Enabling shadow receiving on the view model|按照该教程]]修复这个Bug。
*[[Viewmodel|手臂模型]]不会接收来自投射纹理的任何光照和阴影,除了[[Garry's mod|Gmod]]和[[Portal 2|传送门2]]您可以[[env_projectedtexture/fixes#Enabling shadow receiving on the view model|按照该教程]]修复这个Bug。
{{bug|在传送门2中,部分英伟达显卡会在某些纹理上呈现白色斑点或方块(老黄出来挨打)。要解决此问题,请移除该纹理的[[Bumpmap|法线贴图]]($bumpmap或$ssbump)或[[$detail|细节纹理]]}}
{{bug|在传送门2中,部分英伟达显卡会在某些纹理上呈现白色噪点或方块(老黄出来挨打)。要解决此问题,请移除该纹理的[[Bumpmap|法线贴图]]($bumpmap或$ssbump)或[[$detail|细节纹理]]}}
: [https://www.youtube.com/watch?v=PJ1mnJHln5Q Video of said bug.]
: [https://www.youtube.com/watch?v=PJ1mnJHln5Q 描述此bug的视频]
{{bug|In Portal 2, while running in DirectX 9 mode, some graphics cards will not render shadows from <code>env_projectedtexture</code> regardless of the shadow detail setting. To fix this, run the game in Vulkan mode with the launch parameter <code>-vulkan</code>.}}
{{bug|在传送门2中,当游戏在DirectX 9模式下运行时,无论阴影质量设置如何,在某些显卡上<code>env_projectedtexture</code>都不会渲染阴影。要解决此问题,请在启动参数添加<code>-vulkan</code>,让游戏在Vulkan模式下运行。}}
{{bug|Parenting does not work with stock SDK code.}}
{{bug|实体绑定在原版SDK代码中无法使用}}
: {{fix|This bug is fixable by following these instructions: [[Env_projectedtexture/fixes#Fixing Parenting]].|code}}
: {{fix|可以按照该教程修复此bug[[Env_projectedtexture/fixes#Fixing Parenting]].|code}}
{{bug|{{csgo}} No smooth transition between this light and {{ent|env_cascade_light}}.}}
{{bug|{{csgo}}投射纹理与{{ent|env_cascade_light}}之间没有平滑过渡}}}}
===Source 2007/2009 bugs===
These have all been fixed in more recent engine builds.<!--Do we really still need this section? These issues are fixed now, yes?-->


{{bug|The configurable texture value from Hammer is not accepted - will always default to the flashlight. You must use the <code>SpotlightTexture</code> [[input]] or you can also override the actual contents of the default VTF with a new one.}}
==实体属性==
: {{fix|You can fix this issue by following these instructions: [[Env_projectedtexture/fixes#Fix_configurable_texture_value_in_Hammer]].|code}}
*1: Enabled(默认开启)
{{note|The <code>SpotlightTexture</code> input has been disabled in the Portal 2 and CS:GO engines, and instead shows an error message: "SetSpotlightTexture is disabled. If you need this feature reimplemented, tell a programmer."}}
*2: Always Update(始终更新,用于移动光源){{AS_add:zh-cn}}{{Mapbase also:zh-cn}}
 
{{bug|The entity cannot target another entity.}}
: {{fix|This bug is fixable by following these instructions: [[env_projectedtexture/fixes#Fixing targeting]].|code}}
{{bug|[[Model]]s will not receive their own shadows correctly unless using [[$bumpmap]]. Even a flat bump map is sufficient.}}
{{bug|Causes issues if the entity overlaps a portal in [[Portal|Portal 1]]. Simply the projection overlapping a portal works fine.}}
 
==Flags==
*1: Enabled
*2: Always Update (moving light){{AS add}}{{Mapbase also}}


==Keyvalues==
==Keyvalues==

Revision as of 17:00, 24 December 2021

English (en)
Env_projectedtexture有着不同的外观
Gmod中投射一个彩色纹理
传送门2大量使用投射纹理作为地图光照
Portal 2: Community Edition在原版传送门2地图上的体积光效果

Source env_projectedtexture是一个存在于所有的 Source 游戏自从 Template:Name=Half-Life 2: Episode One 以来的点实体。它投射一个纹理作为一个动态光源,可以影响地图内所有的物体。还可以选择使用阴影贴图。 投射纹理不像其他光照实体的光照一样是预先生成的,这种光是在游戏内实时计算的,地图本身不需要经过VRAD处理就可以使用。

Template:Warning:zh-cn


Todo: This template is currently using deprecated suf or {{Lang}}-based translations. Please use the main {{Code class}} instead, which uses {{Autolang}}.

在源代码中,它由 class CEnvProjectedTexture 代表,定义于 env_projectedtexture.cpp


注意事项与Bug修复

主条目:Env_projectedtexture/fixes
  • V社的游戏仅支持在同一时间内在PVS里渲染一个阴影贴图
Template:Note:zh-cn
Warning.pngWarning:Counter-Strike: Global Offensive中,无论阴影质量设置如何,都只能在地图内使用一个投射纹理
Note.pngFix:可以遵循该教程修改/删除此限制。
  • 被投射的纹理需要勾选Clamp S, Clamp T and Clamp All选项,以避免突兀的平铺。以及,投射纹理是直接使用VTF的,不需要VMT
Note.pngNote:Gmod中,可以同时有9个启用的env_projectedtextures。你还可以在启动参数中添加-numshadowtextures #以提高上限。 # 是游戏应允许的阴影贴图数量。
Note.pngNote:Portal 2: Community Edition将此上限提高到了8
Note.pngNote:Mapbase里,你可以同时使用4个投射纹理。 这个上限可以通过启动参数-numshadowtextures #或者gameinfo.txt中的CommandLine部分来增加。
  • 仅当玩家的阴影质量设置为“高”时才能显示投射纹理。如果您的阴影质量设置里不显示这一选项,你可以在游戏的启动参数里添加-force_vendor_id 0x10DE -force_device_id 0x1180<、code>来强制显示
  • Note.pngNote:Counter-Strike: Global Offensive里,env_projectedtexture产生的阴影在阴影质量设置为“低”时显示
  • 在多人游戏里,mat_supportflashlight必须被设置为1才能让手电筒正常工作,在TF2中,这个指令默认被禁用,故没有特殊修改的话,该实体无法在TF2中使用
  • 手臂模型不会接收来自投射纹理的任何光照和阴影,除了Gmod传送门2您可以按照该教程修复这个Bug。
Icon-Bug.pngBug:在传送门2中,部分英伟达显卡会在某些纹理上呈现白色噪点或方块(老黄出来挨打)。要解决此问题,请移除该纹理的法线贴图($bumpmap或$ssbump)或细节纹理  [todo tested in ?]
描述此bug的视频
Icon-Bug.pngBug:在传送门2中,当游戏在DirectX 9模式下运行时,无论阴影质量设置如何,在某些显卡上env_projectedtexture都不会渲染阴影。要解决此问题,请在启动参数添加-vulkan,让游戏在Vulkan模式下运行。  [todo tested in ?]
Icon-Bug.pngBug:实体绑定在原版SDK代码中无法使用  [todo tested in ?]
Cpp.pngCode Fix:可以按照该教程修复此bugEnv_projectedtexture/fixes#Fixing Parenting.
Icon-Bug.pngBug:Counter-Strike: Global Offensive投射纹理与env_cascade_light之间没有平滑过渡  [todo tested in ?]

}}

实体属性

Keyvalues

Target (target) <targetname>
The entity will rotate to point at this target. Make sure you check the Always update flag if you set this.
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. 0 = no, 1 = yes.
Shadow Quality (shadowquality) <choices>
Quality of shadows.
  • 0: Low (sharp, pixelized shadows)
  • 1: High (smooth edged shadows)
Light Only Target (lightonlytarget) <boolean>
Limit flashlight effect to only affect target entity.
Light World (lightworld) <boolean>
Control whether flashlight affects static world geometry. 0 = no, 1 = yes.
Light Color (lightcolor) <color255 + int>
Light color and intensity.
Camera Space (cameraspace) <integer>
Angles are interpreted as being relative to camera.
Texture Name (texturename) <string> !FGD
The texture which this entity projects. Must be a VTF file (not VMT), relative to /materials.
Texture Frame (textureframe) <integer> !FGD
If the texture is animated, this is the frame it should begin on.
Simple Projection (simpleprojection) <boolean> (in all games since Alien Swarm) !FGD
Indicates if this is a simple, non-light casting texture projection.
Simple Projection Size (projection_size) <float> (in all games since Alien Swarm) !FGD
Size of the simple projection.
Simple Projection Rotation (projection_rotation) <float> (in all games since Alien Swarm) !FGD
Brightness Scale (brightnessscale) <float> (in all games since Alien Swarm) (also in Mapbase)
Scale the light color by this brightness.
Color Transition Time (colortransitiontime) <float> (in all games since Alien Swarm) (also in Mapbase)
Amount of time it takes for a color change to occur. Higher numbers cause faster transitions.
Appearance (style) <choices> (in all games since Portal 2) (also in Garry's Mod)
Various Custom Appearance presets.
Note.pngNote:Requires input AlwaysUpdateOn to work.

Template:Light appearances

Custom Appearance (pattern) <string> (in all games since Portal 2) (also in Garry's Mod)
Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where a is total darkness, z fully bright. i.e. aaggnnttzz would be a steppy fade in from dark to light.
Default Appearance (defaultstyle) <string> (in all games since Portal 2)
Enable Volumetrics (volumetric) <boolean> (only in Portal 2: Community Edition)
Whether or not to use volumetrics for this projected texture.
Volumetric Intensity (volumetricintensity) <float> (only in Portal 2: Community Edition)
Defines the intensity of the volumetrics. (Default is 1. Can go above; no strict limit)


Inputs

Note.pngNote:In some FGDs, only TurnOn, TurnOff and FOV are present.
TurnOn
Turns on the texture.
Confirm:In gmod projected lights always start on even when "enabled" is not checked.
TurnOff
Turns off the texture.
FOV <float>
Sets FOV.
EnableShadows <boolean>
Set the if shadows are enabled. 0 = no, 1 = yes.
SpotlightTexture <string>
Sets the spotlight texture.
Note.pngNote:Disabled in Portal 2 onwards. Fixed in Portal 2: Community Edition
Target <string>
Specify a new Target entity to point at.
CameraSpace <boolean>
Sets Camera Space.
LightOnlyTarget <boolean>
Sets Light Only Target.
LightWorld <integer>
Sets Light World. 0 = no, 1 = yes.
AlwaysUpdateOn  (in all games since Alien Swarm) (also in Mapbase)
Turn on per frame updating (for moving lights).
AlwaysUpdateOff  (in all games since Alien Swarm) (also in Mapbase)
Turn off per frame updating (for moving lights).
LightColor <color255> (in all games since Alien Swarm) (also in Mapbase)
Change the Light Color.
SetBrightness <float> (only in Mapbase)
Sets the brightness.
SetLightStyle <integer> (in all games since Portal 2) (also in Garry's Mod)
Sets an Appearance. (see Appearance keyvalue above for possible values)
SetPattern <string> (in all games since Portal 2) (also in Garry's Mod)
Sets Custom Appearance. (see Custom Appearance keyvalue above)
SetNearZ <float> (in all games since Portal 2) (also in Garry's Mod)
Sets NearZ.
SetFarZ <float> (in all games since Portal 2) (also in Garry's Mod)
Sets FarZ.
EnableVolumetrics <boolean> (only in Portal 2: Community Edition)
Enables or disables volumetrics.
SetVolumetricIntensity <float> (only in Portal 2: Community Edition)
Sets the intensity of the volumetrics. (Default is 1. Can go above; no strict limit)
SetBrightnessScale <float> (only in Portal 2: Community Edition)
Sets the brightness.


Outputs