Zh/VMT: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(Created page with "{{subst:#if: Translation of 'VMT' to '中文' via Template:LanguageBar buttons * * * * * * * * * * * * * * * * * * * * * * * * * * * *...")
 
No edit summary
 
Line 1: Line 1:
{{subst:#if:|||{{LAuto/t}}
{{LanguageBar}}
 
--- DON'T JUST BLINDLY DELETE THIS PART. DO REPLACE THE LINKS AND CATEGORIES. THE PICTURE SHOWS HOW TO USE IT ! ---
 
SEARCH FOR:
\[\[(?!#|File(?:[ _]talk)?:|Image(?:[ _]talk)?:|Media:|Template(?:[ _]talk)?:|MediaWiki(?:[ _]talk)?:|Talk:|Category[ _]talk:|Project[ _]talk:|Valve[ _]Developer[ _]Community[ _]talk:|Help[ _]talk:|User(?:[ _]talk)?:|c:|commons:|Dictionary:|Google:|GoogleGroups:|IMDB:|M:|Meta:|Metawikipedia:|MW:|SdkBug:|SourceForge:|Steampowered:|W:|Wiki:|WikiBooks:|Wikipedia:|Wikiquote:|Wiktionary:|WP:)(:?(?:Category|Category|Help|Project|Valve[ _]Developer[ _]Community|Special|)(?:[^\|\]]+))(\|?.*?)\]\]
 
REPLACE WITH:
{{subst:LAuto|$1$2}}


}}{{wip}}{{translating}}
本简体中文页面由 [[User:458901357|Kutaka0303]] 汉化。
{{LanguageBar}}
{{toc-right}}


{{todo|Move engine-agnostic stuff to [[material]].}}
{{todo|将与引擎无关的内容移至 {{L|material|材质(Material)}}部分。}}
A '''VMT''' ("Valve Material") file defines the [[material]] used by a two-dimensional surface. It contains all of the information needed for {{src|4}} to simulate the surface visually, aurally, and physically.<br>If a material is missing, it will produce the infamous Source pink and black checkered pattern. A white wireframe is not a missing material, but instead a missing [[shader]].
'''VMT''' ("Valve Material") 文件定义了二维表面所使用的 {{L|Texture|纹理(Texture)}} 。 它包含了 {{src|4}} 引擎模拟表面的视觉、听觉和物理特性所需的所有信息。<br>如果材质缺失,将会出现著名的 Source 紫黑格子图案。白色线框不是材质缺失,而是 {{L|shader|着色器(shader)}}缺失。


__TOC__
__TOC__


材质的内容可归入以下某些或全部类别之中:


The contents of a material will fall into some or all of these categories:
# {{L|Texture|纹理(Texture)}} 名称
 
# {{L|$surfaceprop|Physical surface}} {{L|Material surface properties|types}}
# [[Texture]] names
# {{LCategory|Shaders|Shader}} {{LCategory|List of Shader Parameters|parameters}}
# [[$surfaceprop|Physical surface]] [[Material surface properties|types]]
# {{L|Material Map Compile Flags|材质编译标志}}
# [[:Category:Shaders|Shader]] [[:Category:List of Shader Parameters|parameters]]
# {{en}} [[Material optimization|回退设置]]
# [[Material Map Compile Flags|Special compile properties]]
# {{en}} [[Material Proxy|材质代理(Material Proxy)]]
# [[Material optimization|Fallbacks]]
# [[Material Proxy|Proxies]]


== A simple example ==
== 一个简单的例子 ==
{{CodeBlock|<nowiki>LightmappedGeneric
{{CodeBlock|<nowiki>LightmappedGeneric
{
{
Line 33: Line 24:
$surfaceprop gravel
$surfaceprop gravel
}</nowiki>}}
}</nowiki>}}
''This is a very basic [[Wikipedia:Shingle beach|shingle beach]] material.''
''这是一种非常基础的 [[Wikipedia:Shingle beach|shingle beach]] 材质。''


#The <code>[[LightmappedGeneric]]</code> shader is used, which means that the material is for use on surfaces with [[lightmap]]s (i.e. [[brush]]es).
#使用了 <code>[[LightmappedGeneric]]</code> 着色器,这意味着该材质用于带有 {{L|lightmap}}的表面 (即 {{L|brush}}es)
#''The opening curly brace ({{Code|<nowiki>{</nowiki>}}) opens a set of parameters''
#''左花括号 ({{Code|<nowiki>{</nowiki>}}) 用于开启一组参数''
#The <code>[[$basetexture]]</code> parameter is given with <code>coast\shingle_01</code>, which is the location of a texture. This is what will be drawn on the screen.
# <code>{{L|$basetexture}}</code> 参数被赋值为 <code>coast\shingle_01</code>,这便是纹理所在的位置。即为将要显示在屏幕上的内容。
#<code>[[$surfaceprop]]</code> gives the material the physical properties of gravel.
#<code>{{L|$surfaceprop}}</code> 为材质赋予砾石的物理特性。
#''The closing curly brace ({{Code|<nowiki>}</nowiki>}}) character closes a set of parameters''
#''右花括号 ({{Code|<nowiki>}</nowiki>}}) 用于闭合一组参数''


It's important to remember that this material can only be used on brushes. If it needed to be used on [[model]]s, for instance, another version would need to be created using the {{code|[[VertexLitGeneric]]}} shader.
需要记住的是,这种材质只能用于 brush。例如,如果需要将其用于 {{L|model}}s, 则需要使用 {{code|{{L|VertexLitGeneric}}}} 着色器创建另一个版本。


Most of the time switching materials from one shader to another is as simple as changing their first line, since a great number of parameters are shared between them. Some params only work with certain shaders, like [[Phong]] effects, which are only available with {{code|[[VertexLitGeneric]]}}, but unfortunately you won't encounter any critical errors if a param isn't understood by the shader. It just won't have any effect.
大多数情况下,将材质从一种着色器切换到另一种着色器很简单,只需更改它们的第一行即可,因为它们之间共享大量参数。有些参数只适用于特定的着色器,比如 {{L|Phong}} 效果,它仅适用于 {{code|{{L|VertexLitGeneric}}}},但不幸的是,如果着色器不理解某个参数,不会出现任何严重错误,只是该参数不会产生任何效果。


{{tip|If you ever need to use a space, tab, or curly brace character in a parameter value, you must wrap the whole value with "quote marks". You'll often see absolutely everything wrapped like this - save yourself some typing, as that's unnecessary.}}
{{tip|如果需要在参数值中使用空格、制表符或花括号字符,则必须用 "引号" 将整个值括起来。你经常会看到所有内容都这样被括起来 —— 但其实没必要,这样做只是白费功夫。}}
{{bug|hidetested=1|Sometimes{{when}}, the first parameter defined in the VMT will fail to load. If this happens, a dummy parameter such as {{code|$bug}} can be used.}}
{{bug|hidetested=1|有时{{when}}, VMT 中定义的第一个参数会加载失败。如果发生这种情况,可以使用诸如 {{code|$bug}} 之类的虚拟参数。}}


== Finding materials ==
== 查找材质 ==


=== SteamPipe ===
=== SteamPipe ===


When Valve updated all {{src|4}} games to [[SteamPipe]], all materials were moved from [[GCF]] into [[VPK]] files. Third-party games (running on {{src04|1}} - {{src09|1}}) that previously used [[GCF]] files are also having it's materials moved to depot [[VPK]] files. VPK Files work with {{gcfscape|4}} and {{vpkedit|4}}.
Valve 将所有 {{src|4}} 游戏更新到 {{L|SteamPipe}}时,所有材质都从 {{L|GCF}} 移至 {{L|VPK}} 文件中。之前使用 {{L|GCF}} 文件的第三方游戏(运行于 {{src04|1}} - {{src09|1}}) 的材质也被移至仓库 {{L|VPK}} 文件中。 VPK 文件可与 {{gcfscape|4}} {{vpkedit|4}}配合使用。


More info on SteamPipe [https://support.steampowered.com/kb_article.php?ref=7388-QPFN-2491 here]
有关 SteamPipe 的更多信息,请点击查看 [https://support.steampowered.com/kb_article.php?ref=7388-QPFN-2491 这里]


=== Non-SteamPipe Games ===
=== SteamPipe 游戏 ===


In non [[SteamPipe]] {{src|4}} games, Materials are stored in the {{Path|materials\}} folder of your game or mod. The best way to browse them is from {{hammer|4}}'s texture selection screen.
在非 {{L|SteamPipe}} 的 {{src|4}} 游戏中,材质存储在游戏或模组的 {{Path|materials\}} 文件夹中。浏览材质的最佳方式是从 {{hammer|4}}的纹理选择界面进行。


If you want to edit or view the code of Valve's material files you will first need to extract them from their [[GCF]] package with {{gcfscape|4}}. They tend to be stored in GCFs with 'materials' in their name.
如果想要编辑或查看 Valve 的材质文件代码,首先需要使用 {{gcfscape|4}} 从它们的 {{L|GCF}} 包中提取出来。这些文件通常存储在名称中带有 "materials" 的 GCF 中。


== See also ==
== 另见 ==


* [[Creating a Material]]
* {{L|Creating a Material|创建一个材质(Material)}}
* [[Notepad++ VDF languages|Notepad++ syntax highlighting for materials]]
* {{en}} [[Notepad++ VDF languages|Notepad++ 对materials的语法高亮显示功能]]
* [[Valve Texture Format]]
* {{en}} [[Valve Texture Format|Valve纹理格式]]
* [[Shader]]
* {{L|Shader|着色器(Shader)}}
* [[:Category:List of Shader Parameters|List of Shader Parameters]]
* {{LCategory|List of Shader Parameters|着色器参数列表}}
* [[Source VMT Editor]]
* {{en}} [[Source VMT Editor|起源引擎VMT编辑器]]
* [https://github.com/Xyphos/VMTGen VMTGen]
* [https://github.com/Xyphos/VMTGen VMTGen]
* [http://www.therazzerapp.de/tutorials/vmt_erstellen.html German Tutorial by TheRaZZeRApp]  
* [http://www.therazzerapp.de/tutorials/vmt_erstellen.html German Tutorial by TheRaZZeRApp]  


[[Category:Material System]]
{{ACategory|Material System}}
[[Category:Source]]
{{ACategory|Source}}
[[Category:File formats]]
{{ACategory|File formats}}

Latest revision as of 05:50, 17 September 2025

English (en)Deutsch (de)Español (es)Français (fr)한국어 (ko)Русский (ru)中文 (zh)Translate (Translate)

本简体中文页面由 Kutaka0303 汉化。

待完善: 将与引擎无关的内容移至 材质(Material)(en)部分。
VMT ("Valve Material") 文件定义了二维表面所使用的 纹理(Texture)(en) 。 它包含了 起源 起源 引擎模拟表面的视觉、听觉和物理特性所需的所有信息。
如果材质缺失,将会出现著名的 Source 紫黑格子图案。白色线框不是材质缺失,而是 着色器(shader)(en)缺失。


材质的内容可归入以下某些或全部类别之中:

  1. 纹理(Texture)(en) 名称
  2. Physical surface(en) types(en)
  3. Shader(en) parameters(en)
  4. 材质编译标志(en)
  5. English 回退设置
  6. English 材质代理(Material Proxy)

一个简单的例子

LightmappedGeneric { $basetexture "coast/shingle_01" $surfaceprop gravel }

这是一种非常基础的 shingle beach 材质。

  1. 使用了 LightmappedGeneric 着色器,这意味着该材质用于带有 lightmap(en)的表面 (即 brush(en)es)。
  2. 左花括号 ({) 用于开启一组参数
  3. $basetexture(en) 参数被赋值为 coast\shingle_01,这便是纹理所在的位置。即为将要显示在屏幕上的内容。
  4. $surfaceprop(en) 为材质赋予砾石的物理特性。
  5. 右花括号 (}) 用于闭合一组参数

需要记住的是,这种材质只能用于 brush。例如,如果需要将其用于 model(en)s, 则需要使用 VertexLitGeneric(en) 着色器创建另一个版本。

大多数情况下,将材质从一种着色器切换到另一种着色器很简单,只需更改它们的第一行即可,因为它们之间共享大量参数。有些参数只适用于特定的着色器,比如 Phong(en) 效果,它仅适用于 VertexLitGeneric(en),但不幸的是,如果着色器不理解某个参数,不会出现任何严重错误,只是该参数不会产生任何效果。

Tip.png提示:如果需要在参数值中使用空格、制表符或花括号字符,则必须用 "引号" 将整个值括起来。你经常会看到所有内容都这样被括起来 —— 但其实没必要,这样做只是白费功夫。
Icon-Bug.png错误:有时[When?], VMT 中定义的第一个参数会加载失败。如果发生这种情况,可以使用诸如 $bug 之类的虚拟参数。

查找材质

SteamPipe

当 Valve 将所有 起源 起源 游戏更新到 SteamPipe(en)时,所有材质都从 GCF(en) 移至 VPK(en) 文件中。之前使用 GCF(en) 文件的第三方游戏(运行于 起源2004 - 起源2009) 的材质也被移至仓库 VPK(en) 文件中。 VPK 文件可与 GCFScape GCFScapeVPKEdit VPKEdit配合使用。

有关 SteamPipe 的更多信息,请点击查看 这里

非 SteamPipe 游戏

在非 SteamPipe(en)起源 起源 游戏中,材质存储在游戏或模组的 🖿materials\ 文件夹中。浏览材质的最佳方式是从 Hammer Hammer的纹理选择界面进行。

如果想要编辑或查看 Valve 的材质文件代码,首先需要使用 GCFScape GCFScape 从它们的 GCF(en) 包中提取出来。这些文件通常存储在名称中带有 "materials" 的 GCF 中。

另见