|
|
(16 intermediate revisions by 2 users not shown) |
Line 4: |
Line 4: |
| 我希望您至少对计算机上的游戏渲染有所了解,也就是说,在3D模型上使用纹理,这些纹理具有模拟的光照和效果,并通过一些神奇的渲染过程施加了效果,从而生成了最终的2D图像。 起源2没什么不同–在底层,它是一个高性能的游戏引擎,并且其用于渲染3D场景的方法几乎是行业标准的-最终都是三角形,纹理和着色器。 演示和性能有所不同。 | | 我希望您至少对计算机上的游戏渲染有所了解,也就是说,在3D模型上使用纹理,这些纹理具有模拟的光照和效果,并通过一些神奇的渲染过程施加了效果,从而生成了最终的2D图像。 起源2没什么不同–在底层,它是一个高性能的游戏引擎,并且其用于渲染3D场景的方法几乎是行业标准的-最终都是三角形,纹理和着色器。 演示和性能有所不同。 |
|
| |
|
| == Starting the SteamVR Home Workshop Tools == | | == 启动SteamHome创意工坊工具 == |
|
| |
|
| 默认情况下,无论何时启动SteamVR本身,SteamVR Home都将运行。 但是,这将是一种特殊的,简化的“游戏”模式-所有与开发相关的部分都是“工具”模式的一部分。 为此,请单击小SteamVR状态窗口左上方的SteamVR菜单,然后单击创意工坊:创建/修改环境。 | | 默认情况下,无论何时启动SteamVR本身,SteamVR Home都将运行。 但是,这将是一种特殊的,简化的“游戏”模式-所有与开发相关的部分都是“工具”模式的一部分。 为此,请单击小SteamVR状态窗口左上方的SteamVR菜单,然后单击创意工坊:创建/修改环境。 |
|
| |
|
| 这将带您到Adddon(我喜欢叫:“项目”因为Addon本身就有插件的意思,插件在中文里指的是代码编译成的文件之类,而这里的Addon更像是Unreal 4里的“工程”)选择窗口。 如果您想直接创建一些东西,[[SteamVR/Environments/Environment_Tutorial:_Hammer_and_Basic_Lighting|环境教程系列]] 就是为你准备的 | | 这将带您到Adddon(我喜欢叫:“项目”因为Addon本身就有插件的意思,插件在中文里指的是代码编译成的文件之类,而这里的Addon更像是Unreal 4里的“工程”)选择窗口。 如果您想直接创建一些东西,{{L|SteamVR/Environments/Environment_Tutorial:_Hammer_and_Basic_Lighting|环境教程系列}} 就是为你准备的 |
|
| |
|
| == Addons, and the Content and Game Folders == | | == Addons(工程)以及游戏文件夹 == |
|
| |
|
| An addon is a collection of files which get placed over the underlying game – similar in concept to Source 1’s mods, but far more suited for switching between at runtime. Your files will be split into two types – source content, which lives somewhere like this:
| | Addon是放置在基础游戏上的文件的集合-概念上类似于Source 1的mod(例如hl2文件夹css文件夹),但更适合在运行时之间进行切换。 您的文件将分为两种类型-源工程内容,其内容如下: |
| | * <code>Steam\steamapps\common\SteamVR\tools\steamvr_environments\content\steamtours_addons\your_addon_name</code> |
| | |
| | .. 以及编译后的游戏内容,这些内容非常相似,例如: |
| | * <code>Steam\steamapps\common\SteamVR\tools\steamvr_environments\game\steamtours_addons\your_addon_name</code> |
| | |
| | 内容文件夹保存在您的计算机本地,不会被重新分配-当您将插件上传到创意工坊时,游戏文件夹中的内容将打包到名为.VPK的特殊文件中。 |
| | |
| | === 依赖环境与资源包 === |
| | |
| | 你只能使用自己制作的素材资源和SteamVR自带的少量资源开发,这太鸡儿可怕了,幸运的是,加载项可以加载他人分享在创意工坊中的资源内容。 |
|
| |
|
| * <code>Steam\steamapps\common\SteamVR\tools\steamvr_environments\content\steamtours_addons\your_addon_name</code>
| | 你有没有想过你第一次进入SteamVR Home的美妙场景里面所用的资源都没有出现在素材浏览器当中? 因为他被打包成一个 {{L|SteamVR/Environments/AssetPacks|资源包}} 储存到从插件选择窗口中去了! 当用户订阅您的地图时,Steam甚至会自动下载任何需要的依赖项。 请注意,依赖的内容不会复制到您自己的插件上,因此用户将无法使用任何本地资产包(Summit Pavilion除外)。 |
|
| |
|
| .. and compiled game content, which lives somewhere remarkably similar, like this:
| | 但是,为什么无论如何都需要对内容进行“编译”? |
|
| |
|
| * <code>Steam\steamapps\common\SteamVR\tools\steamvr_environments\game\steamtours_addons\your_addon_name</code>
| | == 编译及其必要性 == |
|
| |
|
| The content folder is local to your computer, and won’t be redistributed – while things inside the game folder will be packed up into special archives called .VPKs when you upload your addon to the Workshop.
| | 原工程文件内容的格式通常不适合重新分发或快速加载和呈现。 以纹理为例 |
|
| |
|
| === Dependencies and Asset Packs ===
| | 纹理可能是一个巨大的Photoshop文档,其中包含数十个图层-然后将其编译成特定于引擎的格式,以优化其尽快渲染。 它会丢弃不需要的所有数据(在这种情况下为所有这些层),将其压缩为渲染系统的着色器所要求的形式(在显卡上运行的小程序,负责处理屏幕上看到的所有像素) ),并且通常使其适合于尽快高效地加载和显示。 |
|
| |
|
| Now it would be awfully limiting to only be able to use the content in your own addon and the few resources included in SteamVR. Fortunately addons can depend on others to get access to the content inside them.
| | 因此,内容中的所有文件都是您在其中放置或在SteamVR Home工具中制作的“友好”格式,而游戏中的文件通常是由内容中的文件生成的,并且全部由引擎直接使用。 |
|
| |
|
| Ever wondered why all the fancy props and materials from the Summit Pavilion aren't appearing in the Asset Browser? It's packaged as an addon! We can add dependencies to other addons marked as [[SteamVR/Environments/AssetPacks|Asset Packs]] from the addon selection window. Steam will even download any needed dependencies automatically when a user subscribes to your environment. Be mindful that the depended on content will not be copied to your own addon, so any local Asset Packs (except for the Summit Pavilion) will not be available to users.
| | 通常,当磁盘上的内容发生更改时,引擎会自动重新编译(因此您可以将文件保存在Photoshop中,并像魔术一样更新所有内容)–还可以强制重新编译(当事情有些混乱时,比如说我偷图不小心偷过来一个Source1的纹理)。 |
|
| |
|
| But why does content need to be ‘compiled’, anyway?
| | == 贴图,材质,模型,地图 ---G胖也疯狂 == |
|
| |
|
| == Compilation, and why it’s necessary ==
| | 以下是所有文件的简要说明。 |
|
| |
|
| Source content is generally in formats that aren’t all that suited for redistribution or fast loading and rendering. Take, for example, a texture – the source image might be a gigantic Photoshop document with dozens of layers – which then gets compiled into an engine-specific format optimised for rendering as quickly as possible. It throws away all the data it doesn’t need (all those layers, in this case), compresses it into the form requested by the rendering system’s shaders (small programs running on the graphics card, responsible for all the pixels seen on-screen) and generally makes it suitable for loading and displaying as quickly and efficiently as possible.
| | * '''Textures 贴图(相当于Source1中的vtf文件)''' –像素,并且通常来自图像文件。 墙上的一些砖块图像或法线贴图(精确的层面方向描述,用于模仿额外的细节?),或者其他多种可能性中的一种。 但是,要渲染,引擎需要更多有关像素实际含义的信息。 纹理通常是使用Adobe Photoshop,GIMP或类似软件制作的。 内容更新时自动重新编译。 |
| So, all the files in content are the user-friendly formats that you have either placed there or made in the SteamVR Home tools, while files in game are generally produced from those in content, and are all used by the engine directly.
| |
|
| |
|
| Generally things will be recompiled automatically when the content on disk changes (so you can save a file in Photoshop and have everything update as if by magic) – there’s also the ability to force a recompile, for when things have got a little confused.
| | * '''Materials 材质(相当于Source1中的vmt文件)''' – 所有这些贴图如何一起使用的描述,以便着色器知道所有内容的用途。 因此,对于砖墙,材料可能指向颜色图,法线图,光泽图(描述表面光滑度/粗糙度)等,并且您可能还有另一种版本的砖墙,该图具有不同的颜色图 但法线和光泽贴图相同。 |
|
| |
|
| == Textures, Materials, Models, Maps – oh my! ==
| | ** Materials are set up in the aptly named {{L|Dota_2_Workshop_Tools/Materials/Material_Editor|Material Editor}}. |
| | ** 每当您更改材质设置时,都会生成一个临时的新版本,并在保存时进行正确的重新编译。 |
|
| |
|
| Here’s a quick breakdown of what all these files are.
| | * '''Models 模型(相当于Source1中的mdl文件)''' – 通常是由3D建模程序(例如Maya,Modo,Blender等)制作的,它们是由三角形制成的3D形状。 示例包括家具,树木,建筑物部分,甚至动画人物和生物-您在VR中看到的很多东西都基于这些3D模型。 这些模型制成的表面被分配给特定的材质,这些材质又指向要使用的适当贴图。 虽然通常使用外部软件来构建基础模型文件,但其在引擎中通常使用{{L|SteamVR/Environments/Importing_Tutorial|Model Editor}}工具来进行处理 |
| | ** 更改源工程内容时会自动重新编译-生成的已编译模型的各个方面可以通过其使用的材质来定义。 例如,具有简单,无光照材质的模型可以自动编译为不具有顶点法线以节省空间,但是如果随后更改材质以使用适当的照明,则需要强制重新编译模型。 同样,您更改材质以开始将辅助UV用于某些东西,可能需要重新编译模型以使其正确渲染。 |
|
| |
|
| * '''Textures''' – pixels, basically, and generally from image files. An image of some bricks on a wall, or a normal map (a description of precise surface direction, for imitating extra detail), or one of numerous other possibilities. To be rendered, the engine needs a bit more information about what the pixels actually mean, however. Textures are usually made in software like Adobe Photoshop, The GIMP or similar. Automatically recompiled whenever content updates. | | * '''Maps 地图(相当于Source1中的Bsp文件)''' –从更多的角度对正在创建的世界及其所有内容进行三维描述,从照明到道具放置,甚至是将对象行为连接在一起的基本脚本。 您在SteamVR Home中在VR中看到的所有内容最终都托管在地图中-这是电影场景或舞台上发生的一切。 |
|
| |
|
| * '''Materials''' – a description of how all those textures go together, so the shaders know what everything is for. So for the brick wall, the material might point at the colour map, a normal map, a gloss map (describing surface smoothness / roughness) and so on – and you might have an alternative version of the brick wall which has a different colour map but the same normal and gloss maps. The material untangles all of these, and allows simple configuration of all the shader’s inputs. | | ** SteamVR Home tools 使用 {{L|SteamVR/Environments/Getting_Started|Hammer2地图编辑器}} 作为地图编辑器-它本身也是一个功能强大的3D建模程序。 地图可以包含在Hammer中创建的形状-例如,SteamVR Home,Summit Pavilion的默认地图,其架构主要由Hammer内部制作的几何图形构成。 |
| ** Materials are set up in the aptly named [[Dota_2_Workshop_Tools/Materials/Material_Editor|Material Editor]]. | |
| ** Makes a temporary new version whenever you change material settings, and does a proper recompilation when you save.
| |
|
| |
|
| * '''Models''' – generally produced in a 3D modelling program (such as Maya, Modo, Blender etc.), these are 3D shapes made out of triangles. Examples would include furniture, trees, sections of buildings, even animated characters and creatures – a good deal of what you’ll see in VR is based around these 3D models. The surfaces these models are made out of are assigned to particular materials, which in turn point at the appropriate textures to use. While the underlying model files will usually be built using external software, their use in the engine will be set up in the imaginatively titled [[SteamVR/Environments/Importing_Tutorial|Model Editor]]. | | ** 地图不会自动重新编译-您始终必须先手动编译它们,然后再运行它们。 编译地图之前,您可能需要完成多个阶段(例如,建筑照明)–这些步骤都是单独完成的,因为它们可能需要花费相当长的时间,并且结果可以在许多情况下重复使用。 |
| ** Automatically recompiled when you change source content – aspects of the resulting compiled model can be defined by the materials it uses. For instance, a model with a simple, unlit material can be automatically compiled to be without vertex normals to save space – but you’ll need to force a model recompile if you subsequently change the material to use proper lighting. Similarly, you change your material to start using secondary UVs for something, you may need to recompile the model for it to render properly. | |
|
| |
|
| * '''Maps''' – more of a three-dimensional description of the world you are creating and everything in it – from lighting to prop placement via which sounds are placed where, and even the basic scripting linking object behaviours together. Everything you see in VR in SteamVR Home is ultimately hosted in a map – it’s the film set or theatrical stage in which everything happens.
| | 其他文件包括声音,粒子系统等-这些文件在您的Addon的内容文件夹中都有源版本,并且(自动或不自动)在您的插件的游戏文件夹中被编译为精简高效的版本。 |
| ** The SteamVR Home tools include [[SteamVR/Environments/Getting_Started|Hammer]] as the map editor – which, a little confusingly, is also a capable 3D modelling program by itself. Maps can contain shapes created in Hammer – an example would be the default map for SteamVR Home, the Summit Pavilion, the architecture for which was mainly built out of geometry made inside Hammer.
| |
| ** Maps are not automatically recompiled – you’ll always have to manually compile them before running them. There are various stages (such as building lighting) which you may need to do before compiling the map – these are all done separately since they may take a reasonable amount of time, and the results can be reused in many cases.
| |
|
| |
|
| Other files include sounds, particle systems and more – these all have source versions in the content folder for your addon, and (automatically or not) get compiled into streamlined, efficient versions in the game folder for your addon.
| | === 除此之外 === |
|
| |
|
| === Exceptions to the Rule ===
| | 文件和游戏之间的这种“完美”分离确实会在某些地方分解–主要是由引擎直接使用的各种脚本文件。 这些文本文件放置在游戏文件夹中的某个位置–其中包括Lua脚本文件和Soundscape定义。 但是,除了这些例外,游戏中的几乎所有内容都可以从内容文件中重建。 |
|
| |
|
| Of course, this perfect separation of content and game does break down in places – mainly with various script files which get consumed by the engine directly. These text files get placed somewhere inside the game folder – these include Lua script files and Soundscape definitions. But, beyond these exceptions, pretty much everything in game can be rebuilt from files in content.
| | == 实体,几何,实体逻辑等 == |
|
| |
|
| == Entities, Geometry, Entity Logic and More ==
| | Hammer中的一个空白地图是VR的空白空间–几乎所有东西都放置在这里。 并且,除非您将内容添加到地图中,否则世界将完全空白。 但是可以放什么呢? |
|
| |
|
| An empty map in Hammer is the blank canvas for VR – this is where just about everything gets placed. And, until you add things to your map, the world will be entirely empty. But what can be put there?
| | * '''Entities 实体''' – 这些是引擎中的“事物”。 本质上,实体是计算机程序的特定实例,通常在世界上具有可见(和/或听觉)表示,并且将以特定方式对事物做出反应。 一个实体的例子可能是物理道具–它告诉引擎使用特定模型进行渲染,并且知道它应该如何应对玩家将其扔掉的情况。 另一个示例是鸽子,信息面板,光源或不可见的触发体积,它们告诉另一个实体在特定实体进入时执行某项操作。 甚至玩家也是一个实体。 |
|
| |
|
| * '''Entities''' – these are ‘things’ in the engine. Essentially a particular instance of a computer program, an entity often has a visible (and/or audible) representation in the world, and will react to things in particular ways. An example of an entity could be a physics prop – it tells the engine to render it with a particular model, and knows how it should react to the player throwing it around. Another example would be a pigeon, an information panel, a light source, or an invisible trigger volume which tells another entity to do something when a particular entity enters it. Even the player is an entity. | | * '''Geometry 几何''' – {{L|Dota_2_Workshop_Tools/Level_Design/Basic_Construction|map geometry built in Hammer}} 可能完全是静态的且没有响应-尽管从技术上讲,它仍然是幕后某个实体,但它更像是固定的架构,所有事情都在此之上发生。 您还可以将地图几何的特定部分绑定到特定实体-这告诉实体(例如,滑动门或旋转平台)使用该地图几何作为其可见的表示形式。 对于不可见的触发体积,地图几何块将定义其包围的空间。 |
|
| |
|
| * '''Geometry''' – [[Dota_2_Workshop_Tools/Level_Design/Basic_Construction|map geometry built in Hammer]] can be entirely static and unresponsive – while technically it’s still an entity somewhere behind the scenes, it is more like fixed architecture upon which everything happens. You can also tie particular sections of map geometry to specific entities – this tells the entity (such as a sliding door, or a rotating platform) to use that map geometry as its visible representation. In the case of that invisible trigger volume, a block of map geometry will define the space it encloses. | | * '''Entity Logic 逻辑实体''' – 这是将地图中实体的行为粘合在一起的基本粘合剂。 简单的地图可能几乎没有实体逻辑,而复杂的游戏可能将各种事物连接在一起。 由输入和输出组成(与Source 1系统几乎完全相同,是改装爱好者),一个实体可能会遇到一件特定的事情(例如玩家将一只手放在指定的体积内),从而触发OnTrigger输出, 它连接到另一个实体上的输入,该实体告诉它执行其他操作。 例如,一扇门通过其“打开”输入被告知要打开,一盏灯通过其“ TurnOn”输入被打开,一声音通过其“ PlaySound”输入播放,或者被其FlyPath输入称为飞翔的鸽子。 每个实体可以具有一个输出列表,并且可以建立一个从其他实体调用的输入列表。. 这些功能依赖于 {{L|Inputs_and_Outputs|输入输出}}(国内开发者喜欢称为实体I/O) 请通读以获取更多信息-但请注意,这是Source 1教程,因此链接和详细信息通常会跳入不适用于SteamVR Home的主题。 |
|
| |
|
| * '''Entity Logic''' – this is the basic glue sticking the behaviours of entities in a map together. A simple map might have little, if any entity logic – a complex game might have all kinds of things connected together. Made from Inputs and Outputs (and pretty much identical to the Source 1 system, modding aficionados), an entity might experience a particular thing happening (such as a player putting a hand into a specified volume) which causes it to fire an OnTrigger output, which is connected to an Input on another entity which tells it to do something else. Examples would include a a door being told to open via its Open input, a light switching on through its TurnOn input, a sound playing via its PlaySound input, or a pigeon flying away being called by its FlyPath input. Each entity can have a list of outputs, and can build up a list of inputs being called from other entities. There's an in-depth article on [[Inputs_and_Outputs|Inputs and Outputs]] to read through for more information - but do note that this is a Source 1 tutorial, so links and specifics will often wander off into topics not applicable to SteamVR Home.
| | == Source2让你远离泄露和密封空间(奥利给干啦兄弟们) == |
|
| |
|
| == No More Leaks or Brushes (why am I even telling you about these anyway?) ==
| | 如果你是起源1开发者,不管你是建图师,模型师还是音效师,或者你只是工作室里打杂的,你可能都遭受过地图leak泄露错误或者必须密封地图造成vvis不堪负重。但是现在,Source2让你远离这些灾难,你不用在Source2里密封你的地图了!这意味着你可以自由创作并不用考虑泄露事故 |
|
| |
|
| If you’re a Source 1 modder, rejoice. Maps are now arbitrary polygon soup, and have no need to be sealed against the void – and brushes are no longer a thing, having been entirely replaced by the much friendlier map geometry constructed in Hammer.
| | 感谢奇迹?继续往下看 |
|
| |
|
| If you have no idea what wonders you are missing out on here, just be thankful and move on.
| | == 光照 == |
|
| |
|
| == Lighting ==
| | 许多人提到这种神秘的“照明”系统。 简而言之,引擎使用模拟来模拟现实生活中光线的外观以渲染对象-允许曲面对光源,环境照明等做出真实响应。 对象可以在自身和其他对象上投射阴影-正确设置后,光照可以成为地图的巨大视觉效果。 适当地照亮世界本身就是一门艺术。 |
|
| |
|
| There are many mentions of this mysterious ‘lighting’ system. Put simply, the engine uses a simulation of how light appears in real life to render objects – allowing surfaces to respond realistically to light sources, ambient lighting and so on. Objects can cast shadows on to themselves and other objects – when set up correctly, lighting can be a huge visual aspect of a map. Properly lighting worlds is a bit of an art in itself. More information on the lighting system to come!
| | == 脚本 == |
|
| |
|
| == Scripts ==
| | 对于简单的行为和映射逻辑,您可能仅会使用基本的实体I/O;但是对于更复杂的事情(例如,将自己创建新实体的行为),则需要使用Lua脚本系统。 可以与实体和世界互动的成熟编程语言。 There's a {{L|SteamVR/Environments/Scripting/Flashlight_Tool_Tutorial|tutorial on building a player-interactable item}} if you want to know more, while there's also a {{L|SteamVR/Environments/Scripting|wider overview on the script system}}. |
|
| |
|
| For simple behaviours and map logic, you’ll likely use just basic entity logic – but for more complex things (such as behaviours approaching the creation of new entities in themselves) you’ll want to use the Lua script system, which is a full-fledged programming language which can interact with entities and the world. There's a [[SteamVR/Environments/Scripting/Flashlight_Tool_Tutorial|tutorial on building a player-interactable item]] if you want to know more, while there's also a [[SteamVR/Environments/Scripting|wider overview on the script system]].
| | == 控制台 == |
|
| |
|
| == Console ==
| | 不是游戏机,而是用于控制大型老式大型计算机的终端的概念后代。 控制台是一个命令行界面,可将日志和消息中继回用户,并接受许多基于文本的命令来控制引擎内部深奥的功能。 起源采用单独窗口的形式–在运行工具的情况下,您可以通过按下键盘左上角转义键下方的波浪号(〜)或从右上角的“工具”启动控制台 |
|
| |
|
| Not a games console, but instead a conceptual descendant of the terminals used to control giant old mainframe computers. The console is a command line interface that relays logs and messages back to the user, and accepts many text-based commands for controlling esoteric features deep inside the engine. It takes the form of a separate program – with the tools running, you can bring it up by pressing the tilde key (~) just below the escape key to the top left of your keyboard, or from the Tools menu in the top right corner of most tool windows.
| | 起源2取消了内置控制台,采用外部EXE控制台程序 |
| | (为什么内部控制台没了,带着VR头显敲键盘,想想就cyberpunk----某位起源大佬的话) |
|
| |
|
| By default, it may attempt to connect to the wrong port (another conceptual legacy of those mainframes) – so click the ‘+’ button to the left of the ‘Localhost’ tab and, in Port, enter 29009 and press Accept. The window should magically fill with multicoloured text. You can pretty much ignore it all for now.
| | 默认情况下,它可能会尝试连接到错误的端口(这些大型机的另一概念遗留物)–因此,请单击“本地主机”选项卡左侧的“ +”按钮,然后在“端口”中输入29009,然后按“接受”。 窗口应该神奇地充满了彩色文本。 您现在几乎可以将其全部忽略。 |
|
| |
|
| To launch the console when running in game mode, you can run the .EXE from here:
| | 要在游戏中打开外部控制台,请打开相应游戏的EXE程序 |
| * <code>Steam\steamapps\common\SteamVR\tools\steamvr_environments\game\bin\win64\vconsole2.exe</code> | | * <code>Steam\steamapps\common\SteamVR\tools\steamvr_environments\game\bin\win64\vconsole2.exe</code> |
|
| |
|
| Occasionally tutorials will ask you to enter console commands. Well, this is how to get to it.
| | 有时,教程会要求您输入控制台命令。 好吧,这就是解决方法。 |
| | |
| | == 多人游戏 == |
| | |
| | SteamVR Home免费提供多人游戏-无需其他设置即可让多个用户一起探索同一个环境。 从技术上讲,引擎使用客户端-服务器(C/S)体系结构,该服务器在托管该特定多人游戏机房的计算机上运行-其他客户端与该服务器通信以查明发生了什么,并使用自己的更改来更新服务器。 所有这一切都在幕后发生,并且在操作中应该几乎是无缝的。 |
| | |
| | 但是,请注意,现实世界中的通信链路存在问题-延迟和带宽限制以及所有这些限制。 不要建立一个非常复杂的物理模拟杰作,并期望它能在多人游戏中高效运行-并且要知道,延迟对于较远的玩家来说可能是个问题... |
| | |
| | == 性能 == |
| | |
| | 如今,游戏计算机的速度非常快。但是VR在系统需求方面非常繁重–因此,就像不可抗拒的力量与不可移动的物体一样,必须付出一些努力。最大的计算成本之一是渲染场景–因此,两个双眼视图以每秒90帧的速度进行高清处理。而且,与在平板显示器上玩游戏相比,VR遗漏的帧非常明显且令人不快,这充其量是造成抖动和颤抖的原因。 SteamVR Home中的渲染系统和着色器经过专门设计,以实现尽可能高的效率,但是仍然可以使其过载。 |
| | |
| | SteamVR Home中使用的自适应保真度系统将动态启用和禁用渲染大小和功能,以从您的硬件中获得最佳质量,但是为了防止过度模糊,它不会低于特定水平。在“工具”模式下运行时,它将被禁用–仅在游戏模式下才被启用。 (为获得最佳性能,请在游戏模式下进行测试-Hammer之类的工具可以自行承担当前在VR中运行的事物的成本。) |
| | |
|
| |
|
| == Multiplayer ==
| |
|
| |
|
| SteamVR Home gives you multiplayer for free – there’s no additional setup needed to let multiple users explore the same environment together. In technical parlance, the engine uses a client-server architecture, with the server running on the computer hosting that particular multiplayer room – other clients communicate with that server to find out what is happening, and to update the server with their own changes. This all happens behind the scenes, and should be mostly seamless in action.
| |
|
| |
|
| Be aware, however, that real-world communications links are in the way – with latency and bandwidth limitations and all that those entail. Don’t build a hugely complex physically simulated masterpiece and expect it to run efficiently in multiplayer – and understand that lag can be an issue for more distant players...
| |
|
| |
|
| == Performance ==
| | 以下是一些潜在的渲染成本: |
|
| |
|
| Gaming computers these days are ridiculously fast. But VR is extremely heavy on system requirements – so, like an irresistible force versus an immovable object, something has to give. One of the largest computational costs is in rendering the scene – so two binocular views in high definition at 90 frames per second. And, much more so than with games on a flat monitor, missed frames in VR are pretty obvious and unpleasant – causing juddering and shuddering at best. The rendering system and shaders in SteamVR Home are specifically engineered to be as efficient as possible, but it’s still possible to overload it.
| | * '''几何图形太多!''' 太多固体和实体了。 对于基于摄影测量的场景,该场景几乎是一个巨大的,未照明的网格,上面带有一些巨大的纹理,实际限制为2-3个三角形。 超出此范围可能会开始导致帧速率在较少的硬件上下降。 |
|
| |
|
| The adaptive fidelity system used in SteamVR Home will dynamically enable and disable render size and features to get the best possible quality from your hardware, but to prevent excessive blurriness it won’t go below a certain level. When running in Tools mode, it will be disabled – it will be only enabled in game mode. (To best appreciate performance, test things in game mode – tools such as Hammer can expose their own cost on things currently running in VR.)
| | * '''太多贴图和纹理了!''' – 太多的大纹理也会在较少的硬件上引起严重的性能问题。 最大值是600MB。 请记住,法线贴图,透明度贴图之类的东西也会相加-并增加您制作的内容的下载大小。 |
|
| |
|
| Here are a few potential rendering costs:
| | * '''照明资源开销''' – 动态光源过多而投射的阴影都增加了渲染成本。 尽管SteamVR Home中的照明系统非常高效(图形程序员一直敦促我向Summit Pavilion环境添加更多阴影聚光灯),但误解和过高预期可能会导致严重问题。 一些通用规则是:限制每个光源仅照亮所需的光源–将范围尽可能地扩大–且不要太多。 动态灯非常昂贵,因此请尽可能多地烘烤-有关照明系统的更多信息将在不久的将来出现! |
|
| |
|
| * '''Too much geometry!''' The world can be too detailed. For a photogrammetry-based scene, which is pretty much a huge unlit mesh with some giant textures on it, around 2-3 million triangles is a practical limit. Going much beyond that can start causing the framerate to drop on lesser hardware. | | * '''Expensive shaders''' – SteamVR Home中的标准着色器有很多选择,包括“铃铛”和“口哨声”(这是渲染器的名字)。 不要将它们全部打开,并希望在基本硬件上以帧速率渲染所有内容–特别昂贵的事情可能是具有多层透明几何体(经过alpha测试的几何体绝对不便宜,这要归功于一些超漂亮的抗锯齿功能) 。 |
| | **如果可以的话,找一个拥有入门级GPU的人来进行测试– Nvidia GeForce GTX 970或AMD Radeon RX 480是一个很好的基准。 |
| | (译者1050 4GB版都能轻松驾驭) |
|
| |
|
| * '''Too much texture memory''' – again mainly a potential issue with photogrammetry-based scenes, having too many large textures can also cause precipitous performance issues on lesser hardware. Around 15 8k textures can be a sensible maximum – that’s something like 600MB of textures. Remember that things like normal maps, transparency maps and suchlike add up as well – and increase download size of whatever you make.
| | 要获取当前渲染成本的最新视图,请在SteamVR中打开帧时序窗口:设置:性能:显示帧时序。 在啥也不干的情况下,底部的GPU图形应保持在11ms以下,底部没有弹出任何非零的红线–如果在游戏模式下运行,曾经超过11ms,自适应保真度应尽量最大化GPU的使用率, |
|
| |
|
| * '''Expensive lighting''' – having too many dynamic light sources and shadows being cast all add to the rendering cost. While the lighting system in SteamVR Home is remarkably efficient (a graphics programmer kept urging me to add more shadowed spotlights to the Summit Pavilion environment), misunderstandings and over-expectations can cause significant issues. Some general rules are: restrict each light source to light only what it is needed for – bring the range in as far as you can – and don’t have too many of them. Dynamic lights are fairly expensive, so bake as many as you can – more information on the lighting system is coming in the near future!
| | {{Tip|谈论“获得5fps”或类似的东西并没有多大意义-在游戏开发中,大约只有几毫秒。 维持90fps所需的时间仅需11ms以上,因此节省2ms比“节省5fps”有意义得多,因为这并没有表明节省了绝对渲染成本。 (您是以10fps还是1000开头的?)}} |
|
| |
|
| * '''Expensive shaders''' – the standard shader in SteamVR Home has many options, bells and whistles. Don’t turn all of them on and expect to render everything in framerate on basic hardware – a particularly expensive thing can be having many layers of transparent geometry (alpha-tested geometry is definitely not cheap, thanks to some super-fancy antialising features).
| | 如果您的CPU使用率跃升到11ms以上,则可能会遇到其他问题。 以下是一些潜在的CPU成本: |
| ** If you can, find someone with an entry-level GPU to test things with – an Nvidia GeForce GTX 970 or AMD Radeon RX 480 are a good baseline.
| |
|
| |
|
| For an up-to-date view of current rendering cost, bring up the frame timing window in SteamVR : Settings : Perfomance : Display Frame Timing. At a very simplistic level, the GPU graph at bottom should stay below 11ms, without any non-zero red line popping up at the bottom – if running in game mode, the adaptive fidelity should try to maximise GPU usage, but it should rarely if ever go above 11ms.
| | * '''实体开销''' – 它很有可能是地图中特定实体的某些方面,而不是所有实体的总数,但是如果您在某件事上比平时执行或创建了更多,那么可能值得进一步研究。 |
| {{Tip|Talking about ‘gaining 5fps’ or similar doesn’t really make sense – in games development, it’s all about milliseconds. It takes marginally over 11ms a frame to maintain 90fps, so saving 2ms is much more meaningful than ‘saving 5fps’, which gives no indication of absolute rendering cost saved. (Did you start at 10fps, or 1000?)}}
| |
|
| |
|
| If your CPU graph is busy leaping above 11ms, then you’ve got different problems. Here are some potential CPU costs:
| | * '''脚本开销''' – 脚本必须在该帧上完成运行才能继续渲染,因此,如果您有复杂的循环和大量的逻辑,这些脚本可能会太昂贵。 |
|
| |
|
| * '''Too many entities''' – it’s much more likely to be some aspect of the specific entities you have in the map rather than an overall count of all entities, but if you have many more than usual of a certain thing, it may be worth investigating further. | | * '''复杂渲染''' – 与直觉相反,由于绘图调用,即使GPU没有达到极限,您也可能需要很高的渲染成本。 如果您有许多不同的模型和/或材质,则CPU必须告诉GPU渲染每个模型和材质改如何处理,这会导致成本增加,而您拥有的东西更多。 |
|
| |
|
| * '''Expensive scripts''' – scripts have to finish running for that frame before rendering can continue, so if you have complex loops and lots of logic, the scripts may be too expensive. | | * '''复杂物理效果处理''' – 同时在场景中拥有太多物理模拟的对象可能会带来可观的计算成本–尤其是复杂的碰撞船体与另一个碰撞时可能会非常昂贵,从而导致严重的帧丢失。 更多有关简化物理系统的信息! |
|
| |
|
| * '''Complex rendering''' – counter-intuitively, you can have a high rendering cost even if the GPU isn’t maxed out, thanks to draw calls. If you have many separate models and/or materials, the CPU has to tell the GPU to render each one, which incurs a cost which goes up the more things you have.
| | == 关于VDC == |
|
| |
|
| * '''Complex physics''' – having too many physically simulated objects in the scene at the same time can be a significant computational cost – and in particular having a complex collision hull colliding with another can be very expensive, causing severe frame drops. More information on simplifying physics systems to come!
| | 最后,欢迎访问Valve开发者社区Wiki! 本文档是一份永无止境的工作,由像您这样的人部分构建而成-每个页面都有一个讨论部分,每个页面都可以根据需要进行编辑和扩展。 如果您有任何答案,也请发布文章 |
|
| |
|
| == Documentation ==
| | 也欢迎有英文基础的开发者汉化所有Source 2英文文章。 |
|
| |
|
| Finally, welcome to the Valve Developer Community wiki! This documentation is a never-ending work in progress, and is built in part by people like you - each page has a discussion section, and each page can be edited and extended as you see fit. If you have any questions, please do post them - and if you have any answers, post those too!
| | 欢迎来到VR,未来即是现在! |
|
| |
|
| [[Category:SteamVR]][[Category:SteamVR Home]] | | [[Category:SteamVR]][[Category:SteamVR Home]] |
开篇简介
也许您是一个完全的初学者,刚刚开始研究Source 2引擎。 或者您是经验丰富的Source 1 mod开发人员,或者您是其他引擎的专家,无论是Unity,虚幻引擎还是您自己创建引擎-你所掌握的知识仍适用于起源2。 本文将为大家提供帮助-解释起源2引擎和开发工具背后的基本概念。
我希望您至少对计算机上的游戏渲染有所了解,也就是说,在3D模型上使用纹理,这些纹理具有模拟的光照和效果,并通过一些神奇的渲染过程施加了效果,从而生成了最终的2D图像。 起源2没什么不同–在底层,它是一个高性能的游戏引擎,并且其用于渲染3D场景的方法几乎是行业标准的-最终都是三角形,纹理和着色器。 演示和性能有所不同。
启动SteamHome创意工坊工具
默认情况下,无论何时启动SteamVR本身,SteamVR Home都将运行。 但是,这将是一种特殊的,简化的“游戏”模式-所有与开发相关的部分都是“工具”模式的一部分。 为此,请单击小SteamVR状态窗口左上方的SteamVR菜单,然后单击创意工坊:创建/修改环境。
这将带您到Adddon(我喜欢叫:“项目”因为Addon本身就有插件的意思,插件在中文里指的是代码编译成的文件之类,而这里的Addon更像是Unreal 4里的“工程”)选择窗口。 如果您想直接创建一些东西,环境教程系列(en) 就是为你准备的
Addons(工程)以及游戏文件夹
Addon是放置在基础游戏上的文件的集合-概念上类似于Source 1的mod(例如hl2文件夹css文件夹),但更适合在运行时之间进行切换。 您的文件将分为两种类型-源工程内容,其内容如下:
Steam\steamapps\common\SteamVR\tools\steamvr_environments\content\steamtours_addons\your_addon_name
.. 以及编译后的游戏内容,这些内容非常相似,例如:
Steam\steamapps\common\SteamVR\tools\steamvr_environments\game\steamtours_addons\your_addon_name
内容文件夹保存在您的计算机本地,不会被重新分配-当您将插件上传到创意工坊时,游戏文件夹中的内容将打包到名为.VPK的特殊文件中。
依赖环境与资源包
你只能使用自己制作的素材资源和SteamVR自带的少量资源开发,这太鸡儿可怕了,幸运的是,加载项可以加载他人分享在创意工坊中的资源内容。
你有没有想过你第一次进入SteamVR Home的美妙场景里面所用的资源都没有出现在素材浏览器当中? 因为他被打包成一个 资源包(en) 储存到从插件选择窗口中去了! 当用户订阅您的地图时,Steam甚至会自动下载任何需要的依赖项。 请注意,依赖的内容不会复制到您自己的插件上,因此用户将无法使用任何本地资产包(Summit Pavilion除外)。
但是,为什么无论如何都需要对内容进行“编译”?
编译及其必要性
原工程文件内容的格式通常不适合重新分发或快速加载和呈现。 以纹理为例
纹理可能是一个巨大的Photoshop文档,其中包含数十个图层-然后将其编译成特定于引擎的格式,以优化其尽快渲染。 它会丢弃不需要的所有数据(在这种情况下为所有这些层),将其压缩为渲染系统的着色器所要求的形式(在显卡上运行的小程序,负责处理屏幕上看到的所有像素) ),并且通常使其适合于尽快高效地加载和显示。
因此,内容中的所有文件都是您在其中放置或在SteamVR Home工具中制作的“友好”格式,而游戏中的文件通常是由内容中的文件生成的,并且全部由引擎直接使用。
通常,当磁盘上的内容发生更改时,引擎会自动重新编译(因此您可以将文件保存在Photoshop中,并像魔术一样更新所有内容)–还可以强制重新编译(当事情有些混乱时,比如说我偷图不小心偷过来一个Source1的纹理)。
贴图,材质,模型,地图 ---G胖也疯狂
以下是所有文件的简要说明。
- Textures 贴图(相当于Source1中的vtf文件) –像素,并且通常来自图像文件。 墙上的一些砖块图像或法线贴图(精确的层面方向描述,用于模仿额外的细节?),或者其他多种可能性中的一种。 但是,要渲染,引擎需要更多有关像素实际含义的信息。 纹理通常是使用Adobe Photoshop,GIMP或类似软件制作的。 内容更新时自动重新编译。
- Materials 材质(相当于Source1中的vmt文件) – 所有这些贴图如何一起使用的描述,以便着色器知道所有内容的用途。 因此,对于砖墙,材料可能指向颜色图,法线图,光泽图(描述表面光滑度/粗糙度)等,并且您可能还有另一种版本的砖墙,该图具有不同的颜色图 但法线和光泽贴图相同。
- Materials are set up in the aptly named Material Editor(en).
- 每当您更改材质设置时,都会生成一个临时的新版本,并在保存时进行正确的重新编译。
- Models 模型(相当于Source1中的mdl文件) – 通常是由3D建模程序(例如Maya,Modo,Blender等)制作的,它们是由三角形制成的3D形状。 示例包括家具,树木,建筑物部分,甚至动画人物和生物-您在VR中看到的很多东西都基于这些3D模型。 这些模型制成的表面被分配给特定的材质,这些材质又指向要使用的适当贴图。 虽然通常使用外部软件来构建基础模型文件,但其在引擎中通常使用Model Editor(en)工具来进行处理
- 更改源工程内容时会自动重新编译-生成的已编译模型的各个方面可以通过其使用的材质来定义。 例如,具有简单,无光照材质的模型可以自动编译为不具有顶点法线以节省空间,但是如果随后更改材质以使用适当的照明,则需要强制重新编译模型。 同样,您更改材质以开始将辅助UV用于某些东西,可能需要重新编译模型以使其正确渲染。
- Maps 地图(相当于Source1中的Bsp文件) –从更多的角度对正在创建的世界及其所有内容进行三维描述,从照明到道具放置,甚至是将对象行为连接在一起的基本脚本。 您在SteamVR Home中在VR中看到的所有内容最终都托管在地图中-这是电影场景或舞台上发生的一切。
- SteamVR Home tools 使用 Hammer2地图编辑器(en) 作为地图编辑器-它本身也是一个功能强大的3D建模程序。 地图可以包含在Hammer中创建的形状-例如,SteamVR Home,Summit Pavilion的默认地图,其架构主要由Hammer内部制作的几何图形构成。
- 地图不会自动重新编译-您始终必须先手动编译它们,然后再运行它们。 编译地图之前,您可能需要完成多个阶段(例如,建筑照明)–这些步骤都是单独完成的,因为它们可能需要花费相当长的时间,并且结果可以在许多情况下重复使用。
其他文件包括声音,粒子系统等-这些文件在您的Addon的内容文件夹中都有源版本,并且(自动或不自动)在您的插件的游戏文件夹中被编译为精简高效的版本。
除此之外
文件和游戏之间的这种“完美”分离确实会在某些地方分解–主要是由引擎直接使用的各种脚本文件。 这些文本文件放置在游戏文件夹中的某个位置–其中包括Lua脚本文件和Soundscape定义。 但是,除了这些例外,游戏中的几乎所有内容都可以从内容文件中重建。
实体,几何,实体逻辑等
Hammer中的一个空白地图是VR的空白空间–几乎所有东西都放置在这里。 并且,除非您将内容添加到地图中,否则世界将完全空白。 但是可以放什么呢?
- Entities 实体 – 这些是引擎中的“事物”。 本质上,实体是计算机程序的特定实例,通常在世界上具有可见(和/或听觉)表示,并且将以特定方式对事物做出反应。 一个实体的例子可能是物理道具–它告诉引擎使用特定模型进行渲染,并且知道它应该如何应对玩家将其扔掉的情况。 另一个示例是鸽子,信息面板,光源或不可见的触发体积,它们告诉另一个实体在特定实体进入时执行某项操作。 甚至玩家也是一个实体。
- Geometry 几何 – map geometry built in Hammer(en) 可能完全是静态的且没有响应-尽管从技术上讲,它仍然是幕后某个实体,但它更像是固定的架构,所有事情都在此之上发生。 您还可以将地图几何的特定部分绑定到特定实体-这告诉实体(例如,滑动门或旋转平台)使用该地图几何作为其可见的表示形式。 对于不可见的触发体积,地图几何块将定义其包围的空间。
- Entity Logic 逻辑实体 – 这是将地图中实体的行为粘合在一起的基本粘合剂。 简单的地图可能几乎没有实体逻辑,而复杂的游戏可能将各种事物连接在一起。 由输入和输出组成(与Source 1系统几乎完全相同,是改装爱好者),一个实体可能会遇到一件特定的事情(例如玩家将一只手放在指定的体积内),从而触发OnTrigger输出, 它连接到另一个实体上的输入,该实体告诉它执行其他操作。 例如,一扇门通过其“打开”输入被告知要打开,一盏灯通过其“ TurnOn”输入被打开,一声音通过其“ PlaySound”输入播放,或者被其FlyPath输入称为飞翔的鸽子。 每个实体可以具有一个输出列表,并且可以建立一个从其他实体调用的输入列表。. 这些功能依赖于 输入输出(en)(国内开发者喜欢称为实体I/O) 请通读以获取更多信息-但请注意,这是Source 1教程,因此链接和详细信息通常会跳入不适用于SteamVR Home的主题。
Source2让你远离泄露和密封空间(奥利给干啦兄弟们)
如果你是起源1开发者,不管你是建图师,模型师还是音效师,或者你只是工作室里打杂的,你可能都遭受过地图leak泄露错误或者必须密封地图造成vvis不堪负重。但是现在,Source2让你远离这些灾难,你不用在Source2里密封你的地图了!这意味着你可以自由创作并不用考虑泄露事故
感谢奇迹?继续往下看
光照
许多人提到这种神秘的“照明”系统。 简而言之,引擎使用模拟来模拟现实生活中光线的外观以渲染对象-允许曲面对光源,环境照明等做出真实响应。 对象可以在自身和其他对象上投射阴影-正确设置后,光照可以成为地图的巨大视觉效果。 适当地照亮世界本身就是一门艺术。
脚本
对于简单的行为和映射逻辑,您可能仅会使用基本的实体I/O;但是对于更复杂的事情(例如,将自己创建新实体的行为),则需要使用Lua脚本系统。 可以与实体和世界互动的成熟编程语言。 There's a tutorial on building a player-interactable item(en) if you want to know more, while there's also a wider overview on the script system(en).
控制台
不是游戏机,而是用于控制大型老式大型计算机的终端的概念后代。 控制台是一个命令行界面,可将日志和消息中继回用户,并接受许多基于文本的命令来控制引擎内部深奥的功能。 起源采用单独窗口的形式–在运行工具的情况下,您可以通过按下键盘左上角转义键下方的波浪号(〜)或从右上角的“工具”启动控制台
起源2取消了内置控制台,采用外部EXE控制台程序
(为什么内部控制台没了,带着VR头显敲键盘,想想就cyberpunk----某位起源大佬的话)
默认情况下,它可能会尝试连接到错误的端口(这些大型机的另一概念遗留物)–因此,请单击“本地主机”选项卡左侧的“ +”按钮,然后在“端口”中输入29009,然后按“接受”。 窗口应该神奇地充满了彩色文本。 您现在几乎可以将其全部忽略。
要在游戏中打开外部控制台,请打开相应游戏的EXE程序
Steam\steamapps\common\SteamVR\tools\steamvr_environments\game\bin\win64\vconsole2.exe
有时,教程会要求您输入控制台命令。 好吧,这就是解决方法。
多人游戏
SteamVR Home免费提供多人游戏-无需其他设置即可让多个用户一起探索同一个环境。 从技术上讲,引擎使用客户端-服务器(C/S)体系结构,该服务器在托管该特定多人游戏机房的计算机上运行-其他客户端与该服务器通信以查明发生了什么,并使用自己的更改来更新服务器。 所有这一切都在幕后发生,并且在操作中应该几乎是无缝的。
但是,请注意,现实世界中的通信链路存在问题-延迟和带宽限制以及所有这些限制。 不要建立一个非常复杂的物理模拟杰作,并期望它能在多人游戏中高效运行-并且要知道,延迟对于较远的玩家来说可能是个问题...
性能
如今,游戏计算机的速度非常快。但是VR在系统需求方面非常繁重–因此,就像不可抗拒的力量与不可移动的物体一样,必须付出一些努力。最大的计算成本之一是渲染场景–因此,两个双眼视图以每秒90帧的速度进行高清处理。而且,与在平板显示器上玩游戏相比,VR遗漏的帧非常明显且令人不快,这充其量是造成抖动和颤抖的原因。 SteamVR Home中的渲染系统和着色器经过专门设计,以实现尽可能高的效率,但是仍然可以使其过载。
SteamVR Home中使用的自适应保真度系统将动态启用和禁用渲染大小和功能,以从您的硬件中获得最佳质量,但是为了防止过度模糊,它不会低于特定水平。在“工具”模式下运行时,它将被禁用–仅在游戏模式下才被启用。 (为获得最佳性能,请在游戏模式下进行测试-Hammer之类的工具可以自行承担当前在VR中运行的事物的成本。)
以下是一些潜在的渲染成本:
- 几何图形太多! 太多固体和实体了。 对于基于摄影测量的场景,该场景几乎是一个巨大的,未照明的网格,上面带有一些巨大的纹理,实际限制为2-3个三角形。 超出此范围可能会开始导致帧速率在较少的硬件上下降。
- 太多贴图和纹理了! – 太多的大纹理也会在较少的硬件上引起严重的性能问题。 最大值是600MB。 请记住,法线贴图,透明度贴图之类的东西也会相加-并增加您制作的内容的下载大小。
- 照明资源开销 – 动态光源过多而投射的阴影都增加了渲染成本。 尽管SteamVR Home中的照明系统非常高效(图形程序员一直敦促我向Summit Pavilion环境添加更多阴影聚光灯),但误解和过高预期可能会导致严重问题。 一些通用规则是:限制每个光源仅照亮所需的光源–将范围尽可能地扩大–且不要太多。 动态灯非常昂贵,因此请尽可能多地烘烤-有关照明系统的更多信息将在不久的将来出现!
- Expensive shaders – SteamVR Home中的标准着色器有很多选择,包括“铃铛”和“口哨声”(这是渲染器的名字)。 不要将它们全部打开,并希望在基本硬件上以帧速率渲染所有内容–特别昂贵的事情可能是具有多层透明几何体(经过alpha测试的几何体绝对不便宜,这要归功于一些超漂亮的抗锯齿功能) 。
- 如果可以的话,找一个拥有入门级GPU的人来进行测试– Nvidia GeForce GTX 970或AMD Radeon RX 480是一个很好的基准。
(译者1050 4GB版都能轻松驾驭)
要获取当前渲染成本的最新视图,请在SteamVR中打开帧时序窗口:设置:性能:显示帧时序。 在啥也不干的情况下,底部的GPU图形应保持在11ms以下,底部没有弹出任何非零的红线–如果在游戏模式下运行,曾经超过11ms,自适应保真度应尽量最大化GPU的使用率,
提示:谈论“获得5fps”或类似的东西并没有多大意义-在游戏开发中,大约只有几毫秒。 维持90fps所需的时间仅需11ms以上,因此节省2ms比“节省5fps”有意义得多,因为这并没有表明节省了绝对渲染成本。 (您是以10fps还是1000开头的?)
如果您的CPU使用率跃升到11ms以上,则可能会遇到其他问题。 以下是一些潜在的CPU成本:
- 实体开销 – 它很有可能是地图中特定实体的某些方面,而不是所有实体的总数,但是如果您在某件事上比平时执行或创建了更多,那么可能值得进一步研究。
- 脚本开销 – 脚本必须在该帧上完成运行才能继续渲染,因此,如果您有复杂的循环和大量的逻辑,这些脚本可能会太昂贵。
- 复杂渲染 – 与直觉相反,由于绘图调用,即使GPU没有达到极限,您也可能需要很高的渲染成本。 如果您有许多不同的模型和/或材质,则CPU必须告诉GPU渲染每个模型和材质改如何处理,这会导致成本增加,而您拥有的东西更多。
- 复杂物理效果处理 – 同时在场景中拥有太多物理模拟的对象可能会带来可观的计算成本–尤其是复杂的碰撞船体与另一个碰撞时可能会非常昂贵,从而导致严重的帧丢失。 更多有关简化物理系统的信息!
关于VDC
最后,欢迎访问Valve开发者社区Wiki! 本文档是一份永无止境的工作,由像您这样的人部分构建而成-每个页面都有一个讨论部分,每个页面都可以根据需要进行编辑和扩展。 如果您有任何答案,也请发布文章
也欢迎有英文基础的开发者汉化所有Source 2英文文章。
欢迎来到VR,未来即是现在!