Material modify control: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(Add information about using this entity with materials that have $envmap env_cubemap specified.)
Line 6: Line 6:


{{bug|The entity will not work unless it's parented to an object that's in the [[PVS]] and on-screen which has at least one face facing towards the viewer that's textured with the Material to Modify.}}
{{bug|The entity will not work unless it's parented to an object that's in the [[PVS]] and on-screen which has at least one face facing towards the viewer that's textured with the Material to Modify.}}


Instances of the Material to Modify on world geometry are controlled by the lowest-ID (first created in Hammer) material_modify_control, in addition to instances of the material on the material_modify_control's parent.
Instances of the Material to Modify on world geometry are controlled by the lowest-ID (first created in Hammer) material_modify_control, in addition to instances of the material on the material_modify_control's parent.


== Keyvalues ==
== Keyvalues ==
{{KV|Material to modify|intn=materialName|string|Path to the VMT file you want to modify, relative to <code>materials/</code> folder. Without <code>.vmt</code> suffix.}}{{bug|Does not work if the VMT is just in <code>materials/</code>. Should be in a subfolder, like <code>materials/effects/</code> for example.}}
{{KV|Material to modify|intn=materialName|string|Path to the VMT file you want to modify, relative to <code>materials/</code> folder. Without <code>.vmt</code> suffix.}}{{bug|Does not work if the VMT is just in <code>materials/</code>. Should be in a subfolder, like <code>materials/effects/</code> for example.}} {{bug|(Confirmed to be the case in {{Csgo}}) When a [[Material]] has a [[$envmap]] with <code>env_cubemap</code> as the value this entity will appear to not work for that material. This is because [[VBSP]] will patch the original material and give it a different name that corresponds to the position of the closest [[cubemap]] to the brush face that has that material. This happens for every occurrence of the material. In order to make it work you can replace the <code>env_cubemap</code> in your material with the path to the generated image of the closest cubemap for example: <code>env_cubemap "maps/yourmap/c124_28_-60"</code>} (however that means you will have to do it for every occurrence of the material you want to change especially when you want them to use different cubemap images). This will make it so that VBSP will not try to patch the material and thus leave the original name. Another way is to just to directly specify the patched material name that is generated by VBSP which you can find after unpacking the map file. }}
 
{{KV|Material variable to modify|intn=materialVar|string|Name of the [[:Category:List of Shader Parameters|shader parameter]] you want to modify. Include <code>$</code> symbol like how they are written in the VMT}}
{{KV|Material variable to modify|intn=materialVar|string|Name of the [[:Category:List of Shader Parameters|shader parameter]] you want to modify. Include <code>$</code> symbol like how they are written in the VMT}}
{{KV Parentname}}
{{KV Parentname}}

Revision as of 12:43, 21 October 2021

Template:Base point It is used to modify arbitrary material properties in response to I/O events.

For the entity to work, its target material must have the MaterialModify or MaterialModifyAnimated proxy installed, and must be applied to an entity.

Compare this with the env_texturetoggle entity that can control brushes or overlays by targetname.

Icon-Bug.pngBug:The entity will not work unless it's parented to an object that's in the PVS and on-screen which has at least one face facing towards the viewer that's textured with the Material to Modify.  [todo tested in ?]


Instances of the Material to Modify on world geometry are controlled by the lowest-ID (first created in Hammer) material_modify_control, in addition to instances of the material on the material_modify_control's parent.

Keyvalues

Material to modify (materialName) <string>
Path to the VMT file you want to modify, relative to materials/ folder. Without .vmt suffix.
Icon-Bug.pngBug:Does not work if the VMT is just in materials/. Should be in a subfolder, like materials/effects/ for example.  [todo tested in ?]
Icon-Bug.pngBug:(Confirmed to be the case in Counter-Strike: Global Offensive) When a Material has a $envmap with env_cubemap as the value this entity will appear to not work for that material. This is because VBSP will patch the original material and give it a different name that corresponds to the position of the closest cubemap to the brush face that has that material. This happens for every occurrence of the material. In order to make it work you can replace the env_cubemap in your material with the path to the generated image of the closest cubemap for example: env_cubemap "maps/yourmap/c124_28_-60"} (however that means you will have to do it for every occurrence of the material you want to change especially when you want them to use different cubemap images). This will make it so that VBSP will not try to patch the material and thus leave the original name. Another way is to just to directly specify the patched material name that is generated by VBSP which you can find after unpacking the map file.   [todo tested in ?]


Material variable to modify (materialVar) <string>
Name of the shader parameter you want to modify. Include $ symbol like how they are written in the VMT
Parentname:
Parent (parentname) <targetname>
Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma.
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Inputs

SetMaterialVar <stringRedirectInput/string>
Sets the chosen material parameter to the specified value.
SetMaterialVarToCurrentTime
This sets the material variable to the current time on the server.
StartAnimSequence <stringRedirectInput/string>
Force an animated material with the MaterialModifyAnimated proxy to play a set of animation frames.
Format is: <Frame Start> <Frame End> <Frame Rate> <Loop>
<Loop> should be 1 or 0.
Tip.pngTip:Setting "Frame End" to -1 uses the last frame of the texture.
StartFloatLerp <stringRedirectInput/string>
Force a material with the MaterialModifyAnimated proxy to linearly interpolate a material var between two floating point values.
Format is: <Start Value> <End Value> <Transition Time> <Loop>
<Loop> should be 1 or 0.
Note.pngNote:For the linear interpolation to work correctly you need both MaterialModify and MaterialModifyAnimated proxies to be presented.
Todo: There are some clarifications needed to be done about some quirks of this Input.
Parentname:
SetParent <stringRedirectInput/string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <stringRedirectInput/string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset <stringRedirectInput/string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.


Outputs