# 欢迎访问Verge3D中文用户手册

此文档即将关闭，即将使用官方域名下的 <https://www.soft8soft.com/docs/manual/zh/> 替换，您依然可以使用本域名(<https://docs.eigtest.com/)做跳转。官方中文托管版本发布后，本域名将不再绑定到Gitbook。感谢关注，欢迎访问Verge3D用户手册中文版。>


# 初学指南

Beginner's Guide ——fastest已校订

为便于初学者更准确理解Verge3D，初学指南为英中文对照，相关路径、菜单、按钮名称参照英文记忆，提高学习使用效率。

## Verge3D

Verge3D是一款多功能的软件，您可以根据个人喜好来进行不同用途的应用。本指南仅介绍了如何构建工作流程的可能方法之一，因此请将其看作一种友好的推荐。唯一的先决条件是您应该具备3D编辑软件（Verge3D载体）Autodesk 3ds Max或者Blender的使用经验，。

### 安装（Installation）

The installation procedure is throughly described in the corresponding sections for each supported 3D suite individually: [3ds Max](https://docs.eightest.com/getting-started/installation-verge3d-for-3ds-max), [Blender](https://docs.eightest.com/getting-started/installation-verge3d-for-blender).

安装过程在对应支持的3D编辑软件中分别逐步介绍：[3ds Max](https://docs.eightest.com/getting-started/installation-verge3d-for-3ds-max)，[Blender](https://www.soft8soft.com/docs/manual/en/introduction/Installation-Blender.html)。

### 预览（Sneak Peek）

To make sure that Verge3D is installed correctly, you can render a basic model in the web browser by using the **Sneak Peek** menu option (3ds Max) or button (Blender). This function will perform an export to a temporary folder and will run the default web browser with interactive rendering.

要确保已经正确安装Verge3D，您可以使用“Sneak Peek”菜单选项（3ds Max）或按钮（Blender）在Web浏览器中呈现出基本模型。此功能将执行导出到临时文件夹，并将使用交互式渲染方式来运行默认Web浏览器。

![](/files/-LZFUWJmVcFwu6UZwmQw)

![](/files/-LZFUa3DD8c0fIg1sDd1)

You may use Sneak Peek for quick tests any time you are working on your projects.

您可以在任何时候进行项目时使用Sneak Peek进行快速测试。

### 应用管理（App Manager）

Although you can start working on graphics first and create a Verge3D project later, we encourage you to get used to the App Manager from the beginning. By doing so you ensure that your files are properly organized and stored within the same folder which is important for integrity of your project, and especially for publishing. You will also have a working web application which you can run/reload in the browser independently from your source scene files.

虽然您可以先开始处理图形并稍后创建Verge3D项目，但我们建议您从一开始就使用App Manager。通过这样做，您可以确保正确组织文件并将其存储在同一文件夹中，这对项目的完整性非常重要，特别是对于发布。您还将拥有一个可用的Web应用程序，您可以在浏览器中独立于源场景文件运行/重新加载。

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-main.png)

The App Manager as a web-based tool which opens up in the browser when you select the App Manager option in the Verge3D menu (3ds Max) or click the same-name button (Blender). The default system browser will be running - you can change it in your OS settings. Any modern browser will work yet we recommend the latest version of Google Chrome which is fast, standards-compliant and offers good web development tools.

App Manager作为基于Web的工具，当您在Verge3D菜单（3ds Max）中选择App Manager选项或单击同名按钮（Blender）时，该工具将在浏览器中打开。默认系统浏览器将运行 - 您可以在操作系统设置中更改它。任何当下的浏览器都可以使用，我们推荐最新版本的谷歌浏览器，它快速，标准同时提供良好的网络开发工具。

![](/files/-LZF55vVaB0aHwcp8vgC)

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-blender.png)

You can create a new project using the panel on the right. Type a project name (or just leave my\_awesome\_app) and click Create App. Leave the default configuration options as they are for now.

您可以使用右侧的面板创建新项目。键入项目名称（或只保留my\_awesome\_app），然后单击“ 创建应用程序”。暂时保留默认配置选项。

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-create.png)

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-created.png)

As a result, a folder named after your app will be created inside the applications folder of your Verge3D installation. It is important to know where your app folder is because all your textures and other project assets should be stored here.

因此，将在Verge3D安装的applications文件夹中创建以您的应用程序命名的文件夹。了解app文件夹的位置非常重要，因为所有纹理和其他项目资产都应存储在此处。

![](https://www.soft8soft.com/docs/files/beginner_guide/app-folder.png)

After you created a project, return to the main screen of the App Manager - your project should be listed there. Now you can proceed with your app in several directions, by simply running it, authoring the graphics, creating interactive scenarios and eventually, publishing.

创建项目后，返回到App Manager的主屏幕 - 您的项目应该列在那里。现在，您可以通过简单地运行，创作图形，创建交互式场景以及最终发布等操作，在多个方向上继续您的应用。

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-app-buttons.png)

You may also check out the following videos explaining how to create a new Verge3D project with the App Manager: [3ds Max](https://www.youtube.com/watch?v=99swwn8kpCo), [Blender](https://www.youtube.com/watch?v=ibPSGArAfJM).

您还可以查看以下视频，了解如何使用App Manager创建新的Verge3D项目：[3ds Max](https://www.youtube.com/watch?v=99swwn8kpCo)，[Blender](https://www.youtube.com/watch?v=ibPSGArAfJM)。

### 运行你的应用（Running Your App）

You can run your app any time by clicking the Verge3D icons, either the blue or the green one. The blue icon launches an app in its final form, with its Puzzles scenario and the programming code (if present). On the contrary, the green icon only opens the exported scene.

您可以通过单击Verge3D图标（蓝色或绿色图标）随时运行您的应用程序。蓝色图标以最终形式启动应用程序，其中包含Puzzles场景和编程代码（如果存在）。相反，绿色图标仅打开导出的场景。

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-app-buttons-run.png)

A freshly created app loads and displays just a cube. You can look around with the left mouse button pressed, and zoom in and out with the mouse wheel.&#x20;

新创建的应用程序加载并显示一个立方体。您可以按下鼠标左键环顾四周，然后使用鼠标滚轮放大和缩小。

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-app-running.png)

If instead it shows something like "This site can’t be reached" this means that you accidentally closed your 3D editor and the development server along with it. In this case you should launch 3ds Max or Blender again.

相反，如果显示“无法访问此站点”，则表示您意外关闭了3D编辑器和开发服务器。在这种情况下，您应该再次启动3ds Max或Blender。

Although very rare, another warning can be shown: "Your graphics card does not seem to support WebGL." This can happen if you're using an outdated or unsupported browser such as Internet Explorer below version 11, or your video card and/or drivers are blacklisted by the browser. Try installing latest Google Chrome/updating your OS/downloading latest drivers or just find another computer to work on.

虽然非常少见，但也可能显示另一个警告：“您的图形卡似乎不支持WebGL。”如果您使用的是过时或不受支持的浏览器（如版本11以下的Internet Explorer），或者您的显卡和/或驱动程序被浏览器列入黑名单，则可能会发生这种情况。尝试安装最新的谷歌浏览器/更新您的操作系统/下载最新的驱动程序或干脆找另一台计算机。

### 输出（Export）

By clicking on the 3ds Max or Blender icon you can open up the main .max or .blend file of your application respectively.

通过单击3ds Max或Blender图标，您可以分别打开应用程序的.max或.blend文件。

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-app-buttons-max.png)

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-app-buttons-blender.png)

The 3D editor files can be also opened as usual via the "File > Open" dialog or simply by double-clicking on them in the application folder.

3D编辑器文件也可以像往常一样通过“文件>打开”对话框打开，或者只需在应用程序文件夹中双击它们即可。

It is important to understand that an application loads only exported scenes and not the source 3D editor files.So every time you change something in your source file you should export it in order to see the changes in your app. Exporting can be performed from the Verge3D menu of the main menu bar (in 3ds Max) or from the File > Export menu (in Blender). You might want to assign a shortcut for this operation since you may perform it quite often.

重要的是要了解应用程序仅加载导出的场景而不加载源3D编辑器文件。因此，每次更改源文件中的内容时，都应导出它以便查看应用程序中的更改。可以从主菜单栏的Verge3D菜单（在3ds Max中）或从文件>导出菜单（在Blender中）执行导出。您可能希望为此操作指定快捷方式，因为您可能会经常执行此操作。

<div align="center"><img src="/files/-LZF9iGeLnaMELksZ-jG" alt=""></div>

<div align="center"><img src="https://www.soft8soft.com/docs/files/beginner_guide/export-blender.png" alt=""></div>

You can export your scene file right to the root of the application folder, in glTF format.

您应该以glTF格式将场景导出到应用程序文件夹的根目录。

![](/files/-LZFAs7alFGahaR-ZFr5)

![](/files/-LZFAZ048Sj-SdQ-NQg-)

To test it out, add some teapots/Suzannes to your scene, export to glTF and run your app by clicking the blue Verge3D logo icon in the App Manager.

要测试它，在场景中添加一些茶壶/ Suzannes（金属猴头），导出到glTF并通过单击App Manager中的蓝色Verge3D图标来运行您的应用程序。

For quicker iterations, you can keep your application always running in a browser tab. Hit "F5" on your keyboard after you re-export your scene so that it reloads in the browser. Use the "Alt+Tab" ("Command+Tab" on Mac) shortcut to instantly switch between your 3D editor and the browser.

为了更快地进行迭代，您可以使应用程序始终在浏览器选项卡中运行。 重新导出场景后，在键盘上按“F5”，以便在浏览器中重新加载。 使用“Alt + Tab”（Mac上的“Command + Tab”）快捷键可立即在3D编辑器和浏览器之间切换。

### 拼图编辑器（Puzzles）

Until now we used Verge3D as a fancy web exporter, which generates live 3D views running in the browser. With Puzzles, Verge3D's visual scripting tool, you can add behavior scenarios so that your 3D scene becomes a truly interactive web application.

到目前为止，我们使用Verge3D作为一个优秀的Web导出器，它可以生成在浏览器中运行的实时3D视图。借助Verge3D的可视化脚本工具Puzzles，您可以添加行为场景，以便您的3D场景成为真正的交互式Web应用程序。

![](/files/-LZFC4ZdnCI45uzuk9d2)

Click the Puzzles button near your app name in the App Manager. This will run your app with the Puzzles editor attached on top of it. On the left the toolbox with some categories ("Events", "Selectors", "Objects", etc) is located. The categories are expanded upon mouse click revealing puzzles which you can drag out to the workspace. By connecting various puzzles with each other you can create a scenario of how your 3D objects will behave upon user input.

单击应用程序管理器中应用程序名称旁边的“拼图”按钮。这将运行你的应用程序与它上面的拼图编辑器。在左侧，工具箱中包含一些类别（“事件”，“选择器”，“对象”等）。通过鼠标单击打开拼图可以扩展类别，您可以将其拖出到工作区。通过将各种谜题相互连接，您可以创建3D对象在用户输入时的行为方式。

![](https://www.soft8soft.com/docs/files/beginner_guide/puzzles-toolbox.png)

To do something meaningful for the beginning, drag out the when clicked puzzle from the Events category, and the select an object puzzle from the Selectors.

要在开始时执行有意义的操作，请从“Events”类别中拖出When clicked拼图，然后从“Selectors”中选择一个object拼图（Camera）。

![](https://www.soft8soft.com/docs/files/beginner_guide/puzzles-toolbox2.png)

Connecting them together means that you app will be waiting until the user clicks on the object that you chose in the dropdown menu ("Cube", for example), and will do... nothing unless you add something in the do slot.

将它们连接在一起意味着您的应用程序将等待用户单击您在下拉菜单中选择的对象（例如，“立方体”），并且除非您在do插槽中添加内容，否则将不会执行任何操作。

![](https://www.soft8soft.com/docs/files/beginner_guide/puzzles-example.png)

Drag out the hide puzzle from the Objects and insert it to that slot. Drag out another object selector puzzle and connect it with hide.

从Objects中拖出hide拼图并将其插入该插槽。从Selector类别中拖出另一个object并将其与hide连接。

![](https://www.soft8soft.com/docs/files/beginner_guide/puzzles-example2.png)

Now, once the user clicks on the 3D object, it it should disappear. Click the Run button in order to launch your program and check if it works by clicking on the cube.

现在，一旦用户点击3D对象，它就会消失。单击“运行”按钮以启动程序，并通过单击立方体来检查它是否有效。

![](https://www.soft8soft.com/docs/files/beginner_guide/puzzles-run.png)

In order to make your scenario a persistent part of your application, be sure to save it.

为了使您的场景成为您应用程序的一部分，请确认保存它。

![](https://www.soft8soft.com/docs/files/beginner_guide/puzzles-save.png)

Once you finished with Puzzles, you can run your now-interactive app using the blue icon in the App Manager. Congratulations, you have become a programmer!&#x20;

完成拼图后，您可以使用App Manager中的蓝色图标运行现在的交互式应用程序。恭喜你，你已成为一名程序员！

You may also check out the following videos explaining how to work with the Puzzles: [3ds Max](https://www.youtube.com/watch?v=Jsfqd9CIwqQ), [Blender](https://www.youtube.com/watch?v=u-a_TJKQ8oQ).

您还可以查看以下视频，了解如何使用拼图： [3ds Max](https://www.youtube.com/watch?v=Jsfqd9CIwqQ)，[Blender](https://www.youtube.com/watch?v=u-a_TJKQ8oQ)。

### 发布（Publishing）

**On your own website...**

You've created a web application and probably want the billions of Internet users to come and check it out. If you own a website, this won't be a problem - simply upload the entire folder with your application to your server (via FTP, for example). Once deployed, you can provide a link to the app's HTML file somewhere on your website, or embed it in a web page with the iframe HTML element:

**在您自己的网站上......**&#x20;

您已经创建了一个Web应用程序，可能希望数十亿的Internet用户来查看它。如果您拥有一个网站，这不会是一个问题 - 只需将您的应用程序的整个文件夹上传到您的服务器（例如，通过FTP）。部署后，您可以在网站上的某个位置提供应用HTML文件的链接，或将其嵌入带有iframe HTML元素的网页中：

```
<iframe width="1024" height="640" allowfullscreen src="https://www.example.com/my_awesome_app/my_awesome_app.html"></iframe>
```

**Using Wordpress...**&#x20;

The task is even more simplified if you are running the Wordpress CMS on your website - you can use the free Verge3D Wordpress plugin to upload and embed Verge3D apps.

**使用Wordpress ...**&#x20;

如果您在网站上运行Wordpress CMS，则任务更加简化 - 您可以使用免费的Verge3D Wordpress插件上传和嵌入Verge3D应用程序。

**On Verge3D Network...**&#x20;

But what if you haven't had the chance to become a web master? No problem - by clicking the "Globe" button in the App Manager you can upload your app to the Verge3D Network, a cloud-based storage and CDN hosted on Amazon servers.

**在Verge3D网络上......**

&#x20;但是如果你没有机会成为一名网络大师呢？没问题 - 通过单击App Manager中的“Globe”按钮，您可以将应用程序上传到Verge3D Network，这是一个基于云的存储和托管在Amazon服务器上的CDN。

![](https://www.soft8soft.com/docs/files/beginner_guide/app-manager-app-buttons-network.png)

After the uploading is complete, a screen will show up with a direct link which you can share by whatever means (in a blog post, social media, comments, email, you name it). It will also generate HTML code for embedding your app in third-party websites just like you do it with YouTube videos.

上传完成后，屏幕将显示一个直接链接，您可以通过任何方式共享（在博客文章，社交媒体，评论，电子邮件，您的名字）。它还会生成HTML代码，以便将您的应用嵌入第三方网站，就像使用YouTube视频一样。

![](https://www.soft8soft.com/docs/files/beginner_guide/network-uploaded.png)

You may also check out the following videos explaining how to publish your app on Verge3D Network: [3ds Max](https://www.youtube.com/watch?v=d5cPnnblV30), [Blender](https://www.youtube.com/watch?v=Uf5wuLlyn-k).

您还可以查看以下视频，了解如何在Verge3D Network上发布您的应用：[3ds Max](https://www.youtube.com/watch?v=d5cPnnblV30)**，**[Blender](https://www.youtube.com/watch?v=Uf5wuLlyn-k)。

**On Facebook...**&#x20;

Finally, you can post a 3D model directly on Facebook by leveraging the 3D Posts feature.

**在脸书上...**&#x20;

最后，您可以通过利用3D帖子功能直接在Facebook上发布3D模型。

### 授权码（License Key）

After acquiring a license, you'll be sent the license information in an email (the key below is a random example).

获得许可证后，您将通过电子邮件收到许可证信息（下面的密钥是随机示例）。

![](https://www.soft8soft.com/docs/files/beginner_guide/license-info.png)

![](https://www.soft8soft.com/docs/files/beginner_guide/license-activation.png)

The license key will activate your Verge3D instance and will remove the trial watermark from all your apps.

许可证密钥将激活您的Verge3D实例，并将从您的所有应用程序中删除试用水印。

![](https://www.soft8soft.com/docs/files/beginner_guide/license-activated.png)

Be sure to enter the license key each time you update to a new version.

每次更新到新版本时，请务必输入许可证密钥。

### 未完待续（What's Next）

For more detailed information check out the other topics from this User Manual. We also invite you join Soft8Soft [community forums](https://www.soft8soft.com/forums/) where we'd be happy to answer all your questions.

有关更多详细信息，请查看本用户手册中的其他主题。我们还邀请您加入[Soft8Soft社区论坛](https://www.soft8soft.com/forums/)，我们很乐意回答您的所有问题。


# 工作流程

Workflow ——fastest已校订

Below is documented a typical workflow that is used internally by the Soft8Soft team and by Verge3D users (examples include the [Scooter Configurator](https://cdn.soft8soft.com/demo/applications/scooter/index.html) demo, [Teapot Heater](https://cdn.soft8soft.com/demo/applications/teapot_heater_max/index.html) demo, [Industrial Robot​](https://cdn.soft8soft.com/demo/applications/industrial_robot/index.html) demo, [e-commerce website](https://cdn.soft8soft.com/demo/applications/recliner_max/index.html) mock-up among others).

下面是由Soft8Soft团队和Verge3D用户内部使用的一个典型的工作流程（案例包括[摩托车配置](https://cdn.soft8soft.com/demo/applications/scooter/index.html)演示，[茶壶加热器](https://cdn.soft8soft.com/demo/applications/teapot_heater_max/index.html)演示，[工业机器人](https://cdn.soft8soft.com/demo/applications/industrial_robot/index.html)演示，[电子商务网站](https://cdn.soft8soft.com/demo/applications/recliner_max/index.html)实体模型等）。

1. 建模和烘焙 （Modeling and Baking）
2. 选择材质系统（Choosing Material System）
3. 图片格式，分辨率和最佳实践（Image Formats, Resolution and Best Practices）
4. PBR贴图（PBR Textures）
5. 环境贴图（Environment Map）
6. HDR渲染（HDR Rendering）
7. 动画（Animation）
8. 项目（Project）
9. 拼图（Puzzles）
10. 布局和UI（Layout and UI）
11. 后期效果（Post-processing）
12. 声音（Audio）
13. 资产压缩（Asset Compression）
14. 发布（Publishing）

Both the 3ds Max and Blender versions of Verge3D can be used with equal success.

**3ds Max**和**Blender**版本的**Verge3D**都可以同样成功使用这些案例。

![](https://www.soft8soft.com/docs/files/workflow/teapot-heater.jpg)

＃

### 建模和烘焙 （Modeling and Baking）

In our team, we practice the following modeling pipeline. At first, high-poly versions of models are created. At the next stage, low- to middle-poly models are obtained via simply removing the subsurf modifier or retopology. No more than 100k tris per model is recommended.

在我们的团队中，使用以下建模流程。首先，创建高精度的模型。在下一阶段，通过简单地移除**suburf修改器**或**拓扑方式（retopology）**&#x83B7;得低面到中等面模型。模型建议不超过10万三角面片。

![](https://www.soft8soft.com/docs/files/workflow/teapot-modeling.jpg)

The low-poly models are then UV-unwrapped. Finally, the meshes are triangulated - this is not a requirement of Verge3D but rather recommended for baking maps. Also, triangulated models are better suited for loading to third-party editors such as Substance Painter.

然后对低面模型进行展UV。最后，网格是三角形的 - 这并不是**Verge3D**的要求，但更适用于**烘焙贴图**。此外，三角模型更适合加载到第三方编辑器，如**Substance Painter**。

Normal and occlusion maps, if they are needed, are baked using the superimposed high-poly and triangulated low-poly meshes.

根据需要，可以使用叠加的高模和低模来进行**烘焙法线**和**AO贴图**。

＃

### 选择材质系统（Choosing Material System）

We recommend 3ds Max artists to use standard/Scanline or physical/ART (v. 2017 or higher required) materials. Blender artists should use Cycles or Eevee (v. 2.8 required) materials. If your content needs to be compatible with [glTF 2.0 standard](https://www.khronos.org/news/press/khronos-releases-gltf-2.0-specification) for some reason (such as for posting your model on Facebook), you should use Verge3D PBR shader (see the setups for [3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material.html), [Blender](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material-Blender.html)).

我们建议3ds Max艺术家使用**standard/Scanline** 或 **physical/ART** （需要2017年或更高版本）材质。Blender艺术家应使用**Cycles**或**Eevee**（需要2.8版）材质。如果您的内容由于某种原因需要与[**glTF 2.0标准**](https://www.khronos.org/news/press/khronos-releases-gltf-2.0-specification)兼容（例如在Facebook上发布您的模型），您应该使用**Verge3D PBR着色器**（请参阅[3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material.html)，[Blender](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material-Blender.html)的设置）。

You may also check out the following videos explaining how to use physically-based materials: [3ds Max](https://www.youtube.com/watch?v=s_QjxCr8I6k), [Blender](https://www.youtube.com/watch?v=wQ0KH4bA3Uw).

您还可以查看以下视频，了解如何使用基于物理的材质：[3ds Max](https://www.youtube.com/watch?v=s_QjxCr8I6k)，[Blender](https://www.youtube.com/watch?v=wQ0KH4bA3Uw)。

＃

### 图像格式，分辨率和最佳实践（Image Formats, Resolution and Best Practices）

#### PNG或JPEG

For best efficiency, we recommend you to use web-friendly formats for your textures: lossless PNG with maximum compression, or lossy JPEG (although Verge3D also supports GIF, BMP, TIFF). As a rule of thumb, if you don't need the alpha channel in your texture, prefer using JPEG over PNG.

为了获得最佳效率，我们建议您为纹理使用适用网络格式：具有最大压缩的**无损PNG**或**有损JPEG**（尽管Verge3D也支持GIF，BMP，TIFF）。根据经验，如果您不需要纹理中的Alpha通道，则首选使用JPEG而不是PNG。

#### 法线贴图（Normal Maps）

The normal maps should be saved as PNG even if the alpha channel is wasted, because normal maps loaded in JPEG format often produce visible shading artefacts. The images in PNG format, however, may be too heavy in regards to file size, so use normal maps only if there is a strong need in them.

即使Alpha通道被浪费，法线贴图也应保存为PNG，因为以JPEG格式加载的法线贴图通常会产生可见的着色伪影。然而，PNG格式的图像在文件大小方面可能过于沉重，因此只有在需要时才使用法线贴图。

#### 解析度（Resolution）

Be careful to not use too detailed textures unless you really need them. Big images can adversely impact the performance, drain video memory which is scarce on handheld devices (all the way down to crash) and significantly prolong the loading. The resolution of most of your textures should be 1024 px or below.

除非你真的需要它们，否则不要使用太详细的纹理。大图像会对性能产生负面影响，耗尽手持设备上的视频内存（一直到崩溃）并显着延长负载。大多数纹理的分辨率应为1024像素或更低。

#### 注意NPOT（Beware of NPOT）

The resolution of the textures should follow power the power-of-two rule (256, 512, 1024 px is great while 1000 px is bad). The engine re-scales all non-power-of-two (NPOT) images upon loading anyway, so consider carefully reviewing your textures in order to achieve maximum efficiency with regard to file size and loading time.

纹理的分辨率应遵循二次幂规则的功率（256,512,1024 px很好而1000 px很差）。无论如何，引擎在加载时重新调整所有非二次幂（NPOT）图像，因此请仔细检查纹理，以便在文件大小和加载时间方面实现最高效率。

#### 比例（spect）

Textures may be square or rectangular such as 1024x512 px.

纹理可以是正方形或矩形，例如1024x512像素。

#### 重复使用（Reuse）

Always try re-using image files in your materials, and texture maps/nodes in your shaders, rather than making copies.

始终尝试重复使用材质中的图像文件，以及着色器中的纹理贴图/节点，而不是复制。

#### 在RGBA中打包BW（Pack BW in RGBA）

If you have several black and white images (AO, light maps, transparency masks, color masks, etc), consider packing them in the RGBA channels of a single texture.

如果您有多个黑白图像（AO，光照贴图，透明蒙版，颜色蒙版等），请考虑将它们打包在单个纹理的RGBA通道中。

#### 按需加载（Load on Demand）

If you are developing a customizer or a similar app, you may consider loading only a limited set of textures on startup. The other textures can be loaded and applied to your models on the demand basis using the [replace texture](https://www.soft8soft.com/docs/manual/en/puzzles/Materials.html#replace_texture) puzzle.

如果您正在开发自定义程序或类似的应用程序，您可以考虑在启动时仅加载一组有限的纹理。可以使用[替换纹理](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#replace_texture)拼图在需求的基础上加载其他纹理并将其应用于模型。

```
不要将大图作为图标重复使用 – 即使要用到更多图片，也应该预先缩放。
```

＃

### PBR纹理（PBR Textures）

**Verge3D**支持以下PBR材质模型：

* 物理材质/ART（3ds Max）
* Principled BSDF Cycles/Eevee 节点(Blender)
* glTF-兼容PBR (3ds Max, Blender)

但是，所有这三种情况都遵循在图像中打包PBR组件的相同惯例：

* AO打包在R通道中
* 粗糙度打包在G通道中
* 金属度包装在B通道中

The set of PBR textures can be created using any suitable software. In our team, we use Substance Painter for which we created presets to ensure the compatibility with Verge3D/glTF. Instructions and the download links to those presets can be found in the following sections: [3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material.html), [Blender](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material-Blender.html).

可以使用任何合适的软件创建该组PBR纹理。在我们的团队中，我们使用Substance Painter为其创建了预设，以确保与Verge3D / glTF的兼容性。可以在以下部分中找到有关这些预设的说明和下载链接：[3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material.html)，[Blender](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material-Blender.html)。

![](https://www.soft8soft.com/docs/files/workflow/substance_screenshot.jpg)

The models and the baked normal and occlusion maps (if any) can be loaded in Substance Painter via OBJ format. Overall 3 maps are produced in this software in the end: base color/transparency, occlusion/roughness/metallic and normal. The textures are exported using the Verge3D preset for Substance Painter.

模型和烘焙的法线和AO贴图（如果有）可以通过OBJ格式加载到Substance Painter中。最终在该软件中生成3张贴图：颜色/透明度，AO/粗糙度/金属度和法线。使用 Substance Painter 的Verge3D预设导出纹理。

![](https://www.soft8soft.com/docs/files/workflow/pbr_texture_set_preview.jpg)

Finally, PBR materials are set up for relevant models by either using the native PBR shader (physical/ART in 3ds Max, Principled BSDF Cycles/Eevee node in Blender) or glTF-compliant Verge3D PBR shader.

最后，通过使用本地PBR材质（3ds Max中的 physical / ART，Blender中的Principled BSDF Cycles / Eevee节点）或符合glTF的Verge3D PBR 材质 ，为相关模型设置PBR材质。

＃

### 环境贴图（Environment Map）

Environment map is a key component of a real-time scene used for providing the background and material reflections. We recommend both 3ds Max and Blender artists to use equirectangular images in HDR or JPEG format (although cube maps are also supported). The size of the environment map is better to not exceed 2048x1024 px.

环境贴图是用于提供背景和材质反射的实时场景的关键组件。我们建议3ds Max和Blender艺术家使用HDR或JPEG格式的equirectangular图像（虽然也支持立方体贴图）。环境贴图的大小最好不超过2048x1024像素。

![](https://www.soft8soft.com/docs/files/workflow/hdr-environment.jpg)

Besides that, HDR textures can be used for imitating complex lighting conditions – for example, if there are too many light sources to be represented by traditional lamps, or they are extended.

除此之外，HDR纹理可用于模拟复杂的照明条件 - 例如，如果有太多的光源要由传统灯表示，或者它们是扩展的。

As of v. 2.10, the default cube projects for both 3ds Max and Blender include the HDR texture called environment.hdr which you can reuse in your apps.

从v.2.10开始，3ds Max和Blender的默认立方体项目都包含名为environment.hdr的HDR纹理，您可以在应用中重复使用该纹理。

You may also check out the following videos explaining how to setup the HDR environment for the physically-based pipeline: [3ds Max](https://www.youtube.com/watch?v=s_QjxCr8I6k), [Blender](https://www.youtube.com/watch?v=wQ0KH4bA3Uw).

您还可以查看以下视频，了解如何为基于物理的管道设置HDR环境：[3ds Max](https://www.youtube.com/watch?v=s_QjxCr8I6k)，[Blender](https://www.youtube.com/watch?v=wQ0KH4bA3Uw)。

＃

### HDR渲染（HDR Rendering）

HDR (high dynamic range) rendering pipeline can be enabled with the corresponding checkbox in Verge3D export settings window (3ds Max), or on Verge3D settings panel under the Render tab (Blender). In this mode, half-float textures are used by the engine for better precision and intensity range, which particularly, is important for proper rendering of the [bloom post-process effect](https://www.soft8soft.com/docs/manual/en/puzzles/Postprocessing.html#bloom).

可以使用Verge3D导出设置窗口（3ds Max）中的相应复选框或“渲染”选项卡（Blender）下的Verge3D设置面板启用HDR（高动态范围）渲染流程。在此模式中，引擎使用半浮动纹理以获得更好的精度和强度范围，这对于正确渲染辉光后期处理效果（ [bloom post-process effect](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#bloom) ）非常重要。

![](https://www.soft8soft.com/docs/files/workflow/scooter-bloom.jpg)

＃

### 动画（Animation）

Animation clips are created for relevant model parts as usual. Skinning, whole-object, morph-target and material animation can be used to produce various effects.

像往常一样为相关模型部件创建动画片段。可以使用蒙皮，整个对象，变形目标和材质动画来产生各种效果。

![](https://www.soft8soft.com/docs/files/workflow/animation.png)

You might want to provide human-readable names to animated objects so that they can be easily found in the [Puzzles editor](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html).

您可能希望为动画对象提供易于读写的名称，以便可以在[Puzzles编辑器中](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#Animation_)轻松找到它们。

![](https://www.soft8soft.com/docs/files/workflow/advanced_animation_puzzle.jpg)

You may also check out the following videos explaining how to create animation: [3ds Max](https://www.youtube.com/watch?v=0dskMLdNpJ4), [Blender](https://www.youtube.com/watch?v=doifPffYc_o).

您还可以查看以下视频，了解如何创建动画：[3ds Max](https://www.youtube.com/watch?v=0dskMLdNpJ4)，[Blender](https://www.youtube.com/watch?v=doifPffYc_o)。

＃

### 项目（Animation）

After setting up the scene (during which you can use the Sneak Peek button to check it in the browser), you can create a persistent Verge3D project using the App Manager. The configuration settings can usually be left default.

在设置场景（在此期间您可以使用**Sneak Peek**按钮在浏览器中进行检查）之后，您可以使用**App Manager**创建一个持久的Verge3D项目。配置设置通常可以选择默认值。

![](https://www.soft8soft.com/docs/files/workflow/app-manager-create-new.jpg)

You can simply override the default cube **.max** or **.blend** file, located in your application folder (which in turn is located in verge3d/applications), by your own **.max** or **.blend** file. Be sure to move all relevant image files in this folder too. After that, open your **.max** or **.blend** file from the new location and perform export in glTF format, thus overriding the default **.glTF** file.

你可以简单地将自己**的.max**&#x6216;**.blend**文件，覆盖默认立方体&#x7684;**.max**&#x6216;**.blend**文件，它位于您的应用程序文件夹中（verge3d / applications），请务必将所有相关的图像文件也移动到此文件夹。然后，重新打&#x5F00;**.max**&#x6216;**.blend**文件，并以glTF格式执行导出，从而覆盖默认&#x7684;**.glTF**文件。

![](https://www.soft8soft.com/docs/files/workflow/default_application.png)

Alternatively, you can consider creating a Verge3D project at first and start working using the default **.max** or **.blend** file located in the application folder, just how it was suggested in the [corresponding section](https://www.soft8soft.com/docs/manual/en/introduction/Beginner-Guide.html#App_Manager) of the Beginner's Guide.

或者，您可以考虑首先创建一个Verge3D项目，然后使用位于应用程序文件夹中的默&#x8BA4;**.max**&#x6216;**.blend**文件开始工作，就像在初学者指南的[相关介绍](https://www.soft8soft.com/docs/manual/en/introduction/Beginner-Guide.html#App_Manager)中建议的那样。

You may also check out the following videos explaining how to create a new Verge3D project with the App Manager: [3ds Max](https://www.youtube.com/watch?v=99swwn8kpCo), [Blender](https://www.youtube.com/watch?v=ibPSGArAfJM).

您还可以查看以下视频，了解如何使用App Manager创建新的Verge3D项目：[3ds Max](https://www.youtube.com/watch?v=99swwn8kpCo)，[Blender](https://www.youtube.com/watch?v=ibPSGArAfJM)。

＃

### 拼图（Puzzles）

An interactive scenario is created using Puzzles for triggering animations upon clicks, outlining objects upon hovering, positioning model parts, logic checks, etc.

使用**拼图**创建交互式场景，用于在点击时触发动画，在悬停时显示轮廓，定位模型部件，逻辑检查等。

![](https://www.soft8soft.com/docs/files/workflow/puzzles-editor.jpg)

Check out the tutorial in the [Puzzles section](https://www.soft8soft.com/docs/manual/en/introduction/Beginner-Guide.html#Puzzles) of the Beginner's Guide, or proceed straight to the [Puzzles reference](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html) for more details.

查看初学指南的[拼图部分](https://www.soft8soft.com/docs/manual/en/introduction/Beginner-Guide.html#Puzzles)中的教程，或直接进入[拼图参考](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html)以获取更多详细信息。

You may also check out the following videos explaining how to work with the Puzzles: [3ds Max](https://www.youtube.com/watch?v=Jsfqd9CIwqQ), [Blender](https://www.youtube.com/watch?v=u-a_TJKQ8oQ).

您还可以查看以下视频，了解如何使用拼图：[3ds Max](https://www.youtube.com/watch?v=Jsfqd9CIwqQ)，[Blender](https://www.youtube.com/watch?v=u-a_TJKQ8oQ)。

＃

### 布局和U&#x49;**（Layout and UI）**

In our code-less workflow the HTML-based interface is built using external web design software. Any WYSIWYG editor capable of exporting HTML/CSS/JS files will work – for example, Google Web Designer (free, cross-platform) or Webflow (paid, cloud-based). You can, of course, build the HTML interface manually with code or using some other tools instead.

在我们的无代码工作流程中，基于HTML的界面是使用外部Web设计软件构建的。任何能够导出HTML / CSS / JS文件的可视化编辑器都可以使用 - 例如，Google Web Designer（免费，跨平台）或Webflow（付费，基于云）。当然，您可以使用代码或使用其他一些工具手动构建HTML界面。

![](https://www.soft8soft.com/docs/files/workflow/webflow-project.jpg)

Interface elements (menus, buttons, info boxes...) are created as part of a separate web page in which a Verge3D app is embedded. See the detailed [guide on creating HTML-based GUI](https://www.soft8soft.com/docs/manual/en/introduction/HTML-based-user-interfaces.html) for more details and examples.

界面元素（菜单，按钮，信息框...）是作为嵌入Verge3D应用程序的单独网页的一部分创建的。有关更多详细信息和示例，请参阅[有关创建基于HTML的GUI](https://www.soft8soft.com/docs/manual/en/introduction/HTML-based-user-interfaces.html)的详细[指南](https://www.soft8soft.com/docs/manual/en/introduction/HTML-based-user-interfaces.html)。

＃

### 后期处&#x7406;**（Post-processing）**

The following effects can be enabled with [Post-processing Puzzles](https://www.soft8soft.com/docs/manual/en/puzzles/Postprocessing.html): bloom (which works best with HDR enabled), brightness-contrast, grayscale, depth of field and ambient occlusion. Parameters for these effects can be changed in runtime or animated with high performance thanks to internal caching. There is also a puzzle for removing all post-processing effects from a scene.

使用[后期效果拼图](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#Postprocessing)可以启用以下效果：辉光（在启用HDR时效果最佳），亮度对比度，灰度，景深和AO。这些效果的参数可以在运行时更改，也可以通过内部缓存以高性能设置动画。还有一个难题，可以从场景中删除所有后期效果。

![](https://www.soft8soft.com/docs/files/workflow/post-process-effects.jpg)

＃

### 音&#x9891;**（Audio）**

Background music and/or event sounds can be added with [Sound Puzzles](https://www.soft8soft.com/docs/manual/en/puzzles/Sound.html) to be triggered by the user. You should use the **mp3** format for your audio files as it is supported in all web browsers.

可以使用[声音拼图](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#Sound)添加背景音乐和/或事件声音以由用户触发。您应该将**mp3**格式用于音频文件，因为它在所有Web浏览器中都受支持。

![](https://www.soft8soft.com/docs/files/workflow/sounds.jpg)

There is a special restriction for playing sounds on iOS: the sound playback can only be initiated via direct interaction with a web page. For example, the following setup would work everywhere including on Apple's devices:

在iOS上播放声音有一个特殊限制：声音播放只能通过与网页的直接交互来启动。例如，以下设置可以在Apple的设备上随处可用：

![](https://www.soft8soft.com/docs/files/workflow/audio-example1.jpg)

However, if a sound is played upon some event which is not caused by direct user action, it wouldn't work on iOS:

但是，如果在某些事件上播放的声音不是由直接用户操作引起的，则在iOS上无效：

![](https://www.soft8soft.com/docs/files/workflow/audio-example2.jpg)

To overcome this problem, you can use the **on event / touchstart** puzzle that would play and immediately pause all the sounds used in a scene when the user taps on the screen for the first time:

要解决此问题，您可以使用可以播放的**on event / touchstart**拼图，并在用户第一次点击屏幕时立即暂停场景中使用的所有声音：

![](https://www.soft8soft.com/docs/files/workflow/audio-example3.jpg)

The above setup is available from the Puzzle Library under the name **Sound iOS Workaround**.

以上设置可从Puzzle Library以**Sound iOS Workaround**的名称获得。

＃

### 资产压&#x7F29;**（Asset compression）**

When the app it complete, you can optimize the loading of its scene files as described in the corresponding [section](https://www.soft8soft.com/docs/manual/en/introduction/Asset-compression.html) of this manual.

当应用程序完成时，您可以按照本手册相应[部分](https://www.soft8soft.com/docs/manual/en/introduction/Asset-compression.html)的说明优化其场景文件的加载。

You may also check out the following videos explaining how to enable asset compression for your apps: [3ds Max](https://www.youtube.com/watch?v=2WHsmOohNy8), [Blender](https://www.youtube.com/watch?v=eOY_yAJPRdw).

您还可以查看以下视频，了解如何为您的应用启用资源压缩：[3ds Max](https://www.youtube.com/watch?v=2WHsmOohNy8)，[Blender](https://www.youtube.com/watch?v=eOY_yAJPRdw)。

＃

### 出&#x7248;**（Publishing）**

You can publish your project using either of methods mentioned in the [Publishing](https://www.soft8soft.com/docs/manual/en/introduction/Beginner-Guide.html#Publishing) section of the Beginner's Guide.

您可以使用“初学指南”的“ [发布”](https://www.soft8soft.com/docs/manual/en/introduction/Beginner-Guide.html#Publishing)部分中提到的任一方法发布项目。


# 拼图工具

Puzzles ——fastest校订中···

Verge3D的Puzzles编辑器是开发任何复杂的智能Web应用程序的强大工具。通过Puzzles，您可以轻松地将行为场景添加到3D内容中，使其具有交互性并响应用户操作。这个神奇的工具既可用于快速原型制作，也可用于生产。对于3D艺术家来说，这个宝贵的工具克服了Web开发的技术障碍，从而可以将他们的创造力应用于交互式3D Web领域。

Puzzles编辑器中的拼图根据下面指定的类别进行分组。

* 初始化(Initialization)
* 事件(Events)
* 选择器(Selectors)
* 对象(Objects)
* 材质(Materials)
* 动画(Animation)
* 相机(Camera)
* 场景(Scenes)
* 杂项(Misc)
* 时间(Time)
* HTML(HTML)
* AR / VR(AR/VR)
* 声音(Sound)
* 约束(Constraints)&#x20;
* 后期处理(Post-processing)
* 字典(Dictionaries)
* 变量(Variables)
* 程序(Procedures)
* 系统(System)
* 库(Library)

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-editor.jpg)

[初学指南](https://www.soft8soft.com/docs/manual/en/introduction/Beginner-Guide.html) 中介绍了Puzzles编辑器的基本操作。

＃

### 初始化(Initialization)

这些拼图位于**init**选项卡下，并在初始化Verge3D应用程序之前进行解释。

＃

**“配置应用程序”("configure application")**

允许设置应用程序初始化参数，包括一些WebGL上下文创建参数。

* “压缩资产”("compressed assets")- 使应用程序加&#x8F7D;**.xz**格式的压缩场景而不是常&#x89C4;**.gltf**文件（有关详细信息，请参阅资产压缩部分）
* “默认全屏按钮” ("default fullscreen button")- 使默认全屏按钮显示在右上角
* “透明背景”("transparent background") - 使背景透明，以便通过WebGL画布显示网页的底层部分
* “启用屏幕截图”("enable screenshots") - 将WebGL上下文的**preserveDrawingBuffer**属性设置为true，从而可以从WebGL画布正确捕获屏幕截图
* “淡化注释” ("fade annotations")- 当注释被场景对象阻挡时，注释会消失

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-init-configure-app.jpg)

＃

**“设置预加载器”+“百分比”("setup preloader" + "percentage")**

删除默认预加载器并公开事件回调以允许处理预加载器进度事件。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-init-setup-preloader.jpg)

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-init-setup-preloader-example.jpg)

＃

### 事件(Events)

此类别的拼图处理用户生成的事件：鼠标点击/触摸，悬停和拖动。

＃

**“点击时”(**"**when clicked")**

等待用户点击指定的3D对象（或在列表或组里的任何物体，或在启用“all objects”拼图时场景里的所有物体） – 然后在“do”插槽中运行拼图，或者如果用户点击其他内容则在“miss：do”插槽中运行拼图。

![](/files/-MMT-89Z1ip-gEHGKvrp)

＃

**“选择的物体”("picked object")**

返回用户单击的对象。与“点击时”("when clicked")拼图一起使用。

![](/files/-MMT-CWyrLh23TVOrzPo)

＃

**“悬停时”(“when hovered”)**

等待用户将鼠标悬停在指定的3D对象上（或在列表或组里的任何物体，或在启用“all objects”拼图时场景里的所有物体） – 然后在“over / out：do”插槽中运行拼图。

![](/files/-MMT-JwxTJbHta9kK9ra)

＃

**“悬停的物体”("hovered object")**

返回用户悬停的对象。与“悬停时” (“when hovered”)拼图一起使用。

![](/files/-MMT0SfjAHQ6KJNdEg7x)

＃

**“移动时”(**"when moved"**)**

跟跟踪指定对象 （或在列表或组里的任何物体，或在启用“all objects”拼图时场景里的所有物体） 的任何移动（位置，旋转和缩放）。如果对象开始移动，则在“start：do”插槽中运行拼图，在“while moving：do”插槽中继续运行拼图，直到对象停止移动，然后在“stop：do”插槽中运行拼图。“delta”参数表示触发此拼图所需的位置，旋转或比例的任何坐标（x，y或z）的绝对变化。“period”参数表示在再次检查移动之前拼图等待的渲染帧数。

![](/files/-MMT0XdYFbU6sXp8Ixo7)

**“被拖动时”("when dragged")**

等待用户使用鼠标拖动指定的3D对象 （或在列表或组里的任何物体，或在启用“all objects”拼图时场景里的所有物体） – 然后生成移动数据，以便在“拖动”(”drag move”)，“拖动旋转”(”drag rotate”)和“拖曳比例”(”drag scale”)拼图中使用。还可以捕获开始和结束拖动的事件。

![](/files/-MMT0atmLjaSHR5xipjR)

**“拖拽移动”(”drag move”)**

根据“被拖动时”("when dragged")拼图生成的拖动移动数据，移动指定的3D对象（或在列表或组里的任何物体，或在启用“所有物体”(“all objects”拼图时场景里的所有物体） 。使用下拉菜单限制移动到特定轴或平面，或根本不限制。

![](/files/-MMT0kDEgnFaeiWj1q5E)

＃

**“拖拽旋转”(“drag rotate”)**

根据”when dragged over”拼图生成的拖动移动数据旋转指定的3D对象（或指定列表或组中的所有对象，或者如果使用所有对象拼图，则为场景上的所有对象）。使用下拉菜单将旋转限制为特定轴。 “space” 下拉允许在”local” 和”parent” 坐标空间之间切换。

![](/files/-MMT0phwaDH8FpDx-QBf)

＃

**“拖拽缩放”("drag scale")**

根据”when dragged over”拼图生成的拖动移动数据缩放指定的3D对象（或指定列表或组中的所有对象，或者如果使用所有对象拼图，则为场景上的所有对象）。使用下拉菜单限制缩放到特定轴。

![](/files/-MMT0xSlXjgfDJq7eIDk)

＃

### 选择（Selectors）

此类别的拼图用于选择3D对象，组，动画片段和材质以适应其他拼图。

＃

**“选择对象”(“select object”)**

下拉列表包含场景中所有对象的按字母顺序排列的列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-object.jpg)

＃

**“所有对象”(“all objects”)**&#x20;

表示场景中的所有对象，以便可以批量应用操作。不可迭代。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-all-objects.jpg)

＃

**“选择组”**

下拉列表包含场景中显示的所有对象组的按字母顺序排列的列表。操作可以批量应用于一组对象。不可迭代。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-group.jpg)

＃

**“选择动画”**

下拉列表包含场景中显示的所有动画片段的按字母顺序排列的列表。根据在3ds Max或Blender中应用动画的对象命名动画剪辑。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-animation.jpg)

＃

**“选择材质”**

下拉列表包含场景中存在的所有材质的按字母顺序排列的列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-material.jpg)

＃

### 对象

此类别的拼图使用对象执行各种操作。

＃

**“节目”**

使最初或以前隐藏的指定对象可见。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-show.jpg)

＃

**“隐藏”**

使指定的对象不可见。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-hide.jpg)

＃

**“是可见的”**

检查对象（或列表中的任何对象）当前是否可见。如果是这样，则返回true，否则返回false。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-is-visible.jpg)

＃

**“克隆”**

制作对象副本，为新对象生成唯一名称并立即将其添加到场景中。输出新对象。不适用于列表，组或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-clone.jpg)

＃

**“对齐对象”**

通过复制其变换数据将对象移动到另一个对象的位置。还复制旋转和缩放。不适用于列表，组或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-snap.jpg)

＃

**“集变换”**

根据指定的变换数据移动，旋转或缩放对象。“偏移”复选框允许相对于原始位置/旋转/比例移动/旋转/缩放对象。任何轴输入都可以留空。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-set-transform.jpg)

＃

**“变换”**

检索对象的位置，旋转或缩放数据。不适用于列表，组或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-transform.jpg)

＃

**“改变局部转型”**

根据其本地空间中的指定变换数据移动，旋转或缩放对象。任何轴输入都可以留空。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-change-local-transform.jpg)

＃

**“添加注释”**

将2D标记添加到用户可以展开的对象，方法是单击该标记以查看对象描述。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-add-annotation.jpg)

＃

**“删除注释”**

从对象中删除以前添加的注释。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-remove-annotation.jpg)

＃

**“更新文本对象”**

根据指定的文本内容为文本对象生成新网格。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-update-text.jpg)

＃

**“父”**

在对象之间创建父关系，以便第一个对象跟随第二个对象的位置/旋转/缩放。不适用于列表，组或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-parent.jpg)

＃

**“距离”**

输出两个指定对象之间的距离。不适用于列表，组或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-distance.jpg)

＃

**“大纲”**

对指定对象应用或删除轮廓效果。要解锁此拼图，请在3ds Max或Blender中启用轮廓效果。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-outline.jpg)

＃

### 物料

＃

**“分配材质”**

将材质指定给对象，完全替换旧材质。也适用于对象列表，组（或组列表）或所有对象拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials-assign-material.jpg)

＃

**“替换纹理”**

使用从提供的URI加载的纹理替换为指定材质找到的纹理。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials-replace-texture.jpg)

＃

**“设置颜色”**

设置为指定材质找到的颜色参数的R，G和B分量。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials-set-color.jpg)

**对于3ds Max用户：**&#x60A8;可以在材质（标准或物理）中添加**控制器**，其名称将显示在下拉菜单中。此外，还可以访问标准或物理材质节点的漫反射（或“基础”）颜色输入。对于**符合glTF标准的PBR材质**，**基本颜色**和**发射**输入只能通过此拼图访问。

**对于Blender用户：**&#x60A8;可以在基于节点的材质（GLSL Internal，Cycles，Eevee）中添加**RGB**节点，它们的名称将显示在下拉菜单中。此外，还可以访问材质，扩展材质，BSDF Principled，BSDF Diffuse和BSDF Glossy节点的漫反射（或“基础”）颜色输入。对于**符合glTF标准的PBR材质**，**BaseColor**和**Emissive**输入只能通过此拼图访问。

此拼图还可用于修改环境着色器。在下拉列表中，环境着色器的名称以“Verge3D\_Environment”开头。

有关Verge3D用户可用材质的更多信息，请参阅本手册的材质系统概述章节：[3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Material-System-Max.html)，[Blender](https://www.soft8soft.com/docs/manual/en/introduction/Material-System-Blender.html)。

＃

**“设定值”**

设置为指定材质找到的值参数。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials-set-value.jpg)

**对于3ds Max用户：**&#x60A8;可以在材质（标准或物理）中添加**控制器**，其名称将显示在下拉菜单中。在**符合glTF标准的PBR材质**的情况下，可以通过以下难题访问以下输入：金属度，粗糙度，凹凸比例，发射强度和环境图强度。

**对于Blender用户：**&#x60A8;可以在基于节点的材质（GLSL Internal，Cycles，Eevee）中添加**Value**节点，它们的名称将显示在下拉菜单中。在**符合glTF标准的PBR材质**的情况下，可以通过以下难题访问以下输入：金属度（PBR节点中的MetallicFactor），粗糙度（PBR节点中的RoughnessFactor），bumpScale（PBR节点中的NormalScale），emissiveIntesity（PBR节点中的EmissiveFactor）和envMapIntensity （未在PBR节点中显示）。

此拼图还可用于修改环境着色器。在下拉列表中，环境着色器的名称以“Verge3D\_Environment”开头。

有关Verge3D用户可用材质的更多信息，请参阅本手册的材质系统概述章节：[3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Material-System-Max.html)，[Blender](https://www.soft8soft.com/docs/manual/en/introduction/Material-System-Blender.html)。

＃

**“获取材质”**

检索分配给对象的材质的名称。如果为同一对象分配了多个材质，则返回第一个。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-material.jpg)

＃

### 动画

此类别的拼图使用动画片段执行操作。

＃

**“播放动画”**

播放动画片段。动画剪辑名称对应于在3ds Max或Blender中为其指定动画的对象（每个对象只能分配一个动画片段）。使用动画选择器拼图为此拼图提供动画剪辑。

使用“from”和“to”字段指定帧范围。使用“速度”字段指定播放速度。“反转”复选框启用反向播放。下拉菜单可用于更改动画模式 - “auto”允许使用3ds Max或Blender中指定的动画模式，而其他模式则覆盖3ds Max或Blender中指定的设置。

动画结束后处理“完成时：完成”插槽中的拼图（这仅对“一次”动画模式有效）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-play.jpg)

此拼图也适用于动画片段列表。

＃

**“停止动画”**

停止播放动画片段。也适用于动画片段列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-stop.jpg)

＃

**“暂停动画”**

暂停动画片段播放，以便稍后从暂停的帧开始恢复。也适用于动画片段列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-pause.jpg)

＃

**“恢复动画”**

恢复以前暂停的动画片段。也适用于动画片段列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-resume.jpg)

＃

**“设置动画帧”**

将动画片段设置为指定的帧。也适用于动画片段列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-set-animation-frame.jpg)

＃

**“是动画片”**

检查当前是否正在播放动画片段（或列表中的任何动画）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-is-playing.jpg)

＃

**“搞动画”**

检索指定对象的动画片段。也适用于对象列表，组（或组列表）或所有对象拼图。返回值始终是动画片段列表（即使只有一个动画片段）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-get-animation.jpg)

＃

### 相机

此类别的拼图使用相机执行操作。

＃

**“看着”**

平滑地为活动相机设置动画，使其最终以指定对象为目标。numeric参数指定执行动画的时间段（以秒为单位）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-lookat.jpg)

＃

**“补间相机”**

平滑地为活动相机设置动画，使其位置最终更改为指定对象的位置，并且相机将指向另一个指定对象。numeric参数指定执行动画的时间段（以秒为单位）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-tween-camera.jpg)

＃

**“设置有源相机”**

使指定的相机处于活动状态。这可用于更改摄像机控制模式（“轨道”与“飞行”与“无控制”），视野和其他设置。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-set-active.jpg)

＃

### 场景

此类别的拼图通过场景执行加载/卸载操作。

＃

**“加载场景”+“百分比”**

触发此拼图时，将卸载当前场景并从指定的.gltf文件加载新场景。加载完成后，触发“加载时”插槽中的拼图。还可以启用“on progress do”插槽。放置在此插槽中的拼图在装载期间不断触发，并可利用“百分比”拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-load-scene.jpg)

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-load-scene-example.jpg)

＃

**“追加场景”+“百分比”**

触发此拼图时，将从指定的.gltf文件加载新场景并将其附加到当前场景。加载完成后，触发“加载时”插槽中的拼图。还可以启用“on progress do”插槽。放置在此插槽中的拼图在装载期间不断触发，并可利用“百分比”拼图。默认情况下，“追加场景”拼图不会从新场景加载相机和灯光。可以在拼图选项中更改此行为。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-append-scene.jpg)

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-append-scene-example.jpg)

＃

**“卸载场景”**

从应用程序卸载指定的场景或其部分。使用空文本值以卸载所有场景。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-unload-scene.jpg)

＃

### 杂项

杂项拼图在高层次上执行各种操作。

＃

**“打开网页”**

触发此拼图时，将根据下拉选项在新的或相同的浏览器选项卡中打开指定的URL。当从Puzzles编辑器触发时，它会在离开选项卡之前要求用户确认。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-open-web-page.jpg)

＃

**“社交分享链接”**

生成用于在流行社交媒体中共享应用程序的链接。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-social-share-link.jpg)

＃

**“替换场景”**

这个拼图已被弃用。请改用加载场景。

触发此拼图时，将卸载当前场景并从指定&#x7684;**.gltf**文件加载新场景。加载完成后，触发“加载时”插槽中的拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-replace-scene.jpg)

＃

**“调用JS函数”**

执行应用程序的JavaScript代码中指定的函数。可选择传递要用作函数参数的参数。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-call-js-function.jpg)

为了将函数添加到JavaScript代码，打开应用程序**的.js**文件（例如，my\_awesome\_app.js位于verge3d /应用/ my\_awesome\_app）用任何文本编辑器。搜索“prepareExternalInterface”并在该声明中添加您的函数（在大括号之间），使它看起来像这样：`function prepareExternalInterface(app) { app.ExternalInterface.myJSFunction = function(numericArg, textArg) { alert('Got some params from Puzzles: ' + numericArg + ' and ' + textArg); } }`

＃

**“当从JS调用时”**

允许从应用程序的JavaScript代码触发Puzzles。（可选）检索从JavaScript代码传递的参数，并将它们保存为变量以供“do”插槽中的拼图使用。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-when-called-from-js.jpg)

为了从JavaScript代码触发这个难题，打开应用程序**的.js**文件（例如，my\_awesome\_app.js位于verge3d /应用/ my\_awesome\_app）用任何文本编辑器。搜索“runCode”并在该声明中添加一个函数调用（在大括号之间），这样它看起来像这样：`function runCode(app) { app.ExternalInterface.myJSCallback('Hello, Puzzles!', 80); }`

＃

**“加载数据”**

尝试从指定位置加载数据。无论尝试是否成功，都会解释“曾经准备就绪”插槽中的难题。可以通过加载的数据拼图访问检索到的数据。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-load-data.jpg)

＃

**“发送数据”**

尝试使用异步[POST HTTP](https://en.wikipedia.org/wiki/POST_\(HTTP\))请求将指定数据发送到远程位置。无论尝试是否成功，都会解释“曾经准备就绪”插槽中的难题。如果有任何响应数据，可以通过加载的数据拼图访问它。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-send-data.jpg)

＃

**“加载数据”**

返回由加载数据检索的数据或发送数据拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-loaded-data.jpg)

＃

**“读JSON”**

将文本解释为[JavaScript Object Notation](https://en.wikipedia.org/wiki/JSON#Example)数据。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-read-JSON.jpg)

＃

**“读取CSV”**

将文本解释为[逗号分隔值](https://en.wikipedia.org/wiki/Comma-separated_values#Example)。返回表行列表，每行表示为值列表。可以使用下拉列表选择分隔符以对应CSV文件的导出设置。“从行”值表示从顶部开始将跳过多少行。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-read-CSV.jpg)

表行和值由它们的数字索引从0开始访问。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-csv-example.jpg)

＃

**“拯救国家”**

保存指定对象的状态和/或由其名称指定的变量值。克隆对象并将其存储在内存中。检索变量的值并将其存储在每个指定变量名的内存中。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-save-state.jpg)

如果多次调用此拼图，则按顺序保存状态，以便可以使用撤消状态拼图返回任何先前的状态。

＃

**“撤消状态”**

恢复使用保存状态拼图保存的对象和/或变量的状态。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-undo-state.jpg)

如果多次调用此拼图，则从保存的序列（如果有）恢复状态，这使得可以从堆栈返回任何先前保存的状态。

＃

**“所有变量名称”**

返回一个列表，其中包含Puzzles中使用的所有变量的名称。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-all-variable-names.jpg)

＃

**“按名称变量值”**

返回由其名称指定的变量的值。此拼图与标准变量值拼图的工作方式类似，但不需要从预定义的下拉菜单中选择变量。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-variable-value-by-name.jpg)

＃

**“下订单”**

使用“标题”，“内容”和“总价格”字段以及可选的屏幕截图组成隐藏的订单表单，并根据Wordpress插件部分中说明的规范将此表单提交到指定的URL。默认情况下，订单表单将提交给[演示订购页面](https://www.soft8soft.com/order-form-demo)。

Verge3D附带一个免费的Wordpress插件，可以处理这个拼图提交的请求。收到这样的请求后，这个Wordpress插件呈现一个页面，其中包含扩展形式，并附有联系和注释字段，嵌入式屏幕截图和验证码。最终填写的表单由客户提交，并在Wordpress管理界面中创建新订单。客户和销售经理都通过电子邮件通知订单。

有关设置信息，请参阅本手册的Wordpress插件部分。

请务必在配置应用程序拼图中启用屏幕截图，否则屏幕截图可能会以黑色呈现。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-place-order.jpg)

＃

**“功能可用”**

检查用户浏览器中是否提供从下拉列表中选择的功能。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-feature-available.jpg)

＃

### 时间

这些拼图产生基于时间的事件。

＃

**“后”**

等待指定的时间，然后触发放置在“do”插槽内的拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-after.jpg)

＃

**“每”**

等待指定的时间，然后触发放置在“do”插槽内的拼图。然后重复。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-every.jpg)

＃

**“每一帧”**

触发每个渲染帧放置在“do”插槽内的拼图（通常以每秒60帧的速率）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-every-frame.jpg)

＃

**“过去”**

输出从前一个渲染帧传递的时间量（以秒为单位）。可以与“每帧”拼图一起使用来实现与帧无关的动画。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-elapsed.jpg)

＃

### HTML

这些拼图操纵HTML DOM元素。

＃

**“添加HTML元素”**

创建具有指定[类型](https://www.w3schools.com/tags/default.asp)和标识符（对应于“id”属性）的HTML元素，并将其附加到文档正文。还将其样式属性“position”设置为“absolute”。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-add-html-elem.jpg)

＃

**“获取属性”**

从具有指定标识的HTML元素中 获取[属性](https://www.w3schools.com/tags/ref_attributes.asp)。如果HTML元素位于外部HTML文档（使用**iframe**嵌入Verge3D应用程序&#x7684;**.html**文件）中，则应启用“在父文档中”复选框。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-get-attr.jpg)

＃

**“设置属性”**

为具有指定标识的HTML元素 设置[属性](https://www.w3schools.com/tags/ref_attributes.asp)。如果HTML元素位于外部HTML文档（使用**iframe**嵌入Verge3D应用程序&#x7684;**.html**文件）中，则应启用“在父文档中”复选框。也适用于元素ID列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-set-attr.jpg)

＃

**“设定风格”**

为具有指定标识的HTML元素 设置[CSS属性](https://www.w3schools.com/cssref/default.asp)。如果HTML元素位于外部HTML文档（使用**iframe**嵌入Verge3D应用程序&#x7684;**.html**文件）中，则应启用“在父文档中”复选框。也适用于元素ID列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-set-style.jpg)

＃

**“设置CSS规则”**

为指定的CSS规则（在应用程序&#x7684;**.css**文件中找到） 设置[CSS属性](https://www.w3schools.com/cssref/default.asp)。如果样式表属于外部HTML文档（使用**iframe**嵌入Verge3D应用程序&#x7684;**.html**文件），则应启用“在父文档中”复选框。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-set-css-rule.jpg)

＃

**“事件”**

为具有指定标识的HTML元素 注册[事件侦听](https://www.w3schools.com/jsref/dom_obj_event.asp)器。如果HTML元素位于外部HTML文档（使用**iframe**嵌入Verge3D应用程序&#x7684;**.html**文件）中，则应启用“在父文档中”复选框。一旦发生事件，触发放置在“do”槽中的拼图。也适用于元素ID列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-on-event.jpg)

＃

**“获取事件属性”**

输出由“事件”拼图生成的事件的[属性](https://www.w3schools.com/jsref/obj_events.asp)值。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-get-event-property.jpg)

＃

**“文献”**

表示[DOM文档对象](https://www.w3schools.com/jsref/dom_obj_document.asp) - HTML文档的根节点。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-document.jpg)

＃

**“身体”**

表示[DOM正文对象](https://www.w3schools.com/jsref/dom_obj_body.asp) - HTML文档的\<body>元素。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-body.jpg)

＃

**“画线”**

通过动态更新的线将指定的3D对象与指定的HTML元素连接起来。如果HTML元素位于外部HTML文档（使用**iframe**嵌入Verge3D应用程序&#x7684;**.html**文件）中，则应启用“在父文档中”复选框。您还可以设置线条的宽度，颜色和偏移量。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-draw-line.jpg)

＃

**“删除线”**

从指定对象中删除以前创建的行。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-remove-line.jpg)

＃

**“绑定元素”**

使指定的HTML元素跟随屏幕空间中指定3D对象的中心。如果HTML元素位于外部HTML文档（使用**iframe**嵌入Verge3D应用程序&#x7684;**.html**文件）中，则应启用“在父文档中”复选框。一个更加可自定义的“添加注释”拼图的变体。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-bind-element.jpg)

＃

**“初始化全屏”**

使指定的HTML元素表现为全屏模式按钮 - 首次单击它会触发进入全屏模式，第二次单击会退出全屏模式。进入或退出全屏模式时会触发放置在“on enter do”和“on do do”插槽中的拼图。如果浏览器不支持全屏（例如iOS Safari），则会触发放置在“if unavailable do”中的拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-init-fullscreen.jpg)

＃

**“截图”**

获取视口的屏幕截图并以[数据URI](https://en.wikipedia.org/wiki/Data_URI_scheme#Examples_of_use)格式输出。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-take-screenshot.jpg)

＃

### AR / VR

这些拼图用于实现基于Web的增强现实（AR）和虚拟现实（VR）体验，这些体验运行在开发中的浏览器技术之上，称为[WebXR](https://github.com/immersive-web/webxr/blob/master/explainer.md)（Web上的eXtended Reality）。

这些拼图被认为是实验性的，因为WebXR正在快速发展，浏览器预览版本每天都在变化。目前AR拼图被禁用，直到规格稳定。为了使用VR拼图，我们建议在创建[新项目](https://www.soft8soft.com/docs/manual/en/introduction/Workflow.html#Project)时打开**Legacy VR**复选框。

＃

**“初始VR模式”**

初始化虚拟现实系统。如果成功，将触发“if available do”中的拼图。否则，如果浏览器不支持VR或VR硬件未找到，则触发“if unavailable do”插槽中的拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-ar-vr-init-vr-mode.jpg)

有关支持的VR设备和最佳实践的更多信息，请参阅“ [用户手册”](https://www.soft8soft.com/docs/manual/en/introduction/AR-VR-development.html)。

＃

**“进入VR模式”**

进入虚拟现实模式。进入或退出VR模式时会触发放置在“on enter do”和“on do do”插槽中的拼图。如果无法建立VR会话，则会触发放置在“if unavailable do”中的拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-ar-vr-enter-vr-mode.jpg)

＃

### 声音

这些拼图用于加载和播放HTML5声音。

＃

**“加载声音”**

创建[HTML5音频](https://www.w3schools.com/html/html5_audio.asp)元素并使用指定的URL加载声音文件。此拼图还将创建的音频元素添加到内存缓存中，以便具有相同URL的此拼图的任何后续使用不会再次加载相同的声音文件。建议使&#x7528;**.mp3**格式，因为大多数Web浏览器都支持。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-sound-load-sound.jpg)

＃

**“播放声音”**

开始播放音频。如果启用，循环复选框将重复声音播放。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-sound-play-sound.jpg)

＃

**“暂停声音”**

暂停音频播放。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-sound-pause-sound.jpg)

＃

**“倒带声”**

设置音频元素以从头开始播放声音。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-sound-rewind-sound.jpg)

＃

**“设定音量”**

设定音量。输入音量被钳制到0.0-1.0范围。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-sound-set-volume.jpg)

＃

**“正在玩”**

检查当前是否正在播放声音。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-sound-is-playing.jpg)

＃

### 约束

这些拼图用于约束物体运动。如果对象不是另一个对象的父级，则约束将在世界空间中起作用。否则它们将在父对象的空间中工作 - 您可以在3ds Max或Blender中选择父对象以显示坐标轴。

＃

**“极限变换”**

设置约束以限制沿选定轴的对象位置，旋转或缩放。指定的id应该是唯一的，否则将替换具有相同的现有约束。“min”和“max”槽指定允许移动之间的范围。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-constraints-limit-transform.jpg)

＃

**“复制变换”**

设置约束以从另一个对象复制对象位置，旋转或缩放。指定的id应该是唯一的，否则将替换具有相同的现有约束。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-constraints-copy-transform.jpg)

＃

**“操作”**

使用分配给指定对象的指定id删除，静音或取消静音约束。分配给此对象的其他约束（如果有）将保持不变。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-constraints-operations.jpg)

＃

### 后期处理

这些拼图用于设置各种后处理效果。

＃

**“盛开”**

启用绽放效果。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-postprocessing-bloom.jpg)

＃

**“亮度/对比度”**

允许调整渲染的亮度和对比度。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-postprocessing-brightness-contrast.jpg)

＃

**“景深”**

启用景深（DOF）效果。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-postprocessing-dof.jpg)

＃

**“灰度”**

启用灰度效果。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-postprocessing-grayscale.jpg)

＃

**“环境光遮蔽”**

启用屏幕空间环境光遮挡（SSAO）效果。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-postprocessing-ssao.jpg)

＃

**“删除后处理效果”**

删除所有后处理效果。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-postprocessing-remove-postprocessing.jpg)

＃

### 变量

变量是可以更改（变化）的命名值。变量可以通过几种不同的方式创建：

* 您可以通过单击**Create variable ...**&#x6309;钮**创建变量，**&#x7136;后为其选择任何名称。名称，无论它出现在程序中的哪个位置，都可以随时通过变量的下拉菜单进行更改。
* 过程可以定义输入，这些输入创建只能在过程中使用的变量。这些传统上称为参数或参数。
* 每个“count with”和“for each”拼图都使用变量并定义其值。这些值只能在拼图中使用。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-variables-create.jpg)

变量的典型用例是当您有一个可以处于多个状态的对象时。例如，门可以打开或关闭，如果您想要正确地设置它，您需要知道它现在的状态。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-variables-example.jpg)

＃

**“组”**

这个拼图为变量赋值。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-variables-set.jpg)

＃

**“得到”**

此拼图提供存储在变量中的值，而不更改它。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-variables-get.jpg)

＃

**“更改”**

将存储在变量中的值增加指定的数字。如果初始值不是数字，或者未设置，则认为它是零，并且递增。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-variables-change.jpg)

＃

### 程序

过程（又称函数）是执行特定任务的一组命名的拼图。通过在程序中组织您的拼图，您可以使您的场景更紧凑和可维护。

通过从工具箱中拖出过程定义拼图，可以创建一个新过程：

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-create.jpg)

可以重新命名新创建的程序拼图并填充其他拼图以执行某项任务：

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-create2.jpg)

要能够触发（调用）过程，请从工具箱中拖出相应的拼图：

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-trigger.jpg)

可以从Puzzles场景的多个位置触发多次过程。这可以允许重复使用拼图而不是直接复制类似的拼图数次。例如，只要用户单击对象本身或HTML按钮（因此保护重复控件），就可以启动动画。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-trigger2.jpg)

过程可能具有其他输入参数（也称为参数）。要在程序中添加输入，请单击齿轮图标并从左侧的工具箱中拖出参数拼图，将其粘贴在输入拼图中：

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-inputs.jpg)

为了能够在过程中使用输入参数，请拖出在“变量”中自动创建的相应“get”变量拼图：

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-inputs2.jpg)

此变量可用作实际数据（如对象名称）的替代，以执行某些任务。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-inputs3.jpg)

使用输入触发过程时，为每个触发器拼图提供数据。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-trigger-with-inputs.jpg)

您可以使用右键单击菜单从触发器拼图跳转到相应的过程定义拼图：

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-jump.jpg)

＃

**“返回程序”**

过程可以将计算值输出到其调用者（也称为返回值）。要创建这样的过程，请从工具箱中拖出带有返回槽的过程拼图的变体。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-return.jpg)

＃

**“如果回归”**

在解释所有内部拼图之前，过程可以在某些条件下返回值。在这种情况下，程序会过早停止运行。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-procedures-if-return.jpg)

＃

### 调试

＃

**“打印到控制台”**

将任何类型的数据打印到浏览器控制台。后者通常可以使用F12键打开（Chrome，Firefox，Windows，Linux）。在Mac上，使用Chrome中的View> Developer> JavaScript Console菜单（Option-Cmd-J），或Safari中的Develop> Show Error Console菜单（Option-Cmd-C）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-debug-print-console.jpg)

＃

**“打印性能信息”**

在1秒内记录性能配置文件并将其打印到浏览器控制台。后者通常可以使用F12键打开（Chrome，Firefox，Windows，Linux）。在Mac上，使用Chrome中的View> Developer> JavaScript Console菜单（Option-Cmd-J），或Safari中的Develop> Show Error Console菜单（Option-Cmd-C）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-debug-print-performance-info.jpg)

＃

### 拼图库

库是一组持久存储，用于在多个项目中重复使用的拼图组。您可以通过右键单击拼图组并选择“ **将N拼图保存到库** ”选项，**将拼图组添加到库中**。在模态窗口中键入组的名称，因为它将出现在库的条目列表中（通过重新加载Puzzle编辑器来刷新它）。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-library-save.jpg)

通过将其拖出到工作区，可以从库中检索已保存的拼图组。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-library-retrieve.jpg)

单击**删除此项**按钮可以从库中**删除**条目（通过重新加载Puzzle编辑器刷新条目列表）。


# 功能特性

Verge3D工具包功能特性列表

编译中 - m\@funjoy

| 功能                 | 特性描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 创建内容               | <p>Verge3D资产可通过以下工具创建：</p><ul><li>Autodesk 3ds Max 2017-2020版本，安装Verge3D for 3ds Max插件。</li><li>Blender 2.79 及 2.80版，安装Verge3D for Blender插件</li><li>任何支持导出glTF2.0格式数据的三维建模工具。</li></ul><p>导出的文件亦可压缩为LZMA / XZ格式。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 材质系统               | <p></p><p>Verge3D for 3ds Max支持的材质：</p><ul><li><a href="/pages/-LZI6ZxC_FHWZ1Ui8huh#wu-li-cai-zhi-physical-materials">物理材质</a> ，参考ART渲染器支持列表。</li><li><a href="/pages/-LZI6ZxC_FHWZ1Ui8huh#biao-zhun-cai-liao-standard-materials">标准材质</a> ，参考扫描线渲染器支持里诶博鳌</li><li><a href="/pages/-LZI6ZxC_FHWZ1Ui8huh#gltf-jian-rong-cai-liao-gltfcompliant-materials">glTF兼容物理材质</a>。</li></ul><p>Verge3D for Blender支持的材质：</p><ul><li><a href="/pages/-LZI9cGF7gqvbZocDqke#eevee-materials">Eevee</a> （仅限Blender 2.8）。</li><li><a href="/pages/-LZI9cGF7gqvbZocDqke#zhou-qi-cai-liao">Cycles</a> （Blender2.7与2.8均可）。</li><li><a href="/pages/-LZI9cGF7gqvbZocDqke#fu-he-gltf-biao-zhun-de-pbr-cai-liao">glTF-compliant PBR</a> 符合glTF标准的PBR材质（Blender2.7与2.8均可）。</li><li>标准内部材质（仅限Blender 2.7，已弃用）。</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Lights and Shadows | <p>Verge3D supports the following light types:</p><ul><li>Directional Light</li><li>Point Light</li><li>Spot Light</li><li>Image-based Light - emitted from LDR and HDR maps.</li><li>Procedural Light - emitted from customized environment material.</li><li>Hemisphere Light - Verge3D for Blender only.</li><li>Rectangular Area Light - can be created with JavaScript.</li></ul><p>Verge3D supports casting shadows from directional, point and spot light sources:</p><ul><li>Basic non-smoothed shadows</li><li>PCF shadows</li><li>Smoothed PCF shadows</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 灯光与阴影              | <p>Verge3D支持以下灯光类型：</p><ul><li>平行光</li><li>点光源</li><li>聚光灯</li><li>基于图像的光源——从LDR和HDR贴图发射</li><li>程序光——从自定义的环境贴图发射</li><li>半球光源——仅限Verge3D for Blender</li><li>矩形面光源-可用Javascript创建</li></ul><p>Verge3D支持从平行光、点光源和聚光灯投射阴影：</p><p>Verge3D supports casting shadows from directional, point and spot light sources:</p><ul><li>基本非平滑阴影</li><li>PCF阴影</li><li>平滑PCF阴影</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 应用管理               | <p></p><p>应用管理器（App Manager）是一个轻量化的管理工具：</p><ul><li>基于模板创建新应用</li><li>启动3d建模套件（Blender, 3ds Max）</li><li>编辑与运行拼图逻辑（Puzzles logic）</li><li>更新应用至Verge3D最新版</li><li>在Verge3D云服务（Verge3D Network）中发布应用</li><li>管理授权码</li><li>访问Verge3D文档及支持渠道</li></ul><p>应用管理器（App Manager）可以从Blender与3ds Max中直接打开。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 动画                 | <p>Verge3D支持以下类型的动画：</p><ul><li>基于骨骼驱动的动画</li><li>对象变换动画，包括位置，旋转和缩放。</li><li>材质参数动画。支持浮点和颜色参数。</li><li>目标融合动画（Morph target animation），又称之形状帧动画（仅限于Verge3D for Blender）</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 可视化编程              | <p><a href="/pages/-LZFpzndQocj5_TNfQAH">Verge3D拼图系统（Verge3D Puzzles）</a>是一种可视化逻辑环境，允许以拖放方式快速创建交互式场景，拥有以下模块：</p><ul><li>处理用户事件，例如鼠标点击/触摸，悬停和拖动；</li><li>检索场景对象，动画，组和材质；</li><li>移动/旋转/缩放3D对象，获得对象之间的距离；</li><li>显示/隐藏对象；</li><li>更改对象的层次结构；</li><li>将2D文本注释（billboards）添加到场景中；</li><li>改变材质参数，加载纹理；</li><li>控制动画；</li><li>移动，旋转相机；</li><li>设置有源摄像头；</li><li>动态加载资产；</li><li>通过网络以JSON / CSV /文本格式上传/下载数据；</li><li>加载用户图像；</li><li>实现撤消/重做功能；</li><li>填写和发送客户订单；</li><li>检测用户功能，如浏览器，操作系统等；</li><li>与用JavaScript编写的逻辑事件交互；</li><li>执行基于计时器的事件；</li><li>初始化虚拟现实会话环境；</li><li>管理已加载页面的HTML / CSS布局；</li><li>播放声音；</li><li>模拟物理环境；</li><li>启用后期特效处理；</li><li>管理应用程序逻辑和数据；</li><li>执行数学运算；</li><li>……</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 编程                 | <p>可以<a href="/pages/-LZFxlcoXx8xJVZ5VfaL">使用JavaScript修改</a>应用程序源文件或通过在Puzzles中集成代码来添加应用程序功能。</p><p>Verge3D基于开源库Three.js，并通过<strong>v3d</strong>或<strong>THREE</strong>命名空间公开其API。因此，Verge3D中可以复用任何现有的Three.js代码。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 发布                 | <p>您可以通过以下方式发布您的创作内容：</p><ul><li>自有服务器；</li><li>任意网络托管服务（亚马逊AWS、阿里云、腾讯云等）；</li><li> Verge3D云服务（Verge3D ）；</li><li>Facebook（使用<a href="/pages/-LEwqRKB6b1Luk1nbAY9">3D主题</a>功能）；</li><li>使用Electron或Cordova框架创建的独立桌面或移动应用程序。</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| UI and HTML Layout | <p>Interface layouts, created using external WYSIWYG editors, can be <a href="http://soft8soft.com/docs/manual/en/introduction/HTML-based-user-interfaces.html">linked with Puzzles</a> to trigger changes to a 3D scene being rendered in the browser and vice versa.</p><p>The following website builders are tested and known to work:</p><ul><li>Webflow</li><li>Google Web Designer</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| UI与HTML布局          | <p>使用外部所见既所得编辑器（WYSIWYG editor）创建的界面布局可以<a href="/pages/-LZFxZYvSI25cB_cW4h0">与Puzzles链接</a>，以触发对在浏览器中呈现的3D场景的更改，反之亦然。</p><p>以下网页设计工具已经过测试可用于Verge3D生产流程：</p><ul><li>Webflow</li><li>Google Web Designer</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 服务器端功能             | <p>Verge3D附带了一个<a href="/pages/-LZFxhchqYm2GZv5HrxW">WordPress插件</a>。WordPress是目前最流行的内容管理系统（CMS）。该插件包括以下功能：</p><ul><li>应用程序托管和发布（嵌入）</li><li>长期文件存储</li><li>完全可定制的电子商务系统，用于处理客户订单</li></ul><p>除此之外，Puzzles可视化逻辑编辑器还支持通过网络以JSON，CSV或纯文本格式发送/检索数据的模块。</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 后期特效               | <p>拼图编辑器中可以启用以下特效：</p><ul><li>环境光遮蔽</li><li>泛光效果（Bloom）</li><li>亮度/对比度</li><li>景深</li><li>灰度</li></ul><p>除此之外，可用JavaScript启用以下效果：</p><ul><li>自适应色调映射</li><li>云隙光（也称为神光或圣光效果）</li><li>增强的亚像素形态抗锯齿（SMAA）</li><li>毛刺</li><li>图像交叉淡化</li><li>图像遮罩/掩蔽（Image Mask）</li><li>运动模糊</li><li>像素化图像</li><li>索贝尔过滤器（Pixelated Imagery）</li><li>超级采样抗锯齿（SSAA）</li><li>时间性抗锯齿（TAA）</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 虚拟现实               | [支持WebXR和WebVR](/general-topics/ar-vr-development)（通过兼容性支持模块）。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| 着色器                | 可以使用OpenGL ES着色语言2.0（WebGL 1.0）或3.0（WebGL 2.0）添加自定义着色器（Shaders）。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Physics            | The physics module enables for collision detection, dynamically moving objects, support for characters and vehicles, springs, ropes and cloth simulation. As of version 2.11, physics simulations can be created and controlled without coding via Puzzles.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Audio              | Background music and/or event sounds can be added with Sound Puzzles to be triggered by the user.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Demos and Examples | <p>Over 150 coding examples and a series of fully-featured 3D apps including:</p><ul><li>City - large urban environment with first-person controls and ground detection.</li><li>Custom Image - a virtual picture frame which allows uploading, storing and sharing your images.</li><li>Farmer's Journey - arcade browser game made without coding.</li><li>Industrial Robot VR - interactive robot simulator with VR capabilities.</li><li>Recliner - 3D configruator and ready-to-use e-commerce website.</li><li>Ring - simple 3D jewelry customizer with online ordering capabilities.</li><li>Scooter - advanced 3D configurator with realistic PBR materials and millions possible combinations.</li><li>Teapot Heater - non-trivial interactive 3D animation made with Puzzles.</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Import Formats     | <p>In addition to glTF 2.0 you can import the following formats.</p><p>Geometry/Materials:</p><ul><li>3DS - older Autodesk 3ds Max file format</li><li>3MF - 3D manufacturing format</li><li>AMF - Additive manufacturing file format</li><li>AWD - used in Away3D engine</li><li>babylon - used in Babylon.js engine</li><li>COLLADA</li><li>CTM - OpenCTM format</li><li>FBX</li><li>glTF 1.0 - legacy format, use glTF 2.0 instead</li><li>KMZ - Keyhole Markup Language</li><li>OBJ/MTL</li><li>PCD - 3D point cloud data format</li><li>PDB - Protein Data Bank format</li><li>PlayCanvas - JSON-based data format used in PlayCanvas engine</li><li>PLY - Polygon File Format, designed to store three-dimensional data from 3D scanners</li><li>PRWM - Packed Raw WebGL Model</li><li>STL - stereolithography data format, takes its origin from the CAD software by 3D Systems</li><li>SEA3D - an open-source format for game development</li><li>VRML - Virtual Reality Modeling Language</li><li>VRM - glTF-based 3D avatar format</li><li>VTK - Visualization Toolkit format</li><li>X - DirectX file format</li></ul><p>Animation:</p><ul><li>BVH - Biovision Hierarchy character animation file format</li><li>MD2 - used in Quake II engine</li><li>MMD - MikuMikuDance format</li></ul><p>Images:</p><ul><li>DDS - texture compression format</li><li>EXR - OpenEXR, high dynamic range raster file format</li><li>PVR - texture compression format</li><li>HDR - RGBE or Radiance HDR</li><li>KTX - texture format by Khronos</li><li>NRRD - "nearly raw raster data" format</li><li>SVG</li><li>TGA - Truevision TGA raster graphics format</li><li>TTF</li></ul> |
| Export Formats     | <p>In addition to glTF 2.0 you can export to the following formats:</p><ul><li>COLLADA</li><li>MMD</li><li>OBJ</li><li>PLY</li><li>STL</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Camera Controls    | <p>These camera control modes are available out-of-the-box:</p><ul><li>Orbit Controls - targeted 3D view</li><li>Flying Controls - free-flight view</li><li>First-Person Controls</li><li>Virtual Reality Controls</li></ul><p>These camera control modes can be enabled with JavaScript:</p><ul><li>Flyover Controls</li><li>Pointerlock Controls</li><li>Device Orientation Controls - implements gyroscope-driven view</li><li>Map Controls - hovering camera</li><li>Trackball Controls</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 3D Primitives      | <p>You can load geometry exported from any modelling suite. In addition to that, the following 3D primitives can be created with JavaScript:</p><ul><li>Cone</li><li>Convex Hull</li><li>Cube (Box)</li><li>Cylinder</li><li>Dodecahedron - a polyhedron with twelve flat faces</li><li>Extruded Shape</li><li>Icosahedron - a polyhedron with 20 faces</li><li>NURBS</li><li>Octahedron - a polyhedron with eight faces</li><li>Plane</li><li>Ring</li><li>Sphere</li><li>Tetrahedron - a triangular pyramid</li><li>Polyhedron</li><li>Spline Curve</li><li>Text</li><li>Torus</li><li>Tube</li><li>Utah Teapot</li><li>Wireframe</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |


# 项目结构

Project Structure  ——fastest已校订

Pursuing a strong artist-friendly approach, Verge3D creates a complete set of files for a WebGL application. It is recommended not to edit most of the initialized project files, because some of them may be automatically regenerated upon certain user actions (such as export, saving Puzzles etc), while others may get overridden upon updating to new Verge3D versions.

Verge3D追求给予艺术家提供更加有效且友好的方式，为WebGL应用程序创建了一整套文件。建议不要编辑大多数初始化的项目文件，因为其中一些可能会在某些用户操作（例如导出，保存拼图等）时自动重新生成，而其他文件可能会在更新到新的Verge3D版本时被覆盖。

* 简单案例(Simplest Case)
* 高级案例(Advanced Case)

＃

### 简单案例(Simplest Case)

A default project initialized with the App Manager (with default configuration parameters) looks as follows.

使用App Manager初始化的默认项目（使用默认配置参数）如下所示。

![](https://www.soft8soft.com/docs/files/project-structure/project-structure-simple.jpg)

#### HTML，CSS和JavaScript文件(HTML, CSS and JavaScript files)

The application core consists of the **.html**, **.css** and **.js** files with the same name ("my\_awesome\_app"), and the Verge3D runtime **v3d.js**. There is also a folder called **media** which contains small images (fullscreen button icons and a set of favicons).

应用程序的核心由相同名称&#x7684;**.html**，**.css**&#x548C;**.js文件**（“my\_awesome\_app”）以及Verge3D运行时文件**v3d.js**组成。还有一个名为**media**的文件夹，其中包含一些小图片（全屏按钮图标和一组图标）。

Although not recommended, you can edit the core **.html**, **.css** and **.js** files, although a better approach for adding your own CSS and JavaScript would be creating new files and linking them to the main **.html**. Be sure to cherry-pick your changes back after performing [clean updating](https://www.soft8soft.com/docs/manual/en/introduction/Updating.html).

虽然不推荐，但您可以编辑核&#x5FC3;**.html**，**.css**&#x548C;**.js**文件，尽管添加自己的CSS和JavaScript的更好方法是创建新文件并将它们链接到&#x4E3B;**.html**。在执行[更新](https://www.soft8soft.com/docs/manual/en/introduction/Updating.html)后，请务必重新优化您的更改。

Please notice that if you attempt to launch a Verge3D application by simply clicking on the **.html** file, most likely it won't run due to the browser [security policy](https://en.wikipedia.org/wiki/Same-origin_policy) which forbids JavaScript from accessing files loaded not from the same domain. Please always use the App Manager, which includes a local web server, to run your apps.

请注意，如果您只是单&#x51FB;**.html**文件尝试启动Verge3D应用程序，则很可能由于浏览器[安全策略](https://en.wikipedia.org/wiki/Same-origin_policy)禁止JavaScript访问不是从同一域加载的文件而无法运行。请始终使用包含本地Web服务器的App Manager来运行您的应用程序。

#### glTF文件(glTF files)

When running, an application loads a 3D scene in **.gltf** format first, which in turn contains file paths for further loading of the binary part of a glTF scene **.bin** and external textures. The **.gltf** and **.bin** files are exported using user interface menu of your favorite 3D editor (3ds Max or Blender).

运行时，应用程序首先加&#x8F7D;**.gltf**格式的3D场景，然后包含文件路径，以进一步加载glTF场&#x666F;**.bin**和外部纹理的二进制部分。&#x8BE5;**.gltf**&#x548C;**.bin**文件使用您喜欢的3D编辑器（3ds Max或Blender）的用户界面菜单导出。

#### 工作场景文件(Working scene files)

Depending on the 3D editor you are using, there will be one **.max** or **.blend** file containing the default cube. This is where most work on your scenes is performed. Feel free to modify this file, rename or override it with some other file, but be certain to preserve the original name of the exported glTF file.

根据您使用的3D编辑器，将有一个包含默认立方体&#x7684;**.max**&#x6216;**.blend**文件。这是执行场景大部分工作的地方。您可以随意修改此文件，重命名或使用其他文件覆盖它，但一定要保留导出的glTF文件的原始名称。

You can add more **.max** or **.blend** files to the app folder, for using as library files or for multi-scene applications. If your app loads multiple glTF files, don't forget to perform export from the corresponding **.max** or **.blend** files.

您可以将更&#x591A;**.max**&#x6216;**.blend**文件添加到app文件夹，以用作库文件或用于多场景应用程序。如果您的应用加载了多个glTF文件，请不要忘记从相应&#x7684;**.max**&#x6216;**.blend**文件执行导出。

#### 资产(Assets)

Textures and sounds are typically loaded by an application as external files. Make sure that you use relative file paths in the 3D editor of your choice for all images, and that your images are stored inside your application folder, otherwise there may be issues with the publication of your app.

贴图和声音通常由应用程序作为外部文件加载。确保在所选图像的3D编辑器中使用相对文件路径，并将图像存储在应用程序文件夹中，否则应用程序发布时可能会出现问题。

#### 拼图(Puzzles)

When you click **Save** in the Puzzles editor, it will save your app puzzles in **visual\_logic.xml**. It will also generate JavaScript code from your puzzles and save it as **visual\_logic.js**. These files will keep being overridden every time you click the **Save**button, with the previous edition of the **visual\_logic.xml** copied to the **puzzles\_backup** folder, renamed with a time stamp. Therefore, you can always restore your puzzles from this backup by copying the **.xml** file to the root and renaming it back.

当您在拼图编辑器中单击“**保存“(“Save“)**&#x65F6;，拼图将保存在**visual\_logic.xml**中。它还将生成JavaScript代码并保存在**visual\_logic.js**中。每次单击“ **保存”**&#x6309;钮时，这些文件都将被覆盖，并将之前版本的**visual\_logic.xml**复制到**puzzles\_backup**文件夹，并使用时间戳重命名。因此，您始终可以通过&#x5C06;**.xml**文件复制到根目录并将其重命名来从此备份中恢复您的拼图。

### 高级案例(Advanced Case)

Some Verge3D apps (such as Soft8Soft's Industrial Robot demo) may contain quite a number of additional files, which however, come from just 2 extra categories.

一些Verge3D应用程序（例如Soft8Soft官方案例中的工业机器人演示）可能包含大量其他文件，这些文件主要分为两类。

**压缩的glTF文件(Compressed glTF files)**

If you enable [asset compression](https://www.soft8soft.com/docs/manual/en/introduction/Asset-compression.html) for your app (which is always a good thing), the exporter will at first perform export as usual and then create a compressed version of glTF files. These files are automatically picked up by the application instead of the regular glTF file. There is no point in deleting the regular glTF files even if they are not used at the time, since they may be generated again in some future export operation.

如果您为应用启用了[资产压缩](https://www.soft8soft.com/docs/manual/en/introduction/Asset-compression.html)（asset compression这总是一件好事），导出器将首先执行导出，然后创建glTF文件的压缩版本。这些文件由应用程序自动选取，而不是常规的glTF文件。删除常规glTF文件没有意义，即使它们当时没有被使用，因为它们可能会在将来的某些导出操作中再次生成。

#### 第三方软件导出(Third-party software exports)

Composite applications may leverage HTML layouts designed in some third-party software (such as Webflow or Google Web Designer), in which a regular Verge3D application is embedded with an **iframe** element. In such cases, the HTML layout can be saved to the app folder without any change to be picked up by the App Manager. Complex HTML layouts may in turn include additional CSS/JavaScript files, fonts or images, which are also needed to be stored in the app folder with their original hierarchy preserved.

整合应用程序可以利用某些第三方软件（例如Webflow或Google Web Designer）设计的HTML布局，其中常规Verge3D应用程序嵌入了**iframe**元素。在这种情况下，HTML布局可以保存到app文件夹，而不需要由App Manager选择任何更改。复杂的HTML布局可能反过来包括其他CSS / JavaScript文件，字体或图像，这些文件也需要存储在app文件夹中，并保留其原始层次结构。

![](https://www.soft8soft.com/docs/files/project-structure/project-structure.jpg)


# 更新版本

Updating for New Versions  ——fastest已校订

Verge3D is being actively developed with software releases occuring regularly. There is also the pre-release channel of updates with new versions coming out even more often. We recommend you to keep in pace with the development cycle and timely update your Verge3D distribution and applications.

Verge3D正在积极开发，定期发布软件版本。还有预发布的更新频道，新版本更频繁地推出。我们建议您跟上开发周期并及时更新Verge3D分发和应用程序。

* 更新Verge3D安装（Update Verge3D Installation）
* 更新应用程序 - 方法＃1（自动）（Update Applications - Method #1 (Automatic)）
* 更新应用程序 - 方法＃2（纯净）（Update Applications - Method #2 (Clean)）
* 更新后（After Update）
* 已知问题和故障排除（Known Issues and Troubleshooting）

＃

### 更新Verge3D安装（Update Verge3D Installation）

Backup your current Verge3D folder by renaming it (from "verge3d" to "verge3d\_old", for example).

通过重命名来备份当前的Verge3D文件夹（例如，将“verge3d”重命名为“verge3d\_old”）。

Download and unpack the latest Verge3D bundle in a fresh folder with the same name (that is, "verge3d").

在具有相同名称的新文件夹（即“verge3d”）中下载并解压缩最新的Verge3D软件包。

![](https://www.soft8soft.com/docs/files/updating/files-backup.jpg)

By using the same name for the fresh folder you can avoid re-configuring paths in the 3D editor of your choice.

通过对新文件夹使用相同的名称，可以避免在您选择的3D软件中重新配置路径。

### 更新应用程序（Update Applications）

＃

**方法＃1（自动） - 使用更新功能（Method #1 (Automatic) - use the update feature）**

Simply copy the entire folder with your application to the **applications** folder of the fresh Verge3D installation. After launching the App Manager, your app name should appear in the list of apps (reload the page if not). Click the update button with the round arrow on it.

只需将应用程序的整个文件夹复制到新Verge3D安装的**applications**文件夹即可。启动App Manager后，您的应用程序名称应显示在应用程序列表中（如果没有，则重新加载页面）。单击带有圆形箭头的更新按钮。

![](https://www.soft8soft.com/docs/files/updating/app-manager-update-button.jpg)

n the window shown up, select the template files you'd like to overwrite. You can safely select everything if you didn't edit the files. If you modified the files, be sure to backup them first so that you can cherry-pick the changes back later, and only after that proceed with overwriting.

在显示的窗口中，选择您要覆盖的模板文件。如果您不编辑文件，则可以安全地选择所有内容。如果您修改了文件，请务必先备份它们，这样您可以稍后再选择更改，然后再继续覆盖。

![](https://www.soft8soft.com/docs/files/updating/application-update-window.jpg)

Under the hood, this operation overwrites the engine modules by the files from **verge3d/build** folder, namely, Verge3D runtime **v3d.js** and optional compatibility modules **ie\_compat.js** (enabled by **IE 11** checkbox) and **webxr-polyfill.js** (enabled by **Legacy VR** checkbox in the app creation panel). If you choose so, this operation will also overwrite the selected HTML/CSS/JavaScript files and the icons folder **media** by the files from **verge3d/manager/app/Standard** folder.

此操作将通过**verge3d / build**文件夹中的文件覆盖引擎模块，即Verge3D运行时**v3d.js**和可选兼容模块**ie\_compat.js**（由**IE 11**启用复选框）和**webxr-polyfill.js**（由**Legacy**启用）应用创建面板中的**VR**复选框。如果选择此操作，此操作还将通过**verge3d / manager / app / Standard**文件夹中的文件覆盖选定的HTML / CSS / JavaScript文件和图标文件夹媒体。

```
更新功能还可用于在创建应用程序后随时添加兼容性模块，以便您可以避免从头开始创建应用程序。
要添加兼容性模块，只需将文件“ie_compat.js”和/或“webxr-polyfill.js”复制到app文件夹，然后单击“更新”按钮。
```

＃

**方法＃2（纯净） - 从头开始​​重新创建您的应用程序（Method #2 (Clean) - re-create your app from scratch）**

This is an alternative method of updating where you are in full control of your files. You can use it to get rid of obsolete files or if for some reason the automatic update method is not applicable.

这是一种替代方法，可以更新您完全控制文件的位置。您可以使用它来删除过时的文件，或者由于某种原因，自动更新方法不适用的时候来进行更新。

To perform clean updating, in the App Manager type the name of your app in the "Create new App" window and click "Create App" button.

要执行纯净更新，请在App Manager中的“创建新应用程序”窗口中键入应用程序的名称，然后单击“创建应用程序”按钮。

![](https://www.soft8soft.com/docs/files/updating/app-manager-create-new.jpg)

Copy **.max** or **.blend** files, all the textures/sounds and the Puzzles scenario file **visual\_logic.xml** from your old app folder to the newly created app folder (located within **verge3d/applications**). Overwrite files when you're asked so. If you were using HTML-based UI in your app, copy all relevant files as well.

&#x5C06;**.max**&#x6216;**.blend**文件，所有纹理/声音和Puzzles场景文件**visual\_logic.xml**从旧的app文件夹复制到新创建的app文件夹（位于**verge3d / applications中**）。出现弹窗时，请点击覆盖文件。如果您在应用中使用基于HTML的UI，请同时复制所有相关文件。

![](https://www.soft8soft.com/docs/files/updating/files-copy.jpg)

Finally, you should perform exporting to glTF so that the exported format receives the latest updates. If you were using Puzzles in your app, you'll need to re-save your scenario in the Puzzles editor so that the generated code matches the newest version of the engine.

最后，您应该执行导出到glTF，以便导出的格式接收最新的更新。如果您在应用程序中使用**拼图（Puzzles）**，则需要在**拼图编辑器（Puzzles）**&#x4E2D;重新保存场景，以便生成的代码与引擎的最新版本匹配。

If you changed anything in your application's .html, .css or .js files, be sure to backup them first so that you can cherry-pick the changes back later.

如果您更改了应用程序的.html，.css或.js文件中的任何内容，请务必先备份它们，以便稍后可以选择更改。

＃

### 更新后（After Update）

#### 还原拼图库（Restore Puzzles library）

If you were adding new entries in the Puzzles library, you can restore it after updating by copying the file **verge3d/puzzles/library.xml** to the fresh installation folder and overriding the old file.

如果您在Puzzles库中添加新条目，则可以在更新后通过将文件**verge3d / puzzles / library.xml**复制到全新安装文件夹并覆盖旧文件来还原它。

#### 重新激活您的许可证（Re-activate your license）

You should enter the license key each time you update to a new version, otherwise your apps may render the trial watermark when running.

每次更新到新版本时都应输入许可证密钥，否则您的应用程序可能会在运行时呈现试用水印。

＃

### 已知问题和故障排除（Known Issues and Troubleshooting）

On rare occasions the Puzzles button can disappear for your app in the App Manager. Please perform clean updating to fix this.

在极少数情况下，拼图按钮可能会在App Manager中消失。请执行干净更新以解决此问题。

On rare occasions the Puzzles editor may fail to load after updating. Please reset your browser settings to fix this.

在极少数情况下，拼图编辑器可能无法在更新后加载。请重置您的浏览器设置以解决此问题。

If after updating some feature got broken, please report this on the [forums](https://www.soft8soft.com/forum/bug-reports-and-feature-requests/) so that we can investigate the problem and issue a correcting release.

如果更新后某些功能有问题，请在[论坛](https://www.soft8soft.com/forum/bug-reports-and-feature-requests/)上报告，以便我们调查问题并发布更正版本。


# 常见问题

FAQ ——fastest已校订

Below are answered some common questions with regard to using Verge3D.

以下是有关使用Verge3D的一些常见问题。

* 许可（Licensing）
* 一般问题（General Questions）
* 编程问题（Programming Questions）

＃

### 许可（Licensing）

#### On how many computers can Verge3D be installed? How many users can use a single license?

The license is assigned on the per person (Personal) or per entity (Team, Enterprise) basis. The number of installations is not limited. In case of the Personal option, only one individual can use Verge3D. On the other hand, there is no limitation on the number of users within the company or organization.

#### 可以安装Verge3D的计算机数量？有多少用户可以使用单一许可证？

许可证是根据每个人（个人）或每个实体（团队，企业）分配的。安装数量不受限制。如果是“个人”选项，则只有一个人可以使用Verge3D。另一方面，对公司或组织内的用户数量没有限制。

#### What are the limitations / restrictions of the Verge3D Trial? Can I do ... ?

Quick answer to that question would be to quote our License Agreement. The Verge3D EULA states: "The trial version of this software available for free download from the Soft8Soft website is intended for testing purposes only. Any use in production environments, for commercial or non-commercial purposes is prohibited.".

Basically, you can do whatever you want (and for how long) provided you don't create apps for production use. For example, you can use it to create basic samples for practicing purposes, to develop your personal skills, or to create a mock-up presentation for your managers. You are not allowed to use it for education (feel free to [reach us](https://www.soft8soft.com/contact/) to request a special Educational license at reduced price) or to create your own portfolio (this qualifies as production use, so be sure to purchase the Verge3D Personal license in such a case).

#### Verge3D试用版有哪些限制/限制？我可以做些什么？

对该问题的快速回答是引用我们的许可协议。Verge3D EULA声明：“该软件的试用版可从Soft8Soft网站免费下载，仅供测试之用。禁止在生产环境中出于商业或非商业目的使用。” 。

基本上，如果您不为生产用途创建应用程序，则可以执行任何您想要的操作（以及持续时间）。例如，您可以使用它来创建用于练习目的的基本样本，发展您的个人技能，或为您的经理创建模拟演示文稿。您不得将其用于教育（请随时联系[我们](https://www.soft8soft.com/contact/)以降低价格申请特殊教育许可证）或创建您自己的投资组合（这有资格作为生产用途，因此请务必购买此类产品的Verge3D个人许可证案件）。

＃

### 一般问题（General Questions）

#### My app does not load when I open it in Chrome - yet it works when running from the App Manager or if opened in Firefox...

Due to security policy imposed by browser vendors, web applications cannot access data loaded from another domain, including from a local file system (with Firefox being an exception here). Therefore, you should use the App Manager (which comes with a local server) for development, or publish your Verge3D apps on a web server (or upload to the Verge3D Network) to be able to run it.

If you need a desktop or mobile application instead, you can convert your Verge3D apps to those platforms using third-party software (such [Electron](https://electronjs.org/) or [Cordova](https://cordova.apache.org/)).

#### 当我在Chrome中打开它时，我的应用程序无法加载 - 但是当它从App Manager运行或在Firefox中打开时它可以正常运行...

由于浏览器供应商施加的安全策略，Web应用程序无法访问从其他域加载的数据，包括从本地文件系统（Firefox在此处例外）。因此，您应该使用App Manager（随本地服务器提供）进行开发，或者在Web服务器上发布Verge3D应用程序（或上传到Verge3D Network）以便能够运行它。

如果您需要桌面或移动应用程序，则可以使用第三方软件（例如[Electron](https://electronjs.org/)或[Cordova](https://cordova.apache.org/)）将Verge3D应用程序转换为这些平台。

#### Cannot load app when I launch it by clicking on the .html file.

See the answer on the question above.

#### 通过单击.html文件启动应用程序时无法加载应用程序。

请参阅上述问题的答案。

#### Can I export my scene to a standalone all-in HTML file?

Nope, there is no all-in HTML format offered by Verge3D. If you need a standalone executable you can try to convert it with [Electron](https://electronjs.org/).

#### 我可以将场景导出到独立的全内置HTML文件吗？

不可以，Verge3D没有提供全面的HTML格式。如果您需要独立的可执行文件，可以尝试使用[Electron](https://electronjs.org/)进行转换。

#### Any plans to support Maxon Cinema 4D? May be Autodesk Maya?

See the [answer to this question](https://www.soft8soft.com/topic/verge3d-for-cinema4d-call-for-discussion/) on the forums.

#### 有计划支持Maxon Cinema 4D吗？可能是Autodesk Maya？

在论坛上查看[此问题](https://www.soft8soft.com/topic/verge3d-for-cinema4d-call-for-discussion/)的[答案](https://www.soft8soft.com/topic/verge3d-for-cinema4d-call-for-discussion/)。

#### Do Verge3D apps work in Internet Explorer 11?

Yes. Enable IE 11 compatibility module in the app creation panel.

#### Verge3D应用程序可以在Internet Explorer 11中运行吗？

是。在应用创建面板中启用IE 11兼容模块。

![](https://www.soft8soft.com/docs/files/faq/ie11-compat-module.jpg)

#### How can I copy Puzzles into another project?

You can use the [Library](https://www.soft8soft.com/docs/manual/en/puzzles/Library.html) feature for that.

#### 如何将拼图复制到另一个项目中？

您可以使用[库](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#Library)功能。

#### Sound is not played on iOS...

See how to fix that [here](https://www.soft8soft.com/docs/manual/en/introduction/Workflow.html#Audio_).

#### 声音不在iOS上播放...

如何解决这个问题看[这里](https://www.soft8soft.com/docs/manual/en/introduction/Workflow.html#Audio_)。

#### What 3D formats can be used with Verge3D?

Verge3D is able to load various formats including glTF, OBJ, FBX, COLLADA, STL and PLY. Still, the preferred way to create 3D web content is to use glTF 2.0 format which is supported by both 3ds Max and Blender exporters.

Also, the script of the Standard application template is based on the App class which supports loading glTF files only. For loading some other formats, use the corresponding [loaders](https://cdn.soft8soft.com/demo/examples/index.html?q=loader) instead.

#### Verge3D可以使用哪些3D格式？

Verge3D能够加载各种格式，包括glTF，OBJ，FBX，COLLADA，STL和PLY。尽管如此，创建3D Web内容的首选方法是使用3ds Max和Blender导出器支持的glTF 2.0格式。

此外，标准应用程序模板的脚本基于App类，该类仅支持加载glTF文件。要加载其他一些格式，请使用相应的[加载器](https://cdn.soft8soft.com/demo/examples/index.html?q=loader)。

＃

### 编程问题（Programming Questions）

#### You say Verge3D is based on Three.js. Is it compatible with Three.js API?

To create Verge3D we modified Three.js code base a lot and thus we decided to use "v3d" prefix for our APIs. However, we'll try to maintain source code compatibility with Three.js. Most of the Three.js-based applications and [examples](https://cdn.soft8soft.com/demo/examples/index.html) should work in Verge3D without any modifications.

#### 你说Verge3D基于Three.js。它与Three.js API兼容吗？

为了创建Verge3D，我们修改了Three.js代码库，因此我们决定在API中使用“v3d”前缀。但是，我们将尝试维护与Three.js的源代码兼容性。大多数基于Three.js的应用程序和[示例](https://cdn.soft8soft.com/demo/examples/index.html)都应该在Verge3D中运行而不做任何修改。

#### Why are there meta viewport tags in examples?

```
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
```

These tags control viewport size and scale for mobile browsers (where page content may be rendered at different size than visible viewport).

<https://developer.mozilla.org/en/Mobile/Viewport_meta_tag>

#### 为什么示例中有元视口标记？

```
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
```

这些标记控制移动浏览器的视口大小和比例（其中页面内容可以以与可见视口不同的大小呈现）。

<https://developer.mozilla.org/en/Mobile/Viewport_meta_tag>

#### How can scene scale be preserved on resize?

We want all objects, regardless of their distance from the camera, to appear the same size, even as the window is resized. The key equation to solving this is this formula for the visible height at a given distance:

```
isible_height = 2 * Math.tan((Math.PI / 180) * camera.fov / 2) * distance_from_camera;
```

If we increase the window height by a certain percentage, then what we want is the visible height at all distances to increase by the same percentage. This can not be done by changing the camera position. Instead you have to change the camera field-of-view. [Example](http://jsfiddle.net/Q4Jpu/).

#### 如何在调整大小时保留场景比例？

我们希望所有对象（无论与相机的距离如何）都显示相同的大小，即使窗口调整大小也是如此。解决这个问题的关键方程是给定距离处可见高度的公式：&#x20;

```
isible_height = 2 * Math.tan((Math.PI / 180) * camera.fov / 2) * distance_from_camera;
```

如果我们将窗高增加一定百分比，那么我们想要的是所有距离的可见高度增加相同的百分比。这不能通过改变相机位置来完成。相反，您必须更改摄像机视野。 [例子](http://jsfiddle.net/Q4Jpu/)。

#### Why is part of my object invisible?

This could be because of face culling. Faces have an orientation that decides which side is which. And the culling removes the backside in normal circumstances. To see if this is your problem, change the material side to v3d.DoubleSide.

```
material.side = v3d.DoubleSide
```

#### 为什么我的物体一部分不可见？

这可能是因为面被剔除了。面具有一个方向，决定哪一面是正面。在正常情况下，剔除会消除背面。要查看这是否是您的问题，请将材质面更改为v3d.DoubleSide。

```
material.side = v3d.DoubleSide
```

#### My app window grows endlessly on iOS devices. How to fix it?

If you embed a Verge3D application inside an iframe element, you may run into a specific issue on iOS devices, which causes iframes to constantly increase in size beyond the boundaries of the browser window. This in turn can lead to a WebGL crash.

To deal with this issue you can use the following snippet, which resizes the iframe to the page's body preventing the said iframe from extending beyond it.

```
<script>
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) {
    var iframe = document.getElementById('myIframe');
    function resize() {
        iframe.style.width = getComputedStyle(document.body).width;
        iframe.style.height = getComputedStyle(document.body).height;
        iframe.setAttribute('scrolling', 'no');
    }
    iframe.addEventListener('resize', function(e) {
        resize();
    });

    resize();
}
</script>
```

#### 我的应用程序窗口在iOS设备上无休止地增长。怎么解决？

如果在iframe元素中嵌入Verge3D应用程序，则可能会遇到iOS设备上的特定问题，这会导致iframe的大小不断超出浏览器窗口的范围。这反过来可能导致WebGL崩溃。

要解决此问题，您可以使用以下代码段，该代码段会将iframe的大小调整为页面的正文，以防止所述iframe超出它。

```
<script>
if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) {
    var iframe = document.getElementById('myIframe');
    function resize() {
        iframe.style.width = getComputedStyle(document.body).width;
        iframe.style.height = getComputedStyle(document.body).height;
        iframe.setAttribute('scrolling', 'no');
    }
    iframe.addEventListener('resize', function(e) {
        resize();
    });

    resize();
}
</script>
```

#### Keyboard controls does not work for the app embedded in iframe

It happens when some other HTML on your page gets the focus. To fix this issue try the following code:

```
document.getElementById("my_iframe_id").focus();
```

Where **my\_iframe\_id** is the ID of your iframe element.

#### 键盘控件不适用于嵌入在iframe中的应用

当页面上的其他HTML得到关注时，就会发生这种情况。要解决此问题，请尝试以下代码：&#x20;

```
document.getElementById("my_iframe_id").focus();
```

其中**my\_iframe\_id**是iframe元素的ID。


# 3D文件格式

Verge3D可以使用哪些3D文件格式？

### Verge3D可以使用哪些3D文件格式？

Verge3D可以加载多种3D文件格式，包括glTF，OBJ，FBX，COLLADA，STL和PLY。但我们推荐使用Blender和3ds Max都兼容的glTF 2.0格式。

此外，标准应用模板的脚本基于[APP](/developer-reference/developer-reference/extras)的类，该类仅支持加载glTF格式。如果您需要加载其他格式，需要改用相对应的[加载器](/developer-reference/developer-reference/loaders)。


# SolidWorks

如何将SolidWorks模型转换为webGL应用

### 如何将SolidWorks模型转换为webGL应用？

从2016版开始，3ds Max可以直接支持SolidWorks资产。 只需将您的SolidWorks文件导入3ds Max，然后像其他任何Max场景一样导出到WebGL即可。

注意：因为CAD模型对网页来说一般情况下负担过重，请注意优化模型几何网格。 导入文件时，从“导入设置”对话框中调整“网格分辨率”设置。 您也可以使用3ds Max修改器减少模型上的多边形数量。

&#x20;

![SolidWorks-to-Max import dialog](https://www.soft8soft.com/docs/files/faq/import-cad-model.jpg)


# Revit

如何基于Revit创建实时网页可视化应用?

### 如何基于Revit创建实时网页可视化应用?

推荐如下两个方案:

1. 将Revit模型导出为FBX格式，然后导入3ds Max或Blender。
2. 使用3ds Max中原生支持的[Revit导入器](https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/3DSMax-Data-Exchange/files/GUID-14B2A55F-5C22-4FA2-A31E-554E2400FB52-htm.html)。 在安装Max的过程中，请不要忘记激活Autodesk Revit互操作性选项以启用此功能。

![Importing Revit model to 3ds Max](https://www.soft8soft.com/docs/files/faq/import-revit-model.jpg)

无论如何都要保持几何形状的优化。 我们建议在整个场景中使用100K-500K多边形。


# 实用链接

Useful Links ——fastest校订中

以下是您可能会发现有用的Verge3D资源的集合。<br>

### 论坛（Forums）

使用[Verge3D论坛](https://www.soft8soft.com/forums/)进行讨论，问题，功能请求或工作。这也是展示您的项目的好地方。

您也可是使用[Verge3D中国](https://verge3d.funjoy.tech/)的[工单系统](https://verge3d.funjoy.tech/helpdesk/)获得直接的一对一帮助。

### 教程（Tutorials）

#### 初级水平

* [Verge3D for 3ds Max Basics](https://www.youtube.com/playlist?list=PLMnTV0uuRMhR2zhXxPqAD8G9wp_LNIXZc)视频课程
  * YouTube: <https://www.youtube.com/playlist?list=PLMnTV0uuRMhR2zhXxPqAD8G9wp_LNIXZc>
  * Bilibili: <https://www.bilibili.com/medialist/play/ml371819653>
* [Verge3D for Blender Basics](https://www.youtube.com/playlist?list=PLMnTV0uuRMhRn1QomhOqH4Rt_bSlDGXbP)视频课程
  * YouTube: <https://www.youtube.com/playlist?list=PLMnTV0uuRMhRn1QomhOqH4Rt_bSlDGXbP>
  * Bilibili: <https://www.bilibili.com/video/av46094065>

#### 先进水平

* [创建交互式内部可视化](https://www.youtube.com/watch?v=U6aGboR_sHE)（Verge3D for Blender）。
* [创建小行星游戏](https://www.youtube.com/playlist?list=PLvH2ejcv0wjRA4K6pQ6mUZgLTueIGSMe2)（Verge3D for Blender）。

### 画廊（Gallery）

* [Gallery](https://www.soft8soft.com/gallery/) - 使用Verge3D创建的应用程序库。这是掌握Verge3D特性和功能的良好起点。
* Gallery中文版 - 官方案例中文化及中国社区用户案例。

### 社交媒体（Social Media）

* [Facebook上的Verge3D](https://www.facebook.com/soft8soft/) - 我们[在Verge3D上发布](https://www.facebook.com/soft8soft/)新闻和更新的主要渠道。
* 官方[YouTube频道](https://www.youtube.com/channel/UCcZTsl1ciCnehDgES3WlTGw)。
* [Twitter上的](https://twitter.com/soft8soft/) Verge3D - 新鲜的Verge3D新闻。
* [Verge3D在Instagram](https://www.instagram.com/soft8soft/)
* [Reddit上的Verge3D](https://www.reddit.com/r/verge3d/) - 社区频道。
* [Verge3D微信公众号](https://weixin.sogou.com/weixin?type=1\&s_from=input\&query=Verge3D) - 第一时间在手机上获得更新与学习资讯。
* [Verge3D中文微博](https://weibo.com/verge3d) - @我们吧，发布你有趣的案例。
* [Verge3D在Bilibili](https://space.bilibili.com/402774953) - 官方视频中文编译及加速服务。

还可以使&#x7528;**＃verge3d**&#x6216;**＃3dweb**标签查找有关Verge3D框架的信息以及来自3D Web行业的最新更新。

### 演示和示例（Demos and Examples）

* [Verge3D发行版](https://www.soft8soft.com/get-verge3d/)附带了我们Gallery的演示应用程序源代码。
* [Verge3D代码示例](https://cdn.soft8soft.com/demo/examples/index.html) - 程序员的这些高级示例基于官方Verge3D示例。

### API帮助（Help with API）

只是Google“如何做...在three.js中”并且99％的概率你可以用Verge3D做同样的事情，因为我们正在努力保持两个框架之间的API兼容性。

### WebGL和WebXR（WebGL & WebXR）

* [WebGL支持浏览器和故障排除](https://www.soft8soft.com/webgl-supported-browsers-and-troubleshooting/) - 如果WebGL支持出现任何问题，这是您的急救工具。
* [WebGL系统报告](https://www.soft8soft.com/webglreport/) - 检查系统的功能。
* [WebXR Device API](https://immersive-web.github.io/webxr/) - 官方WebXR规范。


# 资产压缩

Asset Compression -fastest校订中

In Verge3D, scene files may be compressed using the highly effective LZMA2 compression algorithm, thus allowing to significantly reduce the size of the files. At the same time, LZMA2 offers fast decompression on the browser side. Typical compression rates observed for Verge3D scenes are: 20x for the **.gltf** files and 6x for the **.bin** files.

在Verge3D中，可以使用高效的LZMA2压缩算法压缩场景文件，从而允许显着减小文件的大小。同时，LZMA2在浏览器端提供快速解压缩。Verge3D场景的典型压缩率为：**.gltf**文件为20x，**.bin**文件为6x 。

* 压缩文件时（When Compress Files）
* 导出压缩文件（Exporting Compressed Files）
* 正在加载.xz文件（Loading .xz Files）
* 检查你的文件（Checking Your Files）
* 自定义应用程序或glTF查看器（Custom Apps or glTF Viewer）
* 档案库（Archivers）

＃

### 压缩文件时（When Compress Files）

Using asset compression is especially recommended in the following cases:

* .gltf/.bin or .glb scene files are relatively big so that the effect from compression is significant in terms of size reduction;
* you expect slow connections and every kilobyte counts;
* the standard server-side GZIP compression is not enabled or not satisfactory, or you don't even have any access to the server to setup GZIP for Verge3D scene files.

在以下情况下，特别建议使用资产压缩：

* .gltf / .bin或.glb场景文件相对较大，因此压缩效果在尺寸减小方面显着;
* 你期望缓慢的连接和每千字节计数;
* 标准服务器端GZIP压缩未启用或不满意，或者您甚至无法访问服务器以设置GZIP for Verge3D场景文件。

![Size comparison for a sample file: raw vs GZIP-compressed vs LZMA2-compressed](https://www.soft8soft.com/docs/files/scene_data_compression/compression_chart.png)

＃

### 导出压缩文件（Exporting Compressed Files）

Verge3D supports loading of scene files compressed in the **.xz** file format, which incorporates the LZMA2 compression algorithm. To enable creating **.xz** files automatically upon export, you can simply turn on the corresponding option in the export settings.

Verge3D支持加载&#x4EE5;**.xz**文件格式压缩的场景文件，该文件格式包含LZMA2压缩算法。要在导出时自动创&#x5EFA;**.xz**文件，只需在导出设置中打开相应的选项即可。

3ds Max：

![](https://www.soft8soft.com/docs/files/scene_data_compression/lzma-max.jpg)

Blender：

![](https://www.soft8soft.com/docs/files/scene_data_compression/lzma-blender.jpg)

＃

### 正在加载.xz文件（Loading .xz Files）

The compressed **.xz** files (for example, my\_awesome\_app.gltf.xz and my\_awesome\_app.bin.xz) should appear near the original ones. What is left is to enable loading them in your app. To do this, go to Puzzles and switch to the **init** tab:

压缩&#x7684;**.xz**文件（例如，my\_awesome\_app.gltf.xz和my\_awesome\_app.bin.xz）应该出现在原始文件附近。剩下的就是在你的应用中加载它们。为此，请转到Puzzles并切换到**init**选项卡：

![](https://www.soft8soft.com/docs/files/scene_data_compression/puzzles-init.jpg)

Drag out the **configure application** puzzle from the **Initialization** category, if it is not already present in the workspace, and turn on the **compressed assets** checkbox on it:

从“ **初始化”**&#x7C7B;别中 拖出**配置应用程序**谜题（如果它尚未存在于工作空间中），并打开其上的**压缩资源**复选框：

![](https://www.soft8soft.com/docs/files/scene_data_compression/puzzles-configure-app.jpg)

Finally, click the **Save** button. That's it!

最后，单击“ **保存”**&#x6309;钮。而已！

＃

### 检查你的文件（Checking Your Files）

To ensure that your app now actually loads compressed assets, run your app (either from App Manager or from a website where it is deployed). Open the browser console and switch to the **Network** tab.

要确保您的应用程序现在实际加载压缩资产，请运行您的应用程序（从App Manager或部署它的网站）。打开浏览器控制台并切换到“ **网络”**&#x9009;项卡。

![](https://www.soft8soft.com/docs/files/scene_data_compression/console-check.jpg)

Reload your app so that the console starts displaying files from the beginning. Find the scene files in the list - if everything is ok, they should end with **.xz**.

重新加载您的应用程序，以便控制台从头开始显示文件。在列表中查找场景文件 - 如果一切正常，则应&#x4EE5;**.xz结尾**。

The browser console can usually be opened with the F12 key (Chrome, Firefox on Windows, Linux). On Mac use the View > Developer > JavaScript Console menu (Option-Cmd-J) in Chrome, or the Develop > Show Error Console menu (Option-Cmd-C) in Safari.

通常可以使用F12键（Chrome，Windows，Linux上的Firefox）打开浏览器控制台。在Mac上，使用Chrome中的View> Developer> JavaScript Console菜单（Option-Cmd-J），或Safari中的Develop> Show Error Console菜单（Option-Cmd-C）。

＃

### 自定义应用程序或glTF查看器（Custom Apps or glTF Viewer）

For **Custom** applications simply change

```
var url = 'my_awesome_app.gltf';
```

to:

```
var url = 'my_awesome_app.gltf.xz';
```

in the JavaScript code.

For Player-based applications that have a scene **.gltf** file specified in the URL as follows:

```
https://cdn.soft8soft.com/demo/player/player.html?load=../applications/ring/ring.gltf
```

you can simply replace it with the path to the compressed **.gltf.xz** file:

```
https://cdn.soft8soft.com/demo/player/player.html?load=../applications/ring/ring.gltf.xz
```

The same applies to **.glb** and **.glb.xz** files if they are used instead of **.gltf/.bin**.

对于**自定义**应用程序，只需 在JavaScript代码中 。

```
var url = 'my_awesome_app.gltf';
```

更改为：

```
var url = 'my_awesome_app.gltf.xz';
```

对于具有URL中指定的场&#x666F;**.gltf**文件 的基于Player的应用程序，&#x20;

```
https://cdn.soft8soft.com/demo/player/player.html?load=../applications/ring/ring.gltf
```

您可以简单地将其替换为压缩&#x7684;**.gltf.xz**文件的路径：

```
https://cdn.soft8soft.com/demo/player/player.html?load=../applications/ring/ring.gltf.xz
```

如果使&#x7528;**.glb**&#x548C;**.glb.xz**文件而不&#x662F;**.gltf / .bin，**&#x5219; 同样适&#x7528;**.glb**&#x548C;**.glb.xz**文件。

＃

### 档案库（Archivers）   &#x20;

Alternatively, you can create **.xz** files using archive utilities as **7-Zip**, **XZ Utils** or others.

或者，您可以使用存档实用程序（如**7-Zip**，**XZ Utils**或其他）创&#x5EFA;**.xz**文件 。

Verge3D implementation of an .xz decompressor puts some restrictions on compressed files due to optimization purposes, so not every .xz file can be loaded. .tar.xz files are also not supported. Considering this, it's recommended to use settings described below.

由于优化目的，.xz解压缩程序的Verge3D实现对压缩文件施加了一些限制，因此不能加载每个.xz文件。.tar.xz文件也不受支持。考虑到这一点，建议使用下面描述的设置。

#### 视窗（Windows）

1\) A popular file archiver [7-Zip](https://www.7-zip.org/download.html) can be used for creating .xz files.

To compress a file you can right click it, and then choose "7-Zip" -> "Add to arcive..." - this opens the corresponding dialog window:

1）流行的文件存档器[7-Zip](https://www.7-zip.org/download.html) 可用于创建.xz文件。

要压缩文件，您可以右键单击它，然后选择“7-Zip” - >“Add to arcive ...” - 这将打开相应的对话框窗口：

![](https://www.soft8soft.com/docs/files/scene_data_compression/7zip_add_to_archive.png)

The archivation settings should look like this:

* Archive format: xz
* Compression level: any (Normal, Maximum and Ultra give best results)
* Compression method: LZMA2 (the only available option)
* Dictionary size: up to 8 MB - the more the better (more than 8MB is not supported by the engine)

The rest of options can be left by default.

Also you can use a command line version of **7-Zip** instead:`7z.exe a -m0=LZMA2:d23 scene.gltf.xz scene.gltf 7z.exe a -m0=LZMA2:d23 scene.bin.xz scene.bin`

archivation设置应如下所示：

* 存档格式：xz
* 压缩级别：任何（正常，最大和超级给出最佳结果）
* 压缩方法：LZMA2（唯一可用的选项）
* 字典大小：最大8 MB - 越多越好（引擎不支持超过8 MB）

其余选项可以默认保留。

您也可以使用命令行版本的**7-Zip**：`7z.exe a -m0=LZMA2:d23 scene.gltf.xz scene.gltf 7z.exe a -m0=LZMA2:d23 scene.bin.xz scene.bin`

2\) Alternatively, you can use a special command line tool called **XZ Utils**. Its Windows binaries are available [here](https://tukaani.org/xz/) in the **Pre-built binaries** section.

The usage is simple:`xz.exe -k -f -6 scene.gltf xz.exe -k -f -6 scene.bin`

2）或者，您可以使用名为**XZ Utils**的特殊命令行工具 。它的Windows可执行文件都可以 [在这里](https://tukaani.org/xz/)的**预建的二进制文件**部分。

用法很简单：`xz.exe -k -f -6 scene.gltf xz.exe -k -f -6 scene.bin`

#### Linux

1\) A **7-Zip** command line port can be available out of the box or from official repositories as a package named **p7zip**.

The usage is similar to the one in Windows:`7z a -m0=LZMA2:d23 scene.gltf.xz scene.gltf 7z a -m0=LZMA2:d23 scene.bin.xz scene.bin`

1）**7-Zip**命令行端口可以是开箱即用的，也可以从官方存储库中获得，名为**p7zip**。

用法类似于Windows中的用法：`7z a -m0=LZMA2:d23 scene.gltf.xz scene.gltf 7z a -m0=LZMA2:d23 scene.bin.xz scene.bin`

2\) **XZ Utils** is also available out of the box or from official repositories in most Linux distros.

The usage is similar to the one in Windows:`xz -k -f -6 scene.gltf xz -k -f -6 scene.bin`

2）**XZ Utils**也可以在大多数Linux发行版中开箱即用或从官方存储库中获得。

用法类似于Windows中的用法：`xz -k -f -6 scene.gltf xz -k -f -6 scene.bin`

#### 苹果系统（macOS）

1\) A **7-Zip** command line port can be installed via **Homebrew** as a package named **p7zip**:`$ brew update $ brew install p7zip`

The usage is the same as in Linux.

1）**7-Zip**命令行端口可以通过 **Homebrew**作为名为**p7zip**的软件包**安装**：`$ brew update $ brew install p7zip`用法与Linux中的相同。

2\) **XZ Utils** binaries are available for macOS 10.5+ [here](https://tukaani.org/xz/) in the **Pre-built binaries** section. The usage is the same as in Linux.

2）**XZ utils的**二进制文件可用于MacOS 10.5+ [这里](https://tukaani.org/xz/)的**预建的二进制文件**部分。用法与Linux中的用法相同。


# 基于HTML的用户界面

HTML-Based User Interfaces 待校订

## 为3D Web应用程序构建基于HTML的用户界面

了解如何利用标准Web技术创建丰富的移动友好型用户界面和网站集成。

* 介绍
* 在哪里添加HTML和CSS
* 快速概览：茶壶加热器
* 教程
* 案例＃1：Google Web Designer
* 案例＃2：Webflow
* 案例＃3：文本编辑器
* 连接一切：HTML拼图

＃

### 介绍

模板Verge3D应用程序提供单页宽屏布局，带有全屏按钮和预加载器。诸如按钮之类的交互式元素可以实现为固定到相机的3D对象 - 这同样适用于文本框。

然而，更灵活和有效的方法是利用已建立的Web标准来创建用户界面。使用HTML和CSS，您可以为您的应用构建任何布局，使其响应和SEO友好。由于现代Web浏览器的专用光栅化引擎，UI和特别是使用HTML和CSS创建的文本看起来通常比3D对应物更清晰。此方法还允许您轻松地将2D媒体（如图像，视频和Web链接）与WebGL内容混合，并为您的应用设置样式以匹配将部署它的网站的设计。

有很多网页设计工具，从纯文本编辑器到完全成熟的网站建设者。后者可以生成完整的HTML / CSS / JavaScript即用型网页，从而使您可以永远不会触摸任何代码。

＃

### 在哪里添加HTML和CSS

假设您使用App Manager（使用默认配置选项）创建了应用程序，并将其命名为**my\_awesome\_app**。如果您查看verge3d / applications / my\_awesome\_app文件夹，您会发现my\_awesome\_app.html和my\_awesome\_app.css文件似乎很自然地开始编辑 - 但它们看起来只是如此！

实际上，您可能永远不想编辑这些文件，因为它们是由App Manager自动生成的，并且可能会因[更新](https://www.soft8soft.com/docs/manual/en/introduction/Updating.html)而被覆盖。将自己的HTML / CSS添加到Verge3D应用程序的更健壮的方法是创建一个新的 **.html**文件，其中嵌入了Verge3D app **.html**，matryoshka-style。

＃

### 快速概览：茶壶加热器

查看以下示例（Verge3D [Teapot Heater](https://cdn.soft8soft.com/demo/applications/teapot_heater_max/index.html)演示）：所有界面均使用第三方Web设计软件构建并保存为index.html（此名称不是必需的）。除了界面HTML元素之外，index.html文件还包含一个**iframe**元素，通过该元素嵌入了Verge3D项目teapot\_heater.html。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/layered-html.jpg)

在Verge3D App Manager中，这样的复合项目有两个启动图标，您可以使用它们独立运行纯Verge3D项目或组装的应用程序：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/teapot-heater-app-manager.jpg)

最后，2D和3D部分在逻辑上与[HTML谜题](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#HTML)互连，以处理用户事件。

＃

### 教程

在下面的教程中，我们将展示如何使用基于HTML的UI创建一个简单的应用程序。此应用程序将只有2个按钮用于隐藏和显示默认多维数据集。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/tutorial-final-app.jpg)

让我们从使用App Manager 创建名为**my\_awesome\_app**的新项目开始。下面我们将向您展示如何使用3种替代工具创建用户界&#x9762;**.html**文件：Google Web Designer，Webflow和文本编辑器。一旦用户界面准备就绪，我们就可以使用Puzzles操作 HTML按钮。

＃

### 案例＃1：Google Web Designer

[Google Web Designer](https://www.google.com/webdesigner/)是一款免费的跨平台工具，可用于创建HTML元素并以可视方式为其分配样式。

启动此程序后，选择“ **创建新文件** ...”![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-create-new.jpg)

...然后选择**HTML**左侧面板上，并填写所有字段：**姓名**（如“my\_awesome\_app\_gwd”），**位置**（使用任何路径，最好出你的应用程序文件夹中，以避免与已发布的版本混乱）和**标题**，以及单击**确定**。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-create-new2.jpg)

让我们首先添加**iframe**元素，以嵌入我们的Verge3D应用程序的主要启动文件my\_awesome\_app.html。在Google Web Designer中，可以通过从“ **组件”**&#x9009;项卡下的列表中拖出**IFrame**组件来完成此操作。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-add-iframe.jpg)

将**IFrame**组件放置在页面上后，切换到“ **属性”**&#x9009;项卡，通过为左侧和顶部位置指定零，并为宽度和高度指定100％，使**iframe**元素占据整个页面。此外，在**Source**字段中将路径放到Verge3D app主文件 - “my\_awesome\_app.html”（假设我们将在app文件夹的根目录中发布我们的UI文件）。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-add-iframe2.jpg)

在这个阶段，我们可以生成我们的UI **.html**文件，并使用Verge3D应用程序进行尝试。单击右上角的“ **发布”**&#x6309;钮，然后选择“ **本地”**。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-publish.jpg)

在发布对话框中，选择app文件夹的路径**my\_awesome\_app**作为**Location**。将“ **名称”**&#x5B57;段保留为空，以便将文件保存在应用程序文件夹的根目录中。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-publish2.jpg)

新&#x7684;**.html**文件立即开始在App Manager中显示为一个额外的蓝色图标。您可以运行它来检查它是否实际加载了Verge3D应用程序。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/my-awesome-app-manager.jpg)

现在让我们添加这两个按钮。在最左侧的面板上单击**元素工具**，然后选择**Div元素**并开始在页面上绘制一个矩形。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-add-buttons.jpg)

在“ **属性”**&#x9009;项卡中，使用颜色选择器用颜色填充按钮，指定其位置和尺寸，最重要的是，设置此元素的**ID**，我们将在拼图中引用它。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-add-buttons2.jpg)

要为按钮添加标题（“隐藏”或“显示”），请双击它以使其以红色标出轮廓。单击**文本工具**，然后单击按钮并在文本区域中键入文本。使用字体设置来设置大小，颜色和其他属性。您可以使用“ **选择”工具**（带箭头的第一个按钮）移动按钮上的文本字段。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-add-buttons3.jpg)

因此，在“ **大纲视图”**&#x9762;板中，您应该看到**iframe**元素，分配了唯一ID的2个**div**元素以及嵌套在这些**div中的**两个文本元素。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-add-buttons4.jpg)

作为画龙点睛之笔，在CSS属性窗口中，当鼠标光标悬停在这些按钮上时，我们可以将鼠标光标变为“点击”形式：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/gwd-add-buttons5.jpg)

发布index.html文件并从App Manager运行已组装的应用程序后，您应该看到如下内容：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/tutorial-final-app.jpg)

有关使用Google Web Designer工具和组件的详细信息，请参阅其[文档](https://support.google.com/webdesigner)。

＃

### 案例＃2：Webflow

[Webflow](https://webflow.com/)是一个基于云的工具，也可用于为Verge3D应用程序创建HTML / CSS用户界面。必要的**嵌入**组件和**导出代码**功能仅适用于从“精简版”级别开始的付费帐户。

在仪表板中单击“ **新建项目”**&#x6309;钮，然后从模板中选择“ **空白站点** ”：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-new-project.jpg)

填写项目名称，然后单击“ **创建项目”**：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-new-project2.jpg)

现在让我们添加一个**iframe**元素来嵌入我们的Verge3D应用程序的主要启动文件my\_awesome\_app.html。在Webflow中，这可以通过以下方式实现。在左侧面板上，单击“ **添加元素”**，然后单击或拖出“ **嵌入”**&#x7EC4;件：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-iframe.jpg)

将以下行复制并粘贴到编辑器窗口：`<iframe width="100%" height="100%" frameborder="0" src="my_awesome_app.html"></iframe>`![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-iframe2.jpg)

这里我们假设Webflow生成的index.html将放在app文件夹的根目录中。单击“ **保存并关闭”**。

将**嵌入**组件放置在页面上后，切换到“ **样式”**&#x9009;项卡，并使**iframe**元素占据整个页面，方法是为其位置指定“ **固定”**，为宽度和高度指定“ 100％”。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-iframe3.jpg)

在这个阶段，我们可以生成我们的UI **.html**文件，并使用Verge3D应用程序进行尝试。单击顶部栏上的“ **导出代码”**&#x6309;钮...![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-export-code.jpg)

...然后单击**准备ZIP**并最终**下载ZIP**：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-export-code2.jpg)

将存档保存到硬盘驱动器上的任何位置，然后解压缩到应用程序文件夹**my\_awesome\_app**的根目录。新&#x7684;**.html**文件立即开始在App Manager中显示为一个额外的蓝色图标。您可以运行它来检查它是否实际加载了Verge3D应用程序。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/my-awesome-app-manager.jpg)

现在让我们添加这两个按钮。在最左侧的面板上单击**添加元素**，然后单击或拖出**Div Block**组件。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-buttons.jpg)

在“ **样式”**&#x9009;项卡中，使用颜色选择器用颜色填充按钮，指定其位置和尺寸。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-buttons2.jpg)

为了设置我们将用于在拼图中引用它的元素的**ID**，请转到**元素设置**选项卡，然后在**ID**字段中键入“hide\_button”或“show\_button” 。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-buttons3.jpg)

要为按钮添加标题（“隐藏”或“显示”），请拖出按钮上的**文本块**组件，然后在文本区域中键入文本。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-buttons4.jpg)

使用“ **样式”**&#x9009;项卡下&#x7684;**“ 排版**设置” 设置大小，颜色和其他属性。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-buttons5.jpg)

因此，在“ **导航器”**&#x9009;项卡中，您应该看到**iframe**元素，2个**div**元素（显示它们的样式名称）和嵌套在这些**div中的**两个文本元素。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-buttons6.jpg)

作为画龙点睛，在“ **样式”**&#x9009;项卡中，当鼠标光标悬停在这些按钮上时，我们可以将鼠标光标变为“点击”形式：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/webflow-add-buttons7.jpg)

导出项目并从App Manager运行组装的应用程序后，您应该看到如下内容：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/tutorial-final-app.jpg)

有关使用Webflow工具和组件的更多信息，请参阅其[教程](https://university.webflow.com/courses/webflow-101-crash-course)。

＃

### 案例＃3：文本编辑器

许多网页设计师仍然认为纯文本编辑器是构建网页的最强大和最灵活的工具。即使您不想深入编写代码，本指南也可以帮助您了解更多艺术家友好工具生成的网页内部结构。

您可以使用任何文本编辑器来编辑HTML / CSS代码，但如果您的编辑器支持语法高亮和行编号（如Notepad ++或Atom），则工作更方便。

我们可以从中开始的基本HTML文档可以如下所示。您可以将这些内容复制到新的文本文档，并将其另存为index.html在**verge3d / applications / my\_awesome\_app**文件夹中。同样，文件的名称不是强制性的，为了保持一致性，我们只在任何地方使用它。`<!DOCTYPE html> <html> <head> <title>Index of My Awesome App</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <meta name="description" content="Put some description here - remember about SEO!"> </head> <body> </body> </html>`

新&#x7684;**.html**文件立即开始在App Manager中显示为一个额外的蓝色图标，在启动时会生成一个白色的空白页面。![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/my-awesome-app-manager.jpg)

现在我们可以在文档的**主体中**添加一个**iframe**元素来嵌入我们的Verge3D应用程序的主要启动文件my\_awesome\_app.html：`<body> <iframe id="my_iframe" src="my_awesome_app.html"></iframe> </body>`

如果您现在从App Manager运行已组装的应用程序，它将在左上角显示默认多维数据集应用程序的小嵌入。我们可以通过嵌入一些CSS来使它成为宽屏和无边框：`<style> #my_iframe { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; border: 0; } </style>`

现在让我们通过向主体添加2个**div**元素来创建2个按钮，提供唯一的**id**属性，以便在CSS和Puzzles中进行引用：`<div id="hide_button">Hide</div> <div id="show_button">Show</div>`

您不会在应用程序中注意到它们，直到您使用一些CSS对它们进行绝对定位和样式设置：`#hide_button, #show_button { position: absolute; width: 100px; height: 30px; background-color: DodgerBlue; color: white; text-align: center; line-height: 30px; cursor: pointer; } #hide_button { left: 10px; } #show_button { left: 120px; }`

就是这样 - 现在你的应用程序中有两个HTML按钮！以下是index.html的完整列表：`<!DOCTYPE html> <html> <head> <title>Index of My Awesome App</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <meta name="description" content="Put some description here - remember about SEO!"> <style> #my_iframe { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; border: 0; } #hide_button, #show_button { position: absolute; width: 100px; height: 30px; background-color: DodgerBlue; color: white; text-align: center; line-height: 30px; cursor: pointer; } #hide_button { left: 10px; } #show_button { left: 120px; } </style> </head> <body> <iframe id="my_iframe" src="my_awesome_app.html"></iframe> <div id="hide_button">Hide</div> <div id="show_button">Show</div> </body> </html>`

从App Manager运行组装的应用程序时，您应该看到如下内容：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/tutorial-final-app.jpg)访问[w3schools.com，](https://www.w3schools.com/)获取有关HTML和CSS的更多教程，参考资料和示例。

＃

### 连接一切：HTML拼图

现在剩下的就是使我们的按钮可操作，以便通过点击它们，用户可以隐藏和显示立方体。这可以通过利用与元素ID结合使用的HTML 事件谜题轻松实现：![](https://www.soft8soft.com/docs/files/HTML-based-user-interfaces/html-puzzles.jpg)

由于可点击的HTML元素位于嵌入了Verge3D应用程序的&#x7236;**.html**文件中，因此我们应该检查**父母文档**复选框以使它们起作用。

而已！保存您的拼图并检查按钮是否适用于多维数据集。

在此[论坛主题中](https://www.soft8soft.com/topic/creating-html-based-gui-with-google-web-designer-webflow-or-text-editor/)留下您的反馈或问题（如果有的话）。


# Facebook发布3D主题

Facebook 3D Posts 待校定

## Facebook 3D帖子（Facebook 3D Posts）

As of February 2018, Facebook offers the support for 3D posts via the glTF file format. Verge3D users may export content from 3ds Max or Blender and publish it live in their Facebook feeds.

截至2018年2月，Facebook通过glTF文件格式提供对3D帖子的支持。Verge3D用户可以从3ds Max或Blender导出内容并在其Facebook Feed中实时发布。

Creating a 3D post on Facebook is straightforward: at first, you perform export in .glb format (.glb is the binary version of the glTF), and then drag and drop this file to your Facebook post composer. Below is the detailed breakdown.

在Facebook上创建3D帖子很简单：首先，您以.glb格式执行导出（.glb是glTF的二进制版本），然后将此文件拖放到您的Facebook帖子编辑器中。以下是详细分类。

### 从3ds Max导出GLB（Export GLB from 3ds Max）

To perform export in **3ds Max**, go to the Verge3D menu and select "Export Facebook GLB...".

要在**3ds Max中**执行导出，请转到Verge3D菜单并选择“导出Facebook GLB ...”。

![](https://www.soft8soft.com/docs/files/facebook-3d-posts/export-glb-max1.jpg)

In the appeared file dialog, choose the export path and click **Save**.

在出现的文件对话框中，选择导出路径，然后单击“ **保存”**。

![](https://www.soft8soft.com/docs/files/facebook-3d-posts/export-glb-max2.jpg)

### 从Blender导出GLB（Export GLB from Blender）

To perform export in **Blender**, go to "File > Export" and select the "Facebook GLB (.glb)" option. The generic GLB-export option "Verge3D glTF Binary (.glb)" will also work but will produce slightly less optimized files.

要在**Blender中**执行导出，请转到“文件>导出”，然后选择“Facebook GLB（.glb）”选项。通用GLB导出选项“Verge3D glTF二进制（.glb）”也可以工作，但会产生略微不太优化的文件。

![](https://www.soft8soft.com/docs/files/facebook-3d-posts/export-glb-blender.png)

### 在Facebook撰写3D帖子（Compose 3D Post in Facebook）

Now you can just drag and drop the GLB file to your Facebook post.

现在，您只需将GLB文件拖放到Facebook帖子即可。

![](https://www.soft8soft.com/docs/files/facebook-3d-posts/post-fb.png)

In the Facebook post composer you can also choose the background to your liking.

在Facebook post composer中，您还可以根据自己的喜好选择背景。

![](https://www.soft8soft.com/docs/files/facebook-3d-posts/3d-post-example.png)

Check it out how it looks on Facebook: [link](https://www.facebook.com/soft8soft/posts/2003080113280076). The source file for this model can be found in your Verge3D installation inside the "applications" folder (see below in "Starter files").

看看它在Facebook上的样子：[链接](https://www.facebook.com/soft8soft/posts/2003080113280076)。可以在“applications”文件夹中的Verge3D安装中找到此模型的源文件（请参阅下面的“Starter files”）。

### 入门文件（Starter Files）

We provide a sample Verge3D project that has been configured with the necessary export settings, for both 3ds Max and Blender. The starter project contains exactly the same environment map that is used by Facebook for maximum consistency.

我们提供了一个示例Verge3D项目，该项目已针对3​​ds Max和Blender配置了必要的导出设置。入门项目包含与Facebook使用的完全一致的环境贴图。

![](https://www.soft8soft.com/docs/files/facebook-3d-posts/facebook-ready-asset-file-blender.jpg)

It can be found inside the Verge3D [distribution](https://www.soft8soft.com/get-verge3d/), located "applications/fb\_max" (3ds Max) or "applications/fb" (Blender).

它可以在Verge3D [发行版中](https://www.soft8soft.com/get-verge3d/)找到，位于“applications / fb\_max”（3ds Max）或“applications / fb”（Blender）。

### 技术要求（Technical Requirements）

* Facebook requires your GLB to be under 3Mb in total, the smaller the better.

* glTF-compliant PBR materials ([3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material.html), [Blender](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material-Blender.html)) are only supported - consider converting your materials if it is not the case.

* PNG or JPEG files must be used for textures, and must be power-of-2 in each dimension (256x512 is ok, for example).

* Textures can be up to 4k, although Facebook developers recommend keeping them under 2k.

* Facebook要求你的GLB总量低于3Mb，越小越好。

* 仅支持 符合glTF标准的PBR材质（[3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material.html)，[Blender](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material-Blender.html)） - 如果不是这种情况，请考虑转换材质。

* PNG或JPEG文件必须用于纹理，并且每个维度必须为2的幂（例如256x512就可以）。

* 纹理可以达到4k，尽管Facebook开发者建议将它们保持在2k以下。

### 优化提示（Optimization Tips）

Here are some recommendations on how to keep your GLB file below 3 Mb yet to have decent graphics.

* Prefer JPEG textures over PNG when you don't need transparency.
* Consider finding an optimal compression ratio for the JPEG files.
* Clean your asset files from any unused data. This includes auxiliary objects, animation and shape keys (which are not currently supported by Facebook anyway), unused vertex colors, UVs, etc.

这里有一些关于如何保持你的GLB文件低于3 Mb尚未拥有体面图形的建议。

* 当您不需要透明度时，首选PNG纹理。
* 考虑为JPEG文件找到最佳压缩比。
* 从任何未使用的数据中清除资产文件。这包括辅助对象，动画和形状键（无论目前还不支持Facebook），未使用的顶点颜色，UV等。


# AR 和VR的开发

AR/VR Development 待校订

Verge3D允许创建基于Web的增强现实（AR）和虚拟现实（VR）体验，这些体验运行在开发中的浏览器技术之上，称为WebXR（Web上的eXtended Reality）。

### 配置

#### VR支持

我们建议在App Manager中的应用创建设置中启用**Legacy VR**选项，以支持更广泛的设备。![](https://www.soft8soft.com/docs/files/ar-vr-development/legacy-vr-app-creation-settings.jpg)

纸板设备应该可以在Android和iOS上的任何移动浏览器中开箱即用。

[Google Daydream](https://vr.google.com/daydream/)适用于Android手机上的稳定Chrome浏览器，并在chrome：// flags页面上启用了某些WebXR选项：![](https://www.soft8soft.com/docs/files/ar-vr-development/chrome-mobile-webxr-flags.jpg)

HTC Vive和Oculus设备可在稳定的Chrome和Firefox浏览器中使用。此外，Chrome浏览器需要在chrome：// flags页面上启用某些WebXR选项：![](https://www.soft8soft.com/docs/files/ar-vr-development/chrome-desktop-webxr-flags.jpg)

#### AR支持

目前WebXR规范正在快速发展，浏览器预览版本每天都在变化。鉴于此，我们决定禁用AR功能，直到规范稳定为止。

#### WebXR Origin Trial

您可以使用所谓的**原始试用令牌**在用户启动应用时自动激活**标记**，而不是在Chrome浏览器中启用WebXR标记。您可以在[此处](https://github.com/GoogleChrome/OriginTrials/blob/gh-pages/developer-guide.md)所述的网站域中请求使用这些令牌。`<meta http-equiv="origin-trial" content="Aop1aS3O0LG/MKmDbfhMRdlXGxB1ET...rJJScdLSaYLDCMJI5iOLQ0uwhBObX0=">`

App Manager中提供 的**标准**应用程序模板已包含Verge3D Network域**cdn.soft8soft.com**的原始试用令牌。

#### HTTPS

WebXR需要安全的上下文。Verge3D应用程序必须通过HTTPS / SSL或localhost URL提供。

### 创建VR应用程序

只需[2个谜题](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#init_vr_mode)就可以为任何Verge3D应用设置VR模式。![](https://www.soft8soft.com/docs/files/ar-vr-development/minimal-vr-puzzles.jpg)

通过使用为没有控制器（例如纸板）的VR设备自动提供的基于注视的标线指针来执行与3D对象的交互。![](https://www.soft8soft.com/docs/files/ar-vr-development/gaze-based-reticle-pointer.jpg)

对于具有控制器的 VR设备，通过从控制器铸造的虚拟光线执行交互（仅支持一条光线）。![](https://www.soft8soft.com/docs/files/ar-vr-development/google-daydream-vr-controller.jpg)

您可以[在悬停时](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#when_hovered)或[单击](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#when_clicked)谜题[时](https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#when_hovered)使用标准来捕获用户事件。在**点击时**拼图在2秒的互动之后触发。

### 其他链接

* [WebXR设备API解释](https://github.com/immersive-web/webxr/blob/master/explainer.md)
* [WebXR样本](https://immersive-web.github.io/webxr-samples/)
* [WebXR设备API规范](https://immersive-web.github.io/webxr/)
* [Chrome浏览器开发跟踪器](https://bugs.chromium.org/p/chromium/issues/list?can=1\&q=component%3ABlink%3EWebXR\&sort=-modified\&colspec=ID+Pri+M+Stars+ReleaseBlock+Component+Status+Owner+Summary+OS+Modified\&x=m\&y=releaseblock\&cells=ids)


# Wordpress插件

Wordpress Plugin 待校订

从版本2.7开始，Verge3D附带了一个WordPress插件，这是目前最流行的内容管理系统（CMS）（超过6000万次安装）。

Verge3D WordPress插件提供以下功能：

* 应用程序托管和发布（嵌入）。
* 用于处理客户订单的标准电子商务系统，使用地点订单拼图提交。
* 完全可定制的电子商务系统，用于处理由发送数据拼图以JSON格式提交的订单。

这些功能可以相互独立工作。例如，您可能只想要嵌入，或者您可以处理从其他地方托管的Verge3D应用程序（例如Verge3D网络等）接收的订单。

### 安装

在安装此插件之前，请确保至少拥有WordPress 4.7。要在服务器上传应用程序，您需要拥有一个现代化的浏览器，例如Google Chrome，Firefox，Edge或Safari 11.1+。

请按照以下步骤安装Verge3D插件：

* 通过Wordpress管理界面从*verge3d / wordpress / verge3d.zip*上传插件存档。
* 在**插件**菜单中激活插件。**Verge3D**菜单应出现在管理面板中。

或者，在官方WordPress.org [存储库中](https://wordpress.org/plugins/verge3d/)找到Verge3D插件，并将其安装/激活为任何其他WP插件。

尝试上传部分应用或创建测试订单，以验证插件是否正常工作。

请注意，您的WordPress服务器配置可能具有严格的上传限制。如果您在上传应用程序时遇到麻烦，可能需要在*php.ini*文件中调整以下设置：`upload_max_filesize = 100M max_file_uploads = 100`

### 添加和管理应用程序

使用**Applications**管理菜单访问**Verge3D Applications**屏幕：![](https://www.soft8soft.com/docs/files/wordpress/app.png)

要上传您的应用，请单击应用程序标题下的**编辑**，单击**选择文件**，然后在**更新Verge3D应用程序**表单中选择一个应用程序文件夹：![](https://www.soft8soft.com/docs/files/wordpress/update_app.png)

在此表单上，您还可以配置应用程序的iframe（画布）大小，并使用全屏模式允许/拒绝。

要在WordPress页面/帖子中嵌入Verge3D应用程序，请使用以下短代码：`[verge3d id="YOUR_APP_ID"]`

其中*YOUR\_APP\_ID*是**Verge3D应用程序**屏幕上表格中显示的应用程序的ID 。

### 接收基本订单

要处理由Verge3D应用程序发送的常规订单（通过“下订单”拼图），请使用以下短代码向您的某些WordPress页面/帖子添加订单：`[verge3d_order]`

然后指定该页面/帖子的链接作为“下订单”拼图的“发送到”参数。每次执行此拼图时，您的应用都会将用户重定向到您的订单：![](https://www.soft8soft.com/docs/files/wordpress/order_form.png)

### 管理订单

使用**电子商务**管理菜单访问**电子商务订单**屏幕：![](https://www.soft8soft.com/docs/files/wordpress/orders.png)

此列表中的订单是在收到Verge3D应用程序的请求时自动创建的。您可以使用此屏幕查看和管理客户订单。

### 插件设置

使&#x7528;**“设置”**&#x7BA1;理菜单修改插件全局设置：![](https://www.soft8soft.com/docs/files/wordpress/settings.png)

**订单通知电子邮件**选项用于指定负责管理订单的人员的电子邮件地址。当客户下新订单时，您将在此电子邮件中收到有关此订单的通知。

**订购电子邮件“发件人”**&#x9009;项用于指定负责与客户通信的个人/组织的名称/电子邮件。这可以是销售经理的电子邮件，一些常见的地址，如*s<ales@yourcompany.com>，*&#x6216;者只是一个无回复的地址，&#x5982;*<noreply@yourcompany.com>*。

### 高级电子商务应用程序

在某些情况下，您可能希望扩展电子商务系统的功能。例如，如果您开发3D配置器或需要客户端的更多信息来正确处理订单，则需要向请求添加更多数据以及在服务器上处理此数据。对于这种情况，您需要使用“发送数据”谜题以JSON格式对数据进行编码，然后为您的电子商务系统创建自定义模板表单。

假设您要创建基本表自定义程序。这就是您的数据的样子：`{ "width": 120, "length": 150, "height": 100, "color": "Redwood", "title": "Custom Table", "price" 100, "user_name", "John Smith", "user_email", "john.smith@example.com", "user_phone", "+123456789" }`

您可以使用字典拼图构建此结构，然后使用“发送数据”拼图将其发送到服务器。之后，您需要为订单管理管理页面创建自定义模板，以及将发送给您的客户和销售人员的电子邮件。为此，请将以下源模板复制到**verge3d**子目录下的WP主题目录中：`WORDPRESS/wp-content/plugins/verge3d/templates/order_admin_form.php WORDPRESS/wp-content/plugins/verge3d/templates/order_email_body.php`

WORDPRESS是WordPress安装的根目录。根据为您的订单指定的结构编辑这些文件。

最后一部分是为“发送数据”拼图分配正确的URL。这个看起来像：`https://HOSTNAME/wp-json/verge3d/v1/place_order/`

其中HOSTNAME是WordPress服务器的主机名，例&#x5982;*[www.soft8soft.com](http://www.soft8soft.com)*

### 电子商务协议规范

“下订单”拼图使用基本协议来处理订单。使用带有以下参数的HTTP POST请求从浏览器向服务器发送订单：

| POST参数          | 描述                                                                      |
| --------------- | ----------------------------------------------------------------------- |
| v3d\_title      | 订单标题。该字段用于描述订单。由于该值对客户没用，因此仅供负责处理订单的人使用。                                |
| v3d\_content    | 订单内容。此文本字段包含完整的订单信息，并且对客户和销售经理都可见。                                      |
| v3d\_price      | 订单总价。它可以是数字或字符串，例如99.99.99，“99.99美元”。                                   |
| v3d\_screenshot | 订购截图。此可选值必须是表示图像的数据URI。该值由**HTMLCanvasElement.toDataURL（）**&#x65B9;法生成。 |

更高级的基于JSON的协议使用以下一组默认参数：

| JSON字段        | 描述                                                                      |
| ------------- | ----------------------------------------------------------------------- |
| title         | 订单标题。该字段用于描述订单。由于该值对客户没用，因此仅供负责处理订单的人使用。                                |
| price         | 订单总价。它可以是数字或字符串，例如99.99.99，“99.99美元”。                                   |
| user\_name    | 客户的全名。                                                                  |
| USER\_EMAIL   | 客户的电子邮件地址。                                                              |
| USER\_PHONE   | 客户的电话号码。                                                                |
| USER\_COMMENT | 订单评论。                                                                   |
| screenshot    | 订购截图。此可选值必须是表示图像的数据URI。该值由**HTMLCanvasElement.toDataURL（）**&#x65B9;法生成。 |

由于此协议是可扩展的，您可以添加所需的任何参数，例如其他配置选项，产品属性，送货地址，账单信息，税金，折扣等。


# 使用JavaScript

Using JavaScript 待校订

## 在Verge3D应用程序中使用JavaScript

借助于Puzzles，您可以实现典型WebGL应用程序中的大多数功能，而无需编写任何代码。但是，可能存在一些特殊情况，您可能希望使用JavaScript - 例如，利用第三方编程库或实现一些无法通过Puzzles单独实现的非平凡功能。

您可以使用任何文本编辑器添加JavaScript代码，但如果您的编辑器支持语法高亮和行编号（例如Notepad ++或Atom），则工作更方便。

* 方法＃1（基础）
* 方法＃2（多功能）
* 方法＃3（Сompact）
* 方法＃4（硬核）

＃

### 方法＃1（基础）

假设您使用App Manager（使用默认配置选项）创建了应用程序，并将其命名为**my\_awesome\_app**。转到verge3d / applications文件夹，然后转到my\_awesome\_app文件夹，并使用您喜欢的文本编辑器打开JavaScript文件my\_awesome\_app.js。

搜索“runCode” - 文件中的这个位置应该如下所示：`function runCode(app) { // add your code here, e.g. console.log('Hello, World!'); }`

您可以在该声明中添加一些代码（在大括号之间），以便它转到：`function runCode(app) { // add your code here, e.g. console.log('Hello, World!'); console.log('Just added some JavaScript!'); }`

现在，如果您保&#x5B58;**.js**文件并运行您的应用程序，您将注意到......除非您打开浏览器控制台。后者通常可以使用F12键打开（Chrome，Firefox，Windows，Linux）。在Mac上，使用Chrome中的View> Developer> JavaScript Console菜单（Option-Cmd-J），或Safari中的Develop> Show Error Console菜单（Option-Cmd-C）。![](https://www.soft8soft.com/docs/files/using-javascript/basics-console-log.jpg)

使用代码，您可以更改场景中的某些内容，例如，移动默认的Verge3D立方体（在3ds Max中命名为“Box001”，在Blender中命名为“Cube”）...`function runCode(app) { var obj = app.scene.getObjectByName('Cube'); obj.position.x = 2; }`

......或者凭空创造一种新材料：`function runCode(app) { var obj = app.scene.getObjectByName('Cube'); obj.material = new v3d.MeshPhongMaterial({ color: '#00BB00', emissive: '#550000' }); }`![](https://www.soft8soft.com/docs/files/using-javascript/basics-change-material.jpg)

查看[Verge3D代码示例](https://cdn.soft8soft.com/demo/examples/index.html)以获得灵感。单击“ **查看源”**&#x6309;钮以打开示例的代码。![](https://www.soft8soft.com/docs/files/using-javascript/basics-code-examples.jpg)

＃

### 方法＃2（多功能）

在**runCode**函数中添加代码使其在应用程序加载时执行，一劳永逸。但是，如果您需要通过用户操作触发某些代码，该怎么办？例如，用户点击3D对象，该对象应该发生一些事情。

通过Puzzles的一些帮助，而不是纯代码，可以更轻松地实现这种情况。您可以使用Puzzles设置捕获用户事件，并仅使用代码执行特殊操作。这种方法可以为您节省大量时间。

打开应用程序**的.js**文件（例如，my\_awesome\_app.js位于verge3d /应用/ my\_awesome\_app用你喜欢的文本编辑器）。搜索“prepareExternalInterface”并在该声明中添加一个函数（在大括号之间），使它看起来像这样：`function prepareExternalInterface(app) { app.ExternalInterface.myJSFunction = function() { console.log('Running my JavaScript function!'); } }`

正如您所看到的，该函数已添加到**app.ExternalInterface**命名空间中 - 这对于Puzzles来说是非常重要的。如果需要，可以向此命名空间添加具有不同名称的更多函数。

您现在可以从谜题中触发名为“myJSFunction”的功能。为此，运行Puzzles编辑器并将拼图**调用JS函数**添加到工作区。默认情况下，它将触发名为“myJSFunction”的函数，因此如果您的函数名称不同，请确保在此谜题的文本字段中更改其名称。![](https://www.soft8soft.com/docs/files/using-javascript/external-interface-adding.jpg)

现在，如果你保存你的谜题并运行你的应用程序，谜题场景应该触发你添加的功能，并且消息应该出现在浏览器控制台中。![](https://www.soft8soft.com/docs/files/using-javascript/external-interface-running.jpg)

可以添加更多拼图，使您的功能仅在用户单击对象时运行。![](https://www.soft8soft.com/docs/files/using-javascript/external-interface-click.jpg)

如果您想将参数从谜题传递给JavaScript函数（例如，用户单击的对象的名称），您可以通过向其添加输入套接字来修改**调用JS函数**谜题。![](https://www.soft8soft.com/docs/files/using-javascript/external-interface-parameter.jpg)

还应修改代码以使函数接受参数作为其参数：`function prepareExternalInterface(app) { app.ExternalInterface.myJSFunction = function(myObject) { console.log(myObject); } }`

因此，将以编程方式生成的材质分配给所选对象的代码段可能如下所示：`function prepareExternalInterface(app) { app.ExternalInterface.myJSFunction = function(myObject) { var obj = app.scene.getObjectByName(myObject); obj.material = new v3d.MeshPhongMaterial({ color: '#00DD00', emissive: '#880000' }); } }`

＃

### 方法＃3（Сompact）

这种方法适合有经验的程序员，他们希望开始时只需要一个最小的工作代码片段。

创建新应用程序时，将“ **应用程序类型”**&#x9009;择器切换&#x4E3A;**“基于代码”**：![](https://www.soft8soft.com/docs/files/using-javascript/creating-code-based-app.jpg)

这将导致一个更简单的项目结构，没有Puzzles编辑器连接到您的应用程序，app **.js**文件将只包含几行代码：`'use strict'; window.addEventListener('load', function() { var app = new v3d.App('container', null, new v3d.SimplePreloader({ container: 'container' })); var url = 'my_awesome_app.gltf'; app.load(url, function() { app.enableControls(); runCode(); }); function runCode() { // add your code here, e.g. console.log('Hello, World!'); } });`

这种类型的应用程序非常简单，但它们仍然能够&#x4EE5;**.gltf**格式加载场景（带预加载器），并为用户提供标准的摄像机控制。

您可以按照方法＃1中的描述在“runCode”函数中添加代码。当然，您可以完全彻底检修此应用程序模板 - 例如，您可以丢弃App类，使用其他一些文件格式加载场景或以某种特定方式设置控件。

＃

### 方法＃4（硬核）

你可以把**v3d.js**从文件verge3d /建立文件夹，将其链接到一个**html的**文件，并[开始编码](https://www.soft8soft.com/docs/manual/en/introduction/Programming-basics.html)！您是如何认为[代码示例](https://cdn.soft8soft.com/demo/examples/index.html)首先创建的？


# 移动浏览器测试

Testing on Mobile Browsers 待校订

## 在移动浏览器上测试Verge3D应用程序

从App Manager启动Verge3D应用程序时，它使用**localhost**地址在本地开发服务器上运行。此地址只能在本地计算机上使用。为了测试您的应用在移动设备的浏览器上的工作方式，您可以使用以下过程之一。

* 方法＃1：本地IP地址
* 方法＃2：本地IP地址+ QR码
* 方法＃3：端口转发

＃

### 方法＃1：本地IP地址

使用任何文本编辑器 打开Python脚本verge3d / manager / server.py。找到以**ADDRESS**开头的行- 文件中的这个位置应该如下所示：`ADDRESS = 'localhost' #ADDRESS = '0.0.0.0'`

从第二行（取消注释）中删除哈希符号＃，制作它`ADDRESS = 'localhost' ADDRESS = '0.0.0.0'`

保存文件并重新启动3ds Max或Blender。

现在，您可以在本地Wi-Fi或以太网网络中使用IP地址，而不是**localhost**。您可以从操作系统首选项中找到您的计算机IP地址：[Windows 10](https://www.groovypost.com/howto/find-windows-10-device-ip-address/)，[Windows 7](https://www.groovypost.com/howto/microsoft/windows-7/find-your-local-ip-address-windows-7-cmd/)，[Mac](https://www.wikihow.com/Find-Your-IP-Address-on-a-Mac)，[Linux](https://www.linuxtrainingacademy.com/determine-public-ip-address-command-line-curl/)。通过导航到网络地址，在移动设备的Web浏览器上启动App Manager，例如：

```
http://192.168.0.2:8668/
```

最后，像往常一样在移动设备上运行应用程序 - 通过在应用管理器中点击蓝色图标。

＃

### 方法＃2：本地IP地址+ QR码

这是方法＃1的变体。您可以使用网络地址通过App Manager 在计算机上启动应用程序，而不是在移动设备的浏览器上运行App Manager和应用程序。

```
http://192.168.0.2:8668/
```

可以使用QR码在移动设备上方便地打开应用程序的链接。您需要在计算机的浏览器中安装QR代码扩展，例如，[QR Code Generator for Chrome](https://chrome.google.com/webstore/detail/the-qr-code-generator/gcmhlmapohffdglflokbgknlknnmogbb?hl=en)或[QRify for Safari](https://safari-extensions.apple.com/details/?id=de.retiolum.safari.qrify-RSADU6MKX9)。![](https://www.soft8soft.com/docs/files/testing-mobile-browsers/qr-code-extention-chrome.jpg)

可以使用移动设备的相机扫描获得的QR码，从而在移动浏览器上打开链接。您需要先在移动设备上安装QR扫描仪应用程序，例如，[Android的QR码阅读器](https://play.google.com/store/apps/details?id=tw.mobileapp.qrcode.banner\&hl=en)或[iPhone的QR阅读器](https://itunes.apple.com/au/app/qr-reader-for-iphone/id368494609?mt=8)。

＃

### 方法＃3：端口转发

此方法适用于Android设备。使用USB线和Chrome DevTools，您可以直接从移动设备的浏览器启动App Manager，导航到localhost：8668。

与方法1-2不同，此方法适用于启动AR / VR应用程序，因为localhost不需要移动浏览器和工作站之间的安全连接。此外，您还可以看到移动浏览器控制台的输出。

在Android设备上，转到**设置>开发人员选项**并启用**USB调试**。

```
By default, the developer options in Android devices are hidden. You can unlock them by locating the Build number in your Settings menu and tapping it multiple times.
```

![](https://www.soft8soft.com/docs/files/testing-mobile-browsers/android-developer-options.jpg)

使用USB线连接Android设备。在计算机上的Chrome浏览器中，导航到chrome：// inspect。![](https://www.soft8soft.com/docs/files/testing-mobile-browsers/chrome-inspect.jpg)

这应该会在您的Android设备上显示一个对话框弹出窗口 - 如果没有，请重新加载chrome：//检查或重新插入USB连接线。在弹出窗口中，点击OK即可进行USB调试。![](https://www.soft8soft.com/docs/files/testing-mobile-browsers/android-usb-debugging.jpg)

您现在应该在chrome：// inspect页面上看到您的Android设备。此外，如果您在移动设备上打开Chrome，则应在此处列出。![](https://www.soft8soft.com/docs/files/testing-mobile-browsers/chrome-inspect2.jpg)

单击chrome：// inspect页面上的**Port forwarding**按钮。在显示的窗口中：在**Port**字段中，键入8668，在**IP地址和端口**字段中，键入localhost：8668。单击“ **启用端口转发”**&#x5E76;使&#x7528;**“完成”**&#x6309;钮关闭窗口。![](https://www.soft8soft.com/docs/files/testing-mobile-browsers/chrome-port-forwarding.jpg)

该铬：//检查页面应该显示设备附近的端口转发的绿色指示灯。![](https://www.soft8soft.com/docs/files/testing-mobile-browsers/chrome-port-forwarding2.jpg)

因此，您应该可以通过导航到localhost：8668直接从移动设备的浏览器启动App Manager 。此外，您可以通过单击chrome：// inspect页面上的**inspect**链接来**查看**移动浏览器控制台的输出。


# 3ds Max安装Verge3D​

Installation 已完成

正确安装Verge3D后，其可在Autodesk 3ds Max 2019 \~ 2015版本中运行。如果您还没有购买该软件，可以在Autodesk[官方网站](https://www.autodesk.com/products/3ds-max/free-trial)下载试用版，或者使用Verge3D for Blender作为替换。

### 下载并运行Verge3D安装文件

下载[Verge3D安装文件](https://www.soft8soft.com/get-verge3d/)，运行后请指定安装目录，请确保您对该目录有读写权限。不推荐安装到诸如“Program Files”之类的系统目录。

![](https://www.soft8soft.com/docs/files/installation_3ds_max/installer-max-auto-configure.jpg)

当安装完成后，请务必**重新打开3ds Max**。您将会在主菜单栏中看到“Verge3D”。

![](https://www.soft8soft.com/docs/files/installation_3ds_max/installation_3ds_max_complete.jpg)

### 手动配置插件路径

如果您在安装过程中禁用&#x4E86;**“自动配置（Auto-Configure）”**，或安装了最新版的3ds Max，或在安装完成后切换了Windows用户，您需要按照以下步骤配置插件路径。

运行3ds Max，选&#x62E9;**“自定义（Customize）”**&#x83DC;单下的“配置系统路径…（Configure System Paths...）”。

![](https://www.soft8soft.com/docs/files/installation_3ds_max/installation_3ds_max1.png)

切换&#x5230;**“第三方插件（3rd Party Plug-ins）”**&#x6807;签，并点击“添加…（Add...）”按钮。

![](https://www.soft8soft.com/docs/files/installation_3ds_max/installation_3ds_max2.png)

导航至Verge3D安装目录，打开“max\_plugin”文件夹，并点击“使用路径（Use Path）”按钮。

![](https://www.soft8soft.com/docs/files/installation_3ds_max/installation_3ds_max3.png)

点击“确定（OK）”并**重新打开3ds Max**。

![](https://www.soft8soft.com/docs/files/installation_3ds_max/installation_3ds_max4.png)

### 故障排除

### Troubleshooting

在某些情况下，Verge3D菜单可能不会自动出现在主菜单栏中。如若如此，您需要手动注册该菜单。点击3ds Max中的“工具Utilities”标签，点击“MaxScript”按钮并在下拉菜单中选择“Verge3D”，然后点击“注册Verge3D菜单”。

![](https://www.soft8soft.com/docs/files/installation_3ds_max/installation_3ds_max-registering_manually.jpg)

### 下一章

[熟悉基础知识](/)


# 材质系统

Material Systems ——fastest已校订

Verge3D支持3ds Max中提供的以下类型的材质：

* 以ART渲染器为参考的物理材质(Physical with ART as reference 要求3ds Max 2017或更高版本）
* 以扫描线渲染器为参考的标准材质(Standard with Scanline as reference)
* glTF兼容的物理材质（Physical glTF-compliant 要求3ds Max 2017或更高版本）

＃

### 物理材质(Physical materials)

物理材质可在3ds Max 2017或更高版本中使用。它们比标准材质更逼真，同时更易于使用。它们特别适用于表示金属和其他非平凡表面。Verge3D使用Autodesk ART渲染器作为参考，努力重现物理材质。

![](https://www.soft8soft.com/docs/files/material-system-max/physical-material-example.jpg)

![](https://www.soft8soft.com/docs/files/material-system-max/physical-material.jpg)

您可以使用“环境和效果”窗口设置环境纹理。

![](https://www.soft8soft.com/docs/files/material-system-max/environment.jpg)

大多数3ds Max的物理材质预设都可以与Verge3D一起使用。

![](https://www.soft8soft.com/docs/files/material-system-max/physical-material-presets.jpg)

可以使用**拼图(Puzzles)、Float**或**Point4**材质控制器的代码对材质参数进行动画处理或更改。

![](https://www.soft8soft.com/docs/files/material-system-max/texture-atlas-animated.jpg)

＃

### 标准材质(Standard materials)

这些是3ds Max中的默认材质，非常适合视口显示。Verge3D努力使用Autodesk Scanline渲染器作为参考来重现它们。

![](https://www.soft8soft.com/docs/files/material-system-max/standard-material-example.jpg)

标准材质具有足够的灵活性和功能，可用于创建各种设置。

![](https://www.soft8soft.com/docs/files/material-system-max/standard-material.jpg)

可以使用Puzzles或使用Float或Point3材质控制器的代码对材质参数进行动画处理或更改。

＃

### glTF兼容材质(glTF-compliant materials)

如果您的内容由于某种原因需要与[glTF 2.0标准](https://www.khronos.org/news/press/khronos-releases-gltf-2.0-specification)兼容（例如在Facebook上发布您的模型），您可以使用物理材质来实现此目的，如下所述。

根据glTF 2.0标准，材质信息以一组纹理编码：基色，遮挡 - 粗糙 - 金属分别包装在R，G和B通道中，并且是正常的。

![](https://www.soft8soft.com/docs/files/material-system-max/gltf-physical-material-example.jpg)

但是，您必须使用单独的位图来遮挡，粗糙和金属。Verge3D会在导出时自动将它们组合在一个纹理中。确保在材质设置面板中启用**glTF 2.0兼容**复选框。

![](https://www.soft8soft.com/docs/files/material-system-max/gltf-physical-material.jpg)

有关如何设置这些材质的更多信息， 请参阅本用户手册的[物理材质](https://www.soft8soft.com/docs/manual/en/introduction/Physical-material.html)部分。


# 阴影

Shadows ——fastest已校订

下面介绍了在3ds Max的Verge3D中设置漂亮的实时阴影的设置和最佳实践。

![](https://www.soft8soft.com/docs/files/shadows-max/shadows-example.jpg)

### 灯光设置(Per-Light Settings)

可以使用3ds Max的本机面板为每个单独的灯启用/禁用阴影。支持的阴影设置以绿色突出显示。<br>

<div align="center"><img src="https://www.soft8soft.com/docs/files/shadows-max/shadow-settings-perlight-max.jpg" alt=""></div>

必须启用 复选框**On，**&#x5E76;且必须在下拉列表中选择**阴影贴图(Shadow Map)**，以便在Verge3D中显示阴影。

**衰减/场(Falloff/Field)**&#x5B9A;义阴影体积（越少越好）。

**偏差(Bias)**&#x53EF;以调整，直到你摆脱自我阴影瑕疵和/或彼此平移效果。

**大小(Size)**&#x63A7;制阴影纹理有多大（在速度和质量之间交易）。

**样本范围(Sample Range)**&#x63A7;制阴影的模糊比。

**绝对地图偏差(Absolute Map Bias)**&#x53EF;以根据场景大小独立计算**偏差**。

### 对象设置(Per-Object Settings)

您还可以基于per-object启用和禁用接收和投射阴影。

![](https://www.soft8soft.com/docs/files/shadows-max/object-properties.jpg)

![](https://www.soft8soft.com/docs/files/shadows-max/shadows-per-object-settings.jpg)

您可以查看以下[视频，](https://www.youtube.com/watch?v=ItsmBFa3lU0)了解如何在3ds Max中设置阴影。

有关更多信息和最佳实践，另请参见Autodesk的官方[文档](https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/3DSMax/files/GUID-4BF878CD-5BD6-4F1A-A20B-8A6BD7D3703B-htm.html)。


# 物理材质

Physical Material ——fastest已校订

## 物理材质（Physical material、符合glTF标准的PBR）&#x20;

如果您的内容由于某种原因需要与[glTF 2.0标准](https://www.khronos.org/news/press/khronos-releases-gltf-2.0-specification)兼容（例如在Facebook上发布您的模型），您可以使用物理材料来实现此目的，如下所述。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_00.png)

### 设置(Setting up)

添加**物理材质(Physical Material)**&#x7740;色器节点，如下所示：转到**材质/贴图浏览器(Materials/Map Browser)，**&#x7136;后从**常规材质(General material)**&#x5217;表中选择 **物理材质(Physical Material)** 。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_02.png)

然后，您可以将纹理节点连接到**物理材质(Physical Material)**，如下所述。请注意，所有纹理都是可选的，可以安全地省略任何纹理。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_01.png)

* 将**环境光遮蔽( Ambient Occlusion)**&#x7EB9;理连接到**基重贴图(Base Weight Map)**&#x8F93;入。为了在3ds Max视口和Verge3D之间获得更好的一致性，您还可以将**环境光遮蔽( Ambient Occlusion)**&#x8FDE;接到**反射颜色贴图(Refl Color Map)**&#x8F93;入，但这不是必需的。
* 将**基色(Base Color)**&#x7EB9;理连接到**基色图(Base Color Map)**&#x8F93;入。
* 将**粗糙度(Roughness)**&#x7EB9;理连接到**粗糙度贴图(Roughness Map)**&#x8F93;入。
* 将**金属度(Metallic)**&#x7EB9;理连接到**金属贴图(Metalness Map)**&#x8F93;入。
* 将**法线(Normal)**&#x7EB9;理连接到**法线贴图(Normal Map)**&#x8282;点，然后将其连接到**物理材质(Physical Material)**&#x7684;**凹凸贴图(Bump Map)**&#x8F93;入。您还应将**物理材质(Physical Material)**&#x7684; **特殊贴图(Special Map)**&#x9762;板中的**凹凸贴图量(Bump Map Amount)**&#x503C;设置为1.0。
* 将**发射(Emission)**&#x7EB9;理连接到**发射颜色贴图(Emission Color Map)**。您还应在**物理材质**(**Physical Material)**&#x9996;选项的**基本参数(Basic Parameters)**&#x9762;板中将排放因子设置为1.0 。
* 在**透明度(Transparency)**&#x5730;图将从**阿尔法通道(Alpha Channel)**&#x91C7;取**基色纹理(Base Color texture)**。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_03.png)

### 色彩空间和伽马校正(Color Space and Gamma Correction)

为了正确渲染，应该考虑图像的颜色空间。所有图像，除了**基本色(Base Color)**&#x548C;**排放(Emission)**&#x7EB9;理，必须在线性颜色空间呈现。要执行此操作，请在**打开图像(Open Image)**&#x5BF9;话框中打开图像时，在**伽马首选项(Gamma Preferences)**&#x4E2D;选择**Override，**&#x8BBE;置1.0值（如下所示）。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_04.png)

相反，在**基色(Base Colo)**&#x548C;**排放(Emission)**&#x7EB9;理必须sRGB色彩空间（与伽马2.2）被打开。要实现此目的，打开图像(Open Image)对话框中打开图像时，选择**自动(Automatic)**&#x9009;项即可。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_05.png)

### 透明纹理(Transparency Texture)

如果存在，引擎将自动使用**基色(Base Color)**&#x7EB9;理中的**阿尔法通道(Alpha channel)**&#x4F5C;为透明度贴图。为了使透明度3ds Max的视口可见，将包含**阿尔法**的通道的**基本颜色**纹理连接到**透明彩色贴图(Transparency Color Map)**&#x8F93;入。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_06.png)

同样在纹理的**首选项(Preferences)**&#x4E2D;，在**位图参数(Bitmap Parameters)**&#x9762;板中，您应将**单通道(Mono Channel)**&#x8F93;出设置为**阿尔法(Alpha)**，将**RGB通道(RGB Channel)**&#x8F93;出设置为**阿尔法为灰色(Alpha as Gray)。**

![](https://www.soft8soft.com/docs/files/physical-material/phmat_07.png)

### 从Substance Painter导出纹理(Exporting Textures from Substance Painter)

为了便于从Substance Painter导出纹理并确保Verge3D引擎中的最大功能，我们建议使用[Verge3D导出预设](https://www.soft8soft.com/docs/files/physical-material/Verge3D_for_3ds_Max.spexp)。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_09.png)

将此预设文件放在通常位于**My Documents \ Allegorithmic \ Substance Painter \ shelf \\**&#x6587;件夹中的**export-presets**文件夹中（如果没有则创建）。

![](https://www.soft8soft.com/docs/files/physical-material/phmat_08.png)

从Substance Painter导出纹理时，在导出对话框窗口中**为3ds Max**选择**Verge3d，**&#x4EE5;便所有生成的纹理与Verge3D基于的glTF 2.0标准兼容。


# 透明度

Transparency ——fastest已校订

在这里，我们将展示如何在3ds Max中为标准(Standard)，物理(Physical)和glTF兼容的PBR(glTF-compliant PBR)等材质启用透明度。

### 混合VS蒙版

作为实时3D引擎，Verge3D提供了两种处理透明对象的主要方法：**Alpha混合(alpha blending)**&#x548C;**Alpha剪裁(Alpha clipping、通常使用图像蒙版）**。**混合(Alpha blending)**&#x53EF;以将半透明前景色与背景色相结合，使用前景色的alpha作为混合因子。对应的，**剪裁(Alpha clipping)**&#x53EA;是丢弃所有像素小于某个预定阈值（通常为0.5）的像素。

![](https://www.soft8soft.com/docs/files/transparency-common/blending-vs-clipping.jpg)

**混合**可实现平滑过渡，通常看起来更好但计算量比**剪裁**更多。当多边形看起来以错误的顺序呈现时，它也可能产生z排序伪像。**裁剪**最适合可剪裁许多小物体（例如草或树叶）。它还会产生硬边，没有任何可能混叠的过渡。

在材质设置中 使用**Alpha模式**下拉列表在混合和蒙版之间进行选择。

![](https://www.soft8soft.com/docs/files/transparency-max/alpha-mode.jpg)

### Alpha Add（又名无深度写入）

Verge3D还提供了一种特殊模式，用于在渲染时禁用写入深度缓冲区。这导致多边形被排除在像素深度比较之外。这些多边形以Add方式合成，有时可以帮助摆脱混合伪像。

![](https://www.soft8soft.com/docs/files/transparency-common/no-depth-writes.jpg)

在**材质设置(material settings)**&#x7684;**Alpha模式(** **Alpha Mode)**&#x4E0B;拉列表中 选择**添加(Add)**&#x4EE5;启用添加**混合**。

### 标准材质的透明度(Transparency for Standard Materials)

可以使用**材质设置(material settings)**&#x4E2D;的**不透明度(Opacity)**&#x8C03;整标准材质的**透明度(Transparency)**。

![](https://www.soft8soft.com/docs/files/transparency-max/standard-simple.jpg)

**标准材质(standard materials)**&#x7684;**不透明度(Opacity)**&#x8F93;入可用于创建有趣的依赖关系，以获得更好的真实感。

![](https://www.soft8soft.com/docs/files/transparency-max/standard-falloff.jpg)

其Alpha通道中具有透明度信息的图像可用作输入。也可以使用单独的Alpha图像。

![](https://www.soft8soft.com/docs/files/transparency-max/texture-settings-standard.jpg)

使用**Alpha模式**下拉列表在透明模式之间进行选择。

### 物理材质的透明度(Transparency for Physical Materials)

可以使用相同名称的**材质设置(material settings)**&#x8C03;整物理材质的透明度，即**透明度(Transparency)**&#x8BBE;置。

![](https://www.soft8soft.com/docs/files/transparency-max/physical-transparency.jpg)

可以使用贴图和图像的任意组合通过**透明度贴图(Transparency Map)**&#x8F93;入来影响透明度。

![](https://www.soft8soft.com/docs/files/transparency-max/physical-transparency-with-map.jpg)

使用**Alpha模式**下拉列表在透明模式之间进行选择。

### 符合glTF标准的PBR材质的透明度(Transparency for glTF-compliant PBR Materials)

为了实现此类材质的透明度，应使用与物理材质的**透明度贴图**输入相关联的单独 Alpha贴图。

![](https://www.soft8soft.com/docs/files/transparency-max/gltf-pbr-transparency.jpg)

使用**Alpha模式**下拉列表在透明模式之间进行选择。


# 视口和渲染预览

Viewport and Render Preview 待校订

在本指南中，您可以了解如何配置3ds Max视口以匹配Verge3D外观，以及如何使用Scanline / ART渲染和ActiveShade功能获取参考图像。

* 视口设置
* 扫描线/ ART渲染
* ActiveShade模式

＃

### 视口设置

要在3ds Max中启用更好的视口预览，请在视口设置中从**标准**切换到**高质量**：![](https://www.soft8soft.com/docs/files/viewport-render-preview/viewport-settings.jpg)

在“ **材质”**&#x5B50;菜单中 单击“ **带有贴图的逼真材质”**（每次添加新材质时都需要执行此操作）：![](https://www.soft8soft.com/docs/files/viewport-render-preview/viewport-settings2.jpg)

在**默认着色**下的**视口背景**子菜单中 启用**环境背景**：![](https://www.soft8soft.com/docs/files/viewport-render-preview/viewport-settings3.jpg)

```
The above-mentioned settings are pre-enabled for the default cube project.
```

但是，视口着色并不总是能够提供浏览器内渲染的准确近似值 - 例如，环境反射会忽略视口中的法线贴图等。

＃

### 扫描线/ ART渲染

如果使用标准材质，Verge3D渲染尽可能接近Scanline渲染，如果使用物理材质，则尽可能接近ART渲染。因此，您可以在3ds Max中预览场景而无需导出以便更快地进行调整。

要选择渲染器，请单击“ **渲染”**&#x83DC;单中的“ **渲染设置...** ” （F10）：![](https://www.soft8soft.com/docs/files/viewport-render-preview/render-settings.jpg)

在窗口中使用“ **渲染器”**&#x4E0B;拉列表在Scanline和ART之间切换：![](https://www.soft8soft.com/docs/files/viewport-render-preview/render-settings2.jpg)

要渲染场景，请单击“ **渲染”**（Shift + Q）：![](https://www.soft8soft.com/docs/files/viewport-render-preview/render-settings3.jpg)

随后您可以使用“ **渲染”**&#x6309;钮重复渲染：![](https://www.soft8soft.com/docs/files/viewport-render-preview/render-settings4.jpg)

＃

### ActiveShade模式

为了加快迭代速度，您可以使用**ActiveShade**模式，每次修改场景时都会自动更新渲染（最适合ART渲染）。

您可以在“ **渲染设置...”**&#x7A97;口中启用ActiveShade ：![](https://www.soft8soft.com/docs/files/viewport-render-preview/activeshade.jpg)

之后，您将能够将视口切换到ActiveShade模式：![](https://www.soft8soft.com/docs/files/viewport-render-preview/activeshade2.jpg)

通过这种方式，您可以近乎实时的速度更好地逼近浏览器中的内容。


# Blender安装Verge3D

Installation 已完成

经正确安装，Verge3D可运行于开源3D建模与动画软件Blender中，支持2.79b及2.80版。您可以从[Blender官方网站](https://www.blender.org/download/)免费下载该软件。

### 下载并解压Verge3D

### Download and unpack Verge3D

下载Verge3D后，请解压至您指定的目录，请确保您对该目录有读写权限。不推荐安装到诸如“Program Files”之类的系统目录。

### 为Blender 2.79安装Verge3D

### Installation for Blender 2.79

在Blender软件中，点&#x51FB;**“文件（File）”**&#x83DC;单栏中相应的选项以调&#x7528;**“用户设置（Use Preferences）”**&#x7A97;口。

![](https://www.soft8soft.com/docs/files/installation-blender/installation_blender1.png)

在“**文件（File）**”标签中，找到“**脚本（Scripts）**”字段并使其指向安装Verge3D的文件夹。单&#x51FB;**“保存用户设置（Save User Settings）”**，关&#x95ED;**“用户首选项（User Preferences）”**&#x7A97;口并重新启动Blender。

![](https://www.soft8soft.com/docs/files/installation-blender/installation_blender2.png)

请再次打&#x5F00;**“用户设置（User Preferences）”**&#x7A97;口，转&#x81F3;**“插件（Add-ons）”**&#x6807;签。找到并启用Verge3D插件，然后点&#x51FB;**“保存用户设置（Save User Settings）”**&#x5E76;关闭窗口。

![](https://www.soft8soft.com/docs/files/installation-blender/installation_blender3.png)

安装完成！

### 为Blender 2.80 beta版安装Verge3D

### Installation for Blender 2.80 beta

在Blender软件中，点&#x51FB;**“编辑（Edit）”**&#x83DC;单下&#x7684;**“属性（Preferences）”**&#x6253;开设置窗口。

![](https://www.soft8soft.com/docs/files/installation-blender/installation_blender280_step1.jpg)

在“**文件路径（ File Paths）**”标签下，找到“脚本（Scripts）”字段，并其指定路径至Verge3D安装目录。点&#x51FB;**“保存属性（Save Preferences）”**，关闭属性窗口并重启Blender。

![](https://www.soft8soft.com/docs/files/installation-blender/installation_blender280_step2.jpg)

再次打&#x5F00;**“属性（Preferences）”**&#x7A97;口，转&#x81F3;**“插件（Add-ons）”**&#x6807;签，找到并启用Verge3D插件。然后点击“**保存属性（Save Preferences）**”并关闭该窗口。

![](https://www.soft8soft.com/docs/files/installation-blender/installation_blender280_step3.jpg)

安装完成！

### 下一步

[熟悉基础知识](/)


# 材质系统概述

Material System Overview 待校订

Verge3D支持Blender中提供的以下类型的材质：

* Eevee（仅限Blender 2.8）
* Cycles（Blender 2.7及2.8）
* 符合glTF标准的PBR材质（Blender 2.7及2.8）
* 标准内部材质（仅限Blender 2.7，已弃用）
* 基于节点的GLSL内部材质（仅限Blender 2.7，已弃用）

＃

### Eevee材质

Eevee是一款实时渲染器，目前正在开发中，作为即将推出的[Blender 2.8的一部分](https://www.blender.org/2-8/#try-it-yourself)。Eevee有望成为Verge3D未来版本的主要创作工具。

![](https://www.soft8soft.com/docs/files/material-system-blender/eevee-material.jpg)

可以使用Puzzles或使用**Value**或**RGB**节点的代码对材质参数进行动画处理或更改。

在Blender 2.8中，Cycles节点可与Eevee交换，因此如果您在Blender 2.7中工作，最好开始使用Cycles节点进行新项目。这将使未来的转换变得简单明了。

＃

### Cycles材质

Cycles是Blender的光线跟踪渲染器，可以在实时渲染引擎（如Verge3D）中重新创建。尽管如此，Verge3D中对Cycles的支持允许您在线移动现有的基于Cycles的资产，而不会遇到太大障碍。

![](https://www.soft8soft.com/docs/files/material-system-blender/cycles.jpg)

可以使用Puzzles或使用**Value**或**RGB**节点的代码对材质参数进行动画处理或更改。

截至2019年2月，Verge3D并不支持所有Cycles节点。特别是，不支持以下复杂着色器：各向异性BSDF，环境遮挡，头发BSDF，保持，原始头发BSDF，原始体积，次表面散射，Toon BSDF，半透明BSDF，天鹅绒BSDF，体积吸收和体积散射。不支持以下程序纹理：砖纹理，渐变纹理，魔术纹理，Musgrave纹理和点密度。

＃

### 符合glTF标准的PBR材质

这些材质遵循物理基材质（PBR）的[glTF 2.0标准](https://www.khronos.org/news/press/khronos-releases-gltf-2.0-specification)。根据该标准，材质信息以一组纹理编码：基色，遮挡 - 粗糙 - 金属分别包装在R, G, B通道中。

![](https://www.soft8soft.com/docs/files/material-system-blender/gltf-pbr-teapot.jpg)

在Verge3D中，符合glTF标准的PBR材质可以用基于Cycles的节点组表示，连接到PBR纹理的输入（点击下图放大）

![](/files/-Lc9hKo_er7JzZ9LsPzF)

此节点可以从存储文件**verge3d / applications / materials / pbr\_material.blend**的**NodeTree**类别中**追加**。在此过程中，确保其名称“Verge3D PBR”保持不变。

此外，虽然这不是glTF 2.0标准的一部分，但您可以将世界节点设置为环境。符合glTF标准的加载器（如Facebook News Feed）将忽略该环境。

有关如何设置符合glTF标准的PBR材质的更多信息， 请参阅[物理材质](/blender-artists-guide/physical-material)部分。

＃

### 标准材质

这些是Blender 2.7中的默认材质。它们允许调整基本设置和添加纹理。一般情况下，不建议使用标准材质，除非您做的事情很简单或只是试验。

![](https://www.soft8soft.com/docs/files/material-system-blender/standard-material.jpg)

在即将推出的Blender 2.8中，这些材质将不再可用。如果您仍然喜欢在Blender 2.7中工作，请考虑将PBR或Cycles材质用于新项目。

＃

### 基于节点的GLSL材质

这些是Blender 2.7中强大而灵活的材质。一些早期的Verge3D演示基于GLSL节点。![](https://www.soft8soft.com/docs/files/material-system-blender/glsl-material.jpg)

可以使用Puzzles或使用**Value**或**RGB**节点的代码对材质参数进行动画处理或更改。

在即将推出的Blender 2.8中，这些材质将不再可用。如果您仍然喜欢在Blender 2.7中工作，请考虑将PBR或Cycles材质用于新项目。


# 阴影

Shadows 待校订

下面介绍在Verge3D for Blender中设置漂亮实时阴影的设置和最佳实践。![](https://www.soft8soft.com/docs/files/shadows-blender/shadows-example.jpg)

### 全局设置

由于计算量很大，默认情况下禁用阴影。您可以在Verge3D设置面板的“渲染”选项卡下启用它们。![](https://www.soft8soft.com/docs/files/shadows-blender/shadow-settings-global-blender.jpg)<br>

在同一面板上，**Map Type**允许您选择阴影渲染算法 - 您可以使用此开关在速度和平滑度之间进行交换。阴影质量增加，性能按照**Basic**，**PCF**，**Soft PCF**选项的顺序递减。

**Map Side**表示在阴影过程中渲染多边形的哪一侧。在设置**偏差**时应考虑选择此选项（见下文）。

### 每灯设置

可以使用Blender的原生**阴影**面板为每个单独的灯启用/禁用**阴影**。不支持此面板中的任何其他设置。![](https://www.soft8soft.com/docs/files/shadows-blender/shadow-settings-perlight-blender.jpg)<br>

在**Verge3D设置**面板上可以找到一些每灯设置。**Size / FOV**，**Near**和**Far**可用于调整阴影音量（越少越好）。**半径**控制模糊比，**地图大小**- 阴影纹理有多大（速度和质量之间的交易）。

**偏见**可以是正面的也可以是负面的。选择什么取决于上面提到的**Map Side**设置。如果**正面**被选中，正面**偏置**应该足够了（相反，**背面** -负）。调整**偏见**直到你摆脱自我阴影瑕疵和/或彼此平移效果。

您还可以查看以下[视频，](https://www.youtube.com/watch?v=BqK5ZK0W4xc)了解如何在Blender中设置阴影。


# 物理材质

Physical Material 待校订

## 物理材质（符合glTF标准的PBR）

如果您的内容由于某种原因需要与[glTF 2.0标准](https://www.khronos.org/news/press/khronos-releases-gltf-2.0-specification)兼容（例如在Facebook上发布您的模型），您可以使用物理材料来实现此目的，如下所述。

### 配置

Blender中的物理材料由名为**Verge3D PBR**的基于Cycles的节点组**提供**。![](https://www.soft8soft.com/docs/files/physical-material-blender/phmat_00.png)

您可以将完整的PBR材料或**Verge3D PBR**节点组添加到项目中，如下所示：选择**File> Append，**&#x7136;后转&#x5230;**/applications/materials/pbr\_material.blend**文件。![](https://www.soft8soft.com/docs/files/physical-material-blender/phmat_01.png)

然后从**Material**类别中选择**Verge3D PBR**材料，或者从**NodeTree**类别中选择**Verge3D PBR**节点组。![](https://www.soft8soft.com/docs/files/physical-material-blender/phmat_02.png)

您可以将纹理节点连接到**Verge3D PBR**节点，如下所述。请注意，所有纹理都是可选的，可以安全地省略任何纹理。![](https://www.soft8soft.com/docs/files/physical-material-blender/phmat_03.png)

* 将**BaseColor**纹理连接到**Verge3D PBR**节点的**BaseColor**输入。纹理的**颜色空间**必须设置为“ **颜色”**。
* 将**OcclusionRoughnessMetallic**纹理连接到**Verge3D PBR**节点的**MetallicRoughness**和**Occlusion**输入。为了优化加载和渲染PBR着色器，您应该将遮挡，粗糙度和金属纹理分别打包到单个纹理的R，G和B通道中。当您仅包装粗糙度和金属纹理并保持遮挡时，也可以使用变体。此纹理的“ **颜色空间”**&#x8BBE;置必须设置为“ **非颜色”**。
* 将**NormalMap**纹理连接到**Verge3D PBR**节点的**Normal**输入。纹理的**颜色空间**必须设置**为非颜色**。
* 将**自发光**纹理连接到**Verge3D PBR**节点的**自发光**输入。纹理的**颜色空间**必须设置为“ **颜色”**。
* 将**BaseColor**纹理的**Alpha**输出连接到**Verge3D PBR**节点的**Alpha**输入。要为材质启用透明度，必须在**BaseColor**纹理的Alpha通道中打包透明度图- 将其连接到**Alpha**输入。使用**AlphaMode**滑块更改材质的透明度类型：0 - Blend，1 - Mask。
* 您还可以在**Verge3D PBR**材质中使用一个顶点颜色图层。为此，只需将**Attribute**节点的**Color**输出（在**Input**类别中找到）连接到**Verge3D PBR**节点的**COLOR\_0**输入，并将**Use COLOR\_0**设置为1.确保指定了顶点颜色层的名称**Attribute**节点的**Name**字段。

要在Blender视口中查看**Verge3D PBR**着色器的预览，您可以将**3D视图**的显示方法设置为**渲染，**&#x6216;者仅使用同一面板上的**Sneak Peak**按钮在Verge3D中预览场景。

### 使用没有纹理的PBR着色器

如果您想使用纯色而不是纹理，可以使用**BaseColorFactor**输入而不是**BaseColor**。相应地，为了设置**粗糙度**，**金属**和**自发光**，使用具有相同名称而不是颜色输入的**Verge3d PBR**节点的值输入。但是，如果没有纹理，则无法设置**遮挡**和**透明度**。![](https://www.soft8soft.com/docs/files/physical-material-blender/phmat_04.png)

### 从Substance Painter导出纹理

为了便于从Substance Painter导出纹理并确保Verge3D引擎中的最大功能，我们建议使用[Verge3D导出预设](https://www.soft8soft.com/docs/files/physical-material-blender/Verge3D_for_Blender.spexp)。![](https://www.soft8soft.com/docs/files/physical-material/phmat_09.png)

将此预设文件放在通常位于**My Documents \ Allegorithmic \ Substance Painter \ shelf \\**&#x6587;件夹中的**export-presets**文件夹中（如果没有则创建）。![](https://www.soft8soft.com/docs/files/physical-material-blender/phmat_08.png)

从Substance Painter导出纹理时，在导出对话框窗口中选择**Verge3d for Blender**，以便所有生成的纹理都与Verge3D基于的glTF 2.0标准兼容。


# 透明度

Transparency 待校订

在这里，我们将展示如何在Blender中为glTF兼容的PBR，Cycles和Eevee材质启用透明度。Blender 2.7不讨论内部材质，因为它们已被弃用，不建议使用。

### 混合VS蒙面

作为实时3D引擎，Verge3D提供了两种处理透明对象的主要方法：alpha混合和alpha裁剪（通常使用图像蒙版）。混合可以将半透明前景色与背景色相结合，使用前景色的alpha作为混合因子。另一方面，剪切只是丢弃所有像素小于某个预定阈值（通常为0.5）的像素。

![](https://www.soft8soft.com/docs/files/transparency-common/blending-vs-clipping.jpg)

混合可实现平滑过渡，通常看起来更好但计算上比剪裁更昂贵。当多边形看起来以错误的顺序呈现时，它也可能产生z排序伪像。剪切最适合可视化许多小物体（例如草或树叶）。它还会产生硬边，没有任何可能混叠的过渡。

### Alpha Add（又名No Depth Writes）

Verge3D还提供了一种特殊模式，用于在渲染时禁用写入深度缓冲区。这导致多边形被排除在像素深度比较之外。这些多边形以加性方式合成，有时可以帮助摆脱混合伪像。

![](https://www.soft8soft.com/docs/files/transparency-common/no-depth-writes.jpg)

### 渲染顺序（又名Z-index）

Verge3D不对对象内部的多边形进行排序，而是在对象之间执行排序。这在大多数情况下提供了正确的混合，但有时可能需要强制更改对象的渲染顺序。

要修改特定对象的渲染顺序，请更改Verge3D设置面板中的数字字段。索引越小，对象的渲染时间越早。

![](https://www.soft8soft.com/docs/files/transparency-blender/rendering-order.jpg)

因此，如果后方有一个透明的连续对象，并且希望前面的其他透明对象能够正确渲染，请将一些负值设置为后方对象的渲染顺序。

![](https://www.soft8soft.com/docs/files/transparency-common/rendering-order-example.jpg)

### 符合glTF标准的PBR材质的透明度

要为此类材质启用透明度，请将alpha蒙版信息添加到基色纹理的Alpha通道。然后将纹理的alpha通道与Verge3D PBR节点的**Alpha**输入连接。

![](https://www.soft8soft.com/docs/files/transparency-blender/gltf-PBR-ztransparency.jpg)

使用**AlphaMode**滑块更改透明度类型：0将启用混合，1 - 遮罩。

### Cycles材质的透明度

在Cycles中，可以通过使用**Transparent BSDF**和**Mix Shader**节点的组合来启用**透明度**。务必打开Verge3D设置面板上的**透明度**复选框。使用透明度类型选择器在混合和屏蔽模式之间切换。

![](https://www.soft8soft.com/docs/files/transparency-blender/cycles-ztransparency.jpg)

“ **混合着色器”**&#x8282;点中的因子可用于定义Alpha值。您还可以将此输入与包含其RGB或Alpha通道中的Alpha信息的纹理相连接。

![](https://www.soft8soft.com/docs/files/transparency-blender/cycles-ztransparency-texture.jpg)

使用**Alpha Add Transparency**复选框启用添加模式。

### Eevee材质的透明度

与Cycles类似，可以通过使用**Transparent BSDF**和**Mix Shader**节点的组合来启用Eevee材质的**透明度**。“ **混合着色器”**&#x8282;点中的因子可用于定义alpha值 - 您可以直接指定值或从其他节点（如**菲涅耳）**&#x521B;建依赖关系，以获得更逼真的外观。

![](https://www.soft8soft.com/docs/files/transparency-blender/eevee-ztransparency.jpg)

使用“ **混合模式”**&#x4E0B;拉列表在透明度模式之间进行选择。


# 使用材质库

Using Material Library 待校订

## 使用材质库（Verge3D for Blender）

有关推荐工作流程的说明，请参见下文。

* 安装
* 向项目添加材质
* 建立环境
* UV映射
* 配置您的材质
* 图像分辨率
* 将纹理重定位到App文件夹

＃

### 安装

材质库在Soft8Soft商店中以主题包的形式提供，例如：

* [Essential Material Pack](https://www.soft8soft.com/product/verge3d-blender-essential-material-pack/)（基于Eevee，还包括与Blender 2.79兼容的传统GLSL材质）
* 珠宝材质包（基于Eevee，正在开发中）
* 汽车材质包（基于Eevee，正在开发中）

只需将带有库包的存档解压缩到计算机上的任何文件夹即可。给存档充气后，您将看到一个或两个文件夹（如果这是Essential Material Pack）：

* 2\_79
* 2\_80

该**2\_80**文件夹包含Blender 2.80兼容基于伊布的材质。在此文件夹中有**混合**文件（每个材质一个文件）。材质中使用的纹理位于**material\_maps**文件夹中。文件夹**环境**包含3种可用于环境的HDR图像变体（每种变体有3种分辨率：1k，2k和4k）。

该**2\_79**文件夹（只在必要的材质包中提供）包含基于Blender内部GLSL材质遗留库（这是修订库的前5名提供的唯一变量）。

＃

### 向项目添加材质

要在项目中使用库材质，请调用“ **文件/追加”**&#x5BF9;话框。

![](https://www.soft8soft.com/docs/files/mat-library-blender/append-material.jpg)

然后导航到库文件夹，并在**混合**文件上单击一次，并添加要添加的材质。

![](https://www.soft8soft.com/docs/files/mat-library-blender/append-material2.jpg)

在**Material**文件夹上单击一次...

![](https://www.soft8soft.com/docs/files/mat-library-blender/append-material3.jpg)

...选择材质，然后单击“ **从库中追加”**&#x6309;钮。

![](https://www.soft8soft.com/docs/files/mat-library-blender/append-material4.jpg)

添加材质后，您应该能够将其分配给模型。选择模型，转到“ 材&#x8D28;**”**&#x9009;项卡，单击材质名称附近的小按钮（或“ **新建”**&#x6309;钮附近没有指定材质），然后从列表中选择附加材质。

![](https://www.soft8soft.com/docs/files/mat-library-blender/assign-material.jpg)

＃

### 建立环境

基于Eevee的材质需要设置环境，否则材质将看起来黑暗且不反光。环境已经在Verge3D的默认多维数据集项目中设置，您可以将其用作自己的应用程序的基础。或者，您可以从头开始配置环境，如本[视频教程中](https://www.youtube.com/watch?v=wQ0KH4bA3Uw\&t=11m34s)所示。为此，您可以在材质包的**环境**文件夹中使用HDR纹理。

＃

### UV映射

库中的大多数材质都需要模型进行UV映射。考虑展开您的模型以获得最佳效果。

＃

### 配置您的材质

大多数着色器通过调整提供输入集，您可以创建适合您需求的独特材质。

![](https://www.soft8soft.com/docs/files/mat-library-blender/material-settings.jpg)

除此之外，还有一些特殊的输入可以方便地连接烘焙的普通和AO地图。

＃

### 图像分辨率

某些材质可能使用高分辨率纹理（高达8k），这可能会影响加载速度和性能。如果您的应用程序不需要这样详细程度，请考虑重新缩放图像。

＃

### 将纹理重定位到App文件夹

为了您的应用程序的完整性（如果您将项目源转移到第三方，这很重要），您可以将附加材质使用的纹理保存在app文件夹中，如下所述。

在Blender中 打开**图像编辑器**（或**UV编辑器**）。从下拉菜单中选择一个纹理，并检查其文件路径。

![](https://www.soft8soft.com/docs/files/mat-library-blender/texture-file-paths.jpg)

如果看起来纹理是从材质库文件夹引用的，请使用菜单**Image / Save As**将其重新保存到应用程序文件夹中。

![](https://www.soft8soft.com/docs/files/mat-library-blender/texture-file-paths2.jpg)

搜索其他材质库纹理并重复此操作，直到重新定位所有纹理。

您可以通过将文件夹移动到文件系统中的其他位置来检查应用程序的完整性。打开**混合**文件并调用**文件/外部数据/报告丢失文件**。

![](https://www.soft8soft.com/docs/files/mat-library-blender/texture-file-paths3.jpg)

如果缺少**混合**文件中使用的任何纹理，则底部将显示黄色飞溅警告。

![](https://www.soft8soft.com/docs/files/mat-library-blender/texture-file-paths4.jpg)


# 视口预览

Viewport  Preview 待校订

## 视口预览（Blender 2.79内部）

视口预览功能已在App Manager创建的默认Blender项目中可用。如果您未使用App Manager创建资产文件，请参阅下文，了解有关如何启用的信息。

要在Blender 2.79中为Blender内部材质启用更好的视口预览，请在“ **视口着色”**&#x83DC;单中选择“ **材质** ” 。![](https://www.soft8soft.com/docs/files/viewport_preview_blender/viewport-settings-blender1.png)

同样在**Shading**面板上选择**GLSL**并在**Display**面板上启用**World Background** - 这两个面板都可以在**Properties**窗口中找到（依次用**N**快捷键显示）。![](https://www.soft8soft.com/docs/files/viewport_preview_blender/viewport-settings-blender2.png)

或者，您也可以启用“ **背面剔除”**&#x4EE5;隐藏Verge3D渲染中不可见的所有曲面。


# Initialization（初始化）

此拼图位于**init**选项卡下，并在初始化Verge3D应用程序之前进行预读和解释。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-init.jpg)

### **"configure application" - 应用配置**

允许设置应用程序初始化参数，包括一些WebGL上下文创建参数。

* "compressed assets（资产压缩）" —— 使应用程序加&#x8F7D;**.xz**格式的压缩场景而不是常&#x89C4;**.gltf**文件（有关详细信息，请参阅[资产压缩](/general-topics/asset-compression)）;
* "default fullscreen button（默认全屏按钮）" —— 启用在屏幕右上角的默认全屏按钮；
* "transparent background（背景透明）" —— 使背景透明，以便透过WebGL画布显示网页的底层部分;
* "enable screenshots（启用屏幕截图）" —— 可从WebGL画布中正确捕获屏幕截图（将WebGL上下文的**preserveDrawingBuffer**属性设置为**true**）;
* "fade annotations（淡化注释）" —— 当注释被场景对象阻挡时，注释会消隐。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-init-configure-app.jpg)

### **"setup preloader" + "percentage" - 设置预加载 + 百分比**

删除默认预加载器并公开事件回调以允许预加载器读取处理进度。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-init-setup-preloader.jpg)

在以下示例中，自定义的预加载器由具有id“**preloader**”的HTML容器元素（例如一个\<div>）表示。在它内部，还有一个ID为“**loading progress（加载进度）**”的元素（例如一个\<span>），其中加载百分比&#x4E0E;**%**&#x662F;使用Percentage拼图打印的。除此之外，第三个元素的宽度（例如一个\<div>）以图形方式动态更改表示加载进度。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-init-setup-preloader-example.jpg)


# Events（事件）

此类别的拼图处理用户生成的事件：鼠标点击/触摸，悬停和拖动。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events.jpg)

### "**when clicked" - 点击时**

等待用户点击指定的3D对象（或在列表或组里的任何物体，或在启用“[all objects](/puzzles/selectors#all-objects-suo-you-dui-xiang)”拼图时场景里的所有物体）——然后在“do”插槽中运行拼图，或者如果用户点击其他内容则在“miss: do”插槽中运行拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-when-clicked.jpg)

### **"picked object" - 选择的对象**

返回用户单击的对象。与“点击时”("when clicked")拼图一起使用。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-picked-object.jpg)

### **"when hovered"**

Waits until a user hovers over/out a specified 3D object (or any object in a specified list or group, or any object on the scene if the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle is used) - then runs puzzles in the "over/out: do" slot.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-when-hovered.jpg)

### **"hovered object"**

Returns an object a user has hovered over. Intended for use with the "when hovered" puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-hovered-object.jpg)

### **"when moved"**

Tracks any movements (position, rotation and scale) of a specified object (or any object in a specified list or group, or any object on the scene if the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle is used). Runs puzzles in the "start: do" slot if an object started moving, keeps running puzzles in the "while moving: do" slot until an object stops moving, then runs puzzles in the "stop: do" slot. The "delta" parameter denotes an absolute change of any coordinate (x, y or z) of either of position, rotation or scale that is required to trigger this puzzle. The "period" parameter denotes how many rendering frames should the puzzle wait before checking movements again.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-when-moved.jpg)

### **"when dragged"**

Waits until a user drags over a specified 3D object (or any object in a specified list or group, or any object on the scene if the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle is used) with the mouse or a touch gesture - then generates movement data for using in a "drag move", "drag rotate" or "drag scale" puzzle. Also captures events of started and stopped dragging.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-when-dragged-over.jpg)

### **"drag move"**

Moves a specified 3D object (or all objects in a specified list or group, or all objects on the scene if the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle is used) in accordance to dragging movement data generated by the [when dragged](https://www.soft8soft.com/docs/manual/en/puzzles/Events.html#when_dragged) puzzle. Use the drop-down menu to limit the movement to a particular axis or plane, or not to limit at all.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-drag-move.jpg)

### **"drag rotate"**

Rotates a specified 3D object (or all objects in a specified list or group, or all objects on the scene if the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle is used) in accordance to dragging movement data generated by the [when dragged](https://www.soft8soft.com/docs/manual/en/puzzles/Events.html#when_dragged) puzzle. Use the drop-down menu to limit the rotation to a particular axis. The "space" drop-down allows for switching between "local" and "parent" coordinate spaces.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-drag-rotate.jpg)

### **"drag scale"**

Scales a specified 3D object (or all objects in a specified list or group, or all objects on the scene if the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle is used) in accordance to dragging movement data generated by the [when dragged](https://www.soft8soft.com/docs/manual/en/puzzles/Events.html#when_dragged) puzzle. Use the drop-down menu to limit scaling to a particular axis.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-events-drag-scale.jpg)


# Selectors（选择器）

此类别的拼图用于选择3D对象，组，动画片段和材质以适应其他拼图。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selectors.jpg)

### **"select object" - 选择对象**

下拉列表包含场景中所有对象的按字母顺序排列的列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-object.jpg)

### **"all objects" - 所有对象**

表示场景中的所有对象，以便可以批量应用操作。不可迭代。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-all-objects.jpg)

### **"select group" - 选择群组**

下拉列表包含场景中显示的所有对象组的按字母顺序排列的列表。操作可以批量应用于一组对象。不可迭代。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-group.jpg)

### **"select animation" - 选择动画**

下拉列表包含场景中显示的所有对象组的按字母顺序排列的列表。操作可以批量应用于一组对象。不可迭代。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-animation.jpg)

### **"select material" - 选择材质**

下拉列表包含场景中存在的所有材质的按字母顺序排列的列表。

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-selector-material.jpg)


# Objects

The puzzles from this category perform various operations with objects.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-objects.jpg)

**"show"**

Makes a specified object, that was initially or previously hidden, visible. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-show.jpg)

**"hide"**

Makes a specified object invisible. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-hide.jpg)

**"is visible"**

Checks if an object (or any of objects in a list) is currently visible. If it so, returns true, otherwise returns false.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-is-visible.jpg)

**"get objects from"**

This universal puzzle allows you to:

* get the list of objects contained in a group thus making it iterable
* convert the output of the **all objects** puzzle to a list thus making it iterable
* get children of some parent object

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-objects.jpg)

By using the dropdown you can also filter off objects of a kind (e.g. cameras, lamps, annotations, etc).

**"clone"**

Makes an object copy, generates a unique name for the new object and immediately adds it to the scene. Outputs the new object. Does not work with lists, groups or the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-clone.jpg)

**"snap to object"**

Moves an object to the position of another object by copying its transform data. Also copies rotation and scale. Does not work with lists, groups or the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-snap.jpg)

**"set transform"**

Moves, rotates or scales an object according to specified transform data. The "offset" checkbox enables moving/rotating/scaling an object relatively to the original position/rotation/scale. Any of the axis inputs can be left blank. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-set-transform.jpg)

**"get transform"**

Retrieves the position, rotation or scale data of an object. Does not work with lists, groups or the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-transform.jpg)

**"change local transform"**

Moves, rotates or scales an object according to specified transform data in its local space. Any of the axis inputs can be left blank. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-change-local-transform.jpg)

**"get object direction"**

Returns an object's direction vector or numeric **X**,**Y**,**Z** vector components.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-object-direction.jpg)

**"add annotation"**

Add a 2D marker to an object that a user can expand by clicking on it to see the object description. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-add-annotation.jpg)

**"remove annotation"**

Removes a previously added annotation from an object. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-remove-annotation.jpg)

**"open annotation"**

Expands an annotation specified by its label.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-open-annotation.jpg)

**"close annotation"**

Closes an annotation specified by its label.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-close-annotation.jpg)

**"update text object"**

Generates a new mesh for a text object according to specified textual content. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-update-text.jpg)

**"parent"**

Creates a parent relation between objects, so that the first object follows position/rotation/scale of the second one. Does not work with lists, groups or the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-parent.jpg)

**"distance"**

Outputs the distance between two specified objects. Does not work with lists, groups or the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-distance.jpg)

**"outline"**

Applies or removes the outline effect to/from a specified object. To unlock this puzzle, enable the outline effect in 3ds Max or Blender. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-outline.jpg)

**"get custom props"**

Returns a [dictionary](https://www.soft8soft.com/docs/manual/en/puzzles/Dictionaries.html) with custom properties assigned to an object.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-custom-props.jpg)

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-custom-props-example2.jpg)

Custom properties can be assigned in 3ds Max via the **User Defined Properties** panel, or in Blender by using the **Custom Properties** panel.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-custom-props-example.jpg)


# Materials

The puzzles from this category perform various operations with materials and textures.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials.jpg)

### **"assign material"**

Assigns a material to an object, completely replacing the old material. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials-assign-material.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Materials.html#replace_texture)

### **"replace texture"**

Replaces a texture found for a specified material with the one loaded from the provided URI.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials-replace-texture.jpg)

### **"set color"**

Set R, G and B components of a color parameter found for a specified material.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials-set-color.jpg)

**For 3ds Max users:** you can add **Controllers** in your materials (standard or physical) and their names will be shown in the dropdown menu. In addition, diffuse (or "base") color inputs for standard or physical material nodes are also accessible. In case of **glTF-compliant PBR** materials the **Base Color** and **Emission** inputs are only accessible with this puzzle.

**For Blender users:** you can add **RGB** nodes in your node-based materials (GLSL Internal, Cycles, Eevee) and their names will be shown in the dropdown menu. In addition, diffuse (or "base") color inputs for Material, Extended Material, BSDF Principled, BSDF Diffuse and BSDF Glossy nodes are also accessible. In case of **glTF-compliant PBR materials** the **BaseColor** and **Emissive** inputs are only accessible with this puzzle.

This puzzle can also be used to modify the environment shader. In the drop-down, the name of the environment shader starts with "Verge3D\_Environment".

For more information on materials available to Verge3D users, please refer to Material system overview chapters of this manual: [3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Material-System-Max.html), [Blender](https://www.soft8soft.com/docs/manual/en/introduction/Material-System-Blender.html).

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Materials.html#materials_set_value)

### **"set value"**

Set a value parameter found for a specified material.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-materials-set-value.jpg)

**For 3ds Max users:** you can add **Controllers** in your materials (standard or physical) and their names will be shown in the dropdown menu. In case of **glTF-compliant PBR** materials the following inputs are accessible with this puzzle: Metalness, Roughness, Bump Scale, Emissive Intensity and Environment Map Intensity.

**For Blender users:** you can add **Value** nodes in your node-based materials (GLSL Internal, Cycles, Eevee) and their names will be shown in the dropdown menu. In case of **glTF-compliant PBR** materials the following inputs are accessible with this puzzle: metalness (MetallicFactor in PBR node), roughness (RoughnessFactor in PBR node), bumpScale (NormalScale in PBR node), emissiveIntesity (EmissiveFactor in PBR node) and envMapIntensity (not presented in PBR node).

This puzzle can also be used to modify the environment shader. In the drop-down, the name of the environment shader starts with "Verge3D\_Environment".

For more information on materials available to Verge3D users, please refer to Material system overview chapters of this manual: [3ds Max](https://www.soft8soft.com/docs/manual/en/introduction/Material-System-Max.html), [Blender](https://www.soft8soft.com/docs/manual/en/introduction/Material-System-Blender.html).

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Materials.html#get_material)

### **"get material"**

Retrieves the name of a material assigned to an object. If multiple materials are assigned to the same object, returns the first one.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-object-get-material.jpg)


# Animation

The puzzles from this category perform operations with animation clips.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#play_animation)

**"play animation"**

Plays an animation clip. Animation clip names correspond to objects to which animation is assigned in 3ds Max or Blender (only one animation clip can be assigned per object). Use the [animation selector](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#select_animation) puzzle to provide an animation clip for this puzzle.

Use the "from" and "to" fields to specify the frame range. Use the "speed" field to specify the playback speed. The "reversed" checkbox enables reversed playback. The drop-down can be used to change the animation mode - "auto" allows for using the animation mode specified in 3ds Max or Blender, while the other modes override the settings specified in 3ds Max or Blender.

Puzzles in the "when finished: do" slot are processed once the animation is finished (this only is valid for the "once" animation mode).![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-play.jpg)

This puzzle also works for a list of animation clips.

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#stop_animation)

**"stop animation"**

Stops playing back an animation clip. Also works for a list of animation clips.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-stop.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#pause_animation)

**"pause animation"**

Pauses an animation clip playback so that it can be resumed later starting from the frame it was paused on. Also works for a list of animation clips.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-pause.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#resume_animation)

**"resume animation"**

Resumes a previously paused animation clip. Also works for a list of animation clips.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-resume.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#set_animation_frame)

**"set animation frame"**

Sets an animation clip to a specified frame. Also works for a list of animation clips.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-set-animation-frame.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#is_animation_playing)

**"is animation playing"**

Checks if an animation clip (or any of animations in a list) is currently being played back.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-is-playing.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#get_animation)

**"get animation"**

Retrieves a specified object's animation clip. Also works for a list of objects, a group (or a list of groups) or with the [all objects](https://www.soft8soft.com/docs/manual/en/puzzles/Selectors.html#all_objects) puzzle. The return value is always a list of animation clips (even if there is only one of them).![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-get-animation.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#animate_param)

**"animate param"**

Animates a numeric parameter (or all parameters in a list or a [dictionary](https://www.soft8soft.com/docs/manual/en/puzzles/Dictionaries.html)) in between **from** and **to**, during a period specified with **duration** (in seconds). The **easing** dropdown allows you to specify the animation mode (see below).

The **repeat** field specifies the number of repetitions after the first animation is complete. The **yoyo** checkbox enables backtrack movement (works for **repeat** > 1).

Puzzles in the **on update do** slot are triggered every rendering frame while the parameter is animated. Puzzles in the **when finished do** slot are triggered once the animation is finished.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-animate-param.jpg)

This puzzle wraps the [Tween.js](https://github.com/tweenjs/tween.js/blob/master/docs/user_guide.md) library, exposing its all [31 easing modes](http://tweenjs.github.io/tween.js/examples/03_graphs.html) (pictured), duration, repeat and yoyo settings, and the update and complete callbacks.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-animate-param-easing-modes.jpg)

The in-between value may be retrieved with an [updated value](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#updated_value) puzzle usually placed inside the **on update do** slot.

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#updated_value)

**"updated value"**

Returns the in-between value produced by the [animate param](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#animate_param) puzzle. Depending on the type of the animated parameter, can be a number, a list or a [dictionary](https://www.soft8soft.com/docs/manual/en/puzzles/Dictionaries.html).![](https://www.soft8soft.com/docs/files/puzzles/puzzles-animation-updated-value.jpg)

This puzzle may be placed anywhere in a scenario, but naturally works in the **on update do** slot of the [animate param](https://www.soft8soft.com/docs/manual/en/puzzles/Animation.html#animate_param) puzzle where it is updated every frame.


# Camera

The puzzles from this category perform operations with the camera.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Camera.html#look_at)

**"look at"**

Smoothly animates the active camera so that it finally targets a specified object. The numeric parameter specifies the time period over which the animation is performed (in seconds).![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-lookat.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Camera.html#tween_camera)

**"tween camera"**

Smoothly animates the active camera so that its position finally coincides with the position of a specified object, and the camera targets another specified object. The numeric parameter specifies the time period for the animation (in seconds).

The optional **when finished do** slot may be used to detect the moment when the tweening is finished.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-tween-camera.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Camera.html#set_active_camera)

**"set active camera"**

Makes a specified camera active. This can be used to change camera control mode ("orbit" vs "flying" vs "no controls"), field of view and other settings on the fly.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-set-active.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Camera.html#get_camera_direction)

**"get camera direction"**

Returns a list of X, Y and Z components of the active camera's world direction vector. If **from mouse/touch** is checked, this puzzle casts a ray from the camera to the cursor's screen position and returns the direction of that ray. If additionaly **inverted**is checked, then the cursor's screen position coordinates are negated.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-get-camera-direction.jpg)

In the following example, an object looks at the mouse cursor. This can be achived by mapping the position of an empty/dummy object to mouse cursor with some simple math.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-get-camera-direction-example2.jpg)

In order to setup such behavior in 3ds Max, make your object follow a dummy object by utilizing the **Rotation Controllers / LookAt Constraint**. In Blender, this corresponds to the **TrackTo** constraint.

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Camera.html#autorotate_camera)

**"autorotate camera"**

Smoothly animates the active **Orbit** camera by rotating it around the target.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-autorotate-camera.jpg)

In the following example, the camera starts to rotate after 3 seconds of user inactivity. When the user clicks a mouse button (or touches the screen), he or she regains the control over the camera until further 3 second period of inactivity.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-camera-autorotate-camera-example.jpg)


# Scenes

The puzzles from this category perform loading/unloading operations with scenes.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Scenes.html#load_scene)

**"load scene" + "percentage"**

When this puzzle is triggered, the current scene is unloaded and a new scene is loaded from a specified .gltf file. After loading is finished, the puzzles in the "when loaded do" slot are triggered. Also there can be enabled the "on progress do" slot. Puzzles placed in this slot are continuously triggered during the loading and can utilize the "percentage" puzzle.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-load-scene.jpg)![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-load-scene-example.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Scenes.html#append_scene)

**"append scene" + "percentage"**

When this puzzle is triggered, a new scene is loaded from a specified .gltf file and appended to the current scene. After loading is finished, the puzzles in the "when loaded do" slot are triggered. Also there can be enabled the "on progress do" slot. Puzzles placed in this slot are continuously triggered during the loading and can utilize the "percentage" puzzle. The "append scene" puzzle doesn't load cameras and lights from a new scene by default. This behavior can be changed in the puzzle's options.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-append-scene.jpg)![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-append-scene-example.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Scenes.html#unload_scene)

**"unload scene"**

Unloads the specified scene or its part from the application. Use the empty text value in order to unload all scenes.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-unload-scene.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Scenes.html#enable_rendering)

**"enable rendering"**

Resumes previously disabled rendering.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-enable-rendering.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Scenes.html#disable_rendering)

**"disable rendering"**

Disables rendering. The graphics won't be updated but the user events will be captured and animation timelines will progress.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-disable-rendering.jpg)

You can use disable rendering for the purpose of saving batteries on mobile devices or laptops, and getting rid of cooler noise on desktops. You can also use it together with the **supersamping** puzzle to significantly increase the rendering quality and compensate the loss of performance.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-scenes-enable-disable-rendering-example.jpg)


# Misc

Miscellaneous puzzles to perform various operations on a high level.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc.jpg)

### **"open web page"**

When this puzzle is triggered, a specified URL is opened in a new or in the same browser tab depending on the drop-down selection. When triggered from the Puzzles editor, it will ask for a user confirmation before leaving the tab.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-open-web-page.jpg)

### **"social share link"**

Generates a link for sharing your application in popular social media.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-social-share-link.jpg)

### **"call JS function"**

Executes a function specified in the JavaScript code of the application. Optionally passes parameters to be used as function arguments.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-call-js-function.jpg)

In order to add a function to JavaScript code, open the application **.js** file (for example, my\_awesome\_app.js located in verge3d/applications/my\_awesome\_app) with any text editor. Search for "prepareExternalInterface" and add your function inside that declaration (between the curly brackets), so that it looks like this:`function prepareExternalInterface(app) { app.ExternalInterface.myJSFunction = function(numericArg, textArg) { alert('Got some params from Puzzles: ' + numericArg + ' and ' + textArg); } }`

### **"when called from JS"**

Allows for triggering Puzzles from the JavaScript code of the application. Optionally retrieves parameters passed from the JavaScript code and saves them as variables to be used by puzzles in the "do" slot.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-when-called-from-js.jpg)

In order to trigger this puzzle from the JavaScript code, open the application **.js** file (for example, my\_awesome\_app.js located in verge3d/applications/my\_awesome\_app) with any text editor. Search for "runCode" and add a function call inside that declaration (between the curly brackets), so that it looks like this:`function runCode(app) { app.ExternalInterface.myJSCallback('Hello, Puzzles!', 80); }`

### **"load data"**

Attempts to load data from a specified location. The puzzles in the "once ready do" slot are interpreted regardless of whether the attempt was a success. The retrieved data can be accessed via the [loaded data](https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#loaded_data) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-load-data.jpg)

### **"send data"**

Attempts to send a specified data to a remote location using an asynchronous [POST HTTP](https://en.wikipedia.org/wiki/POST_\(HTTP\)) request. The puzzles in the "once ready do" slot are interpreted regardless of whether the attempt was a success. If there is any response data, it can be accessed via the [loaded data](https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#loaded_data) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-send-data.jpg)

### **"loaded data"**

Returns data retrieved by the [load data](https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#load_data) or [send data](https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#send_data) puzzles.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-loaded-data.jpg)

### **"read JSON"**

Interprets text as [JavaScript Object Notation](https://en.wikipedia.org/wiki/JSON#Example) data which are returned in a dictionary.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-read-JSON.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#read_CSV)

### **"read CSV"**

Interprets text as [comma-separated values](https://en.wikipedia.org/wiki/Comma-separated_values#Example). Returns a list of table rows, with each row represented as a list of values. The delimiter can be selected with the drop-down to correspond a CSV file's export settings. "From row" value denotes how many rows will be skipped starting from the top.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-read-CSV.jpg)

Table rows and values are accessed by their numeric indices starting from 0.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-csv-example.jpg)

### **"save state"**

Saves the state of specified objects and/or the values of variables specified by their names. The objects are cloned and stored in memory. The values of the variables are retrieved and stored in memory for each specified variable name.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-save-state.jpg)

If this puzzle is called several times, the states are saved in sequence so that it is possible to return to any previous state with the [undo state](https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#undo_state) puzzle.

### **"undo state"**

Restores the state of objects and/or variables saved with the [save state](https://www.soft8soft.com/docs/manual/en/puzzles/Misc.html#save_state) puzzle.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-undo-state.jpg)

If this puzzle is called several times, the states are restored from the saved sequence (if any) which makes it possible to return to any previously saved state from the stack.

### **"all variable names"**

Returns a list with the names of all variables used in Puzzles.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-all-variable-names.jpg)

### **"variable value by name"**

Returns the value of a variable specified by its name. This puzzle works similarly to the standard variable value puzzle, yet does not require to select a variable from the predefined dropdown menu.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-variable-value-by-name.jpg)

### **"place order"**

Composes a hidden order form with the "title", "contents" and "total price" fields and an optional screenshot and submits this form to a specified URL according to the specification explicated in the Wordpress Plugin section. By default the order form is submitted to the [demo ordering page](https://sandbox.soft8soft.com/order-form/).

Verge3D comes with a free Wordpress plug-in that is able to handle requests submitted by this puzzle. Upon receiving such a request, this Wordpress plug-in renders a page with an extended form supplemented with contact and comments fields, the embedded screenshot and a captcha. Filled out form is finally submitted by the customer and a new order is created in Wordpress admin interface. Both the customer and the sales manager are notified about the order by e-mail.

Please refer to the Wordpress Plugin section of this Manual for setup information.

Be sure to enable screenshots in the [configure application](https://www.soft8soft.com/docs/manual/en/puzzles/Initialization.html#configure_application) puzzle otherwise the screenshot may be rendered in black.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-misc-place-order.jpg)


# Time

These puzzles count time and trigger time-based events.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Time.html#after)

**"after"**

Waits for a specified amount of time and then triggers puzzles placed inside the "do" slot.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-after.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Time.html#every)

**"every"**

Waits for a specified amount of time and then triggers puzzles placed inside the "do" slot. Then repeats.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-every.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Time.html#every_frame)

**"every frame"**

Triggers puzzles placed inside the "do" slot every rendering frame (normally at the rate of 60 frames per second).![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-every-frame.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Time.html#elapsed_delta)

**"elapsed delta"**

Outputs the amount of time (in seconds) passed from the previous rendering frame. Can be used with the "every frame" puzzle to implement frame-independent animation.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-elapsed-delta.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Time.html#elapsed_total)

**"elapsed total"**

Outputs the amount of time (in seconds) passed from the application start. Can be used with the "every frame" puzzle to implement procedural animation and various visual effects.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-elapsed-total.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Time.html#set_timer)

**"set timer"**

Waits for a specified amount of time and then triggers puzzles placed inside the "do" slot. The specified ID can be used to override or remove the timer.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-set-timer.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Time.html#remove_timer)

**"remove timer"**

Removes a previosly set timer by using its ID.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-remove-timer.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/Time.html#get_date_time)

**"system date / time"**

Get system date and time. Enable UTC checkbox in order to get time of the UTC/GMT zone instead of the local time zone.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-time-get-date-time.jpg)


# HTML

These puzzles manipulate HTML DOM elements.

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#add_HTML_element)

**"add HTML element"**

Creates an HTML element with a specified [type](https://www.w3schools.com/tags/default.asp) and identifier (corresponds to "id" attribute) and appends it to the document body. Also sets its style property "position" to "absolute".![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-add-html-elem.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#get_attribute)

**"get attribute"**

Gets an [attribute](https://www.w3schools.com/tags/ref_attributes.asp) from an HTML element with a specified id. The "in parent doc" checkbox should be enabled if the HTML element is located in an external HTML document (in which Verge3D application's **.html** file is embedded using **iframe**).![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-get-attr.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#set_attribute)

**"set attribute"**

Sets an [attribute](https://www.w3schools.com/tags/ref_attributes.asp) for an HTML element with a specified id. The "in parent doc" checkbox should be enabled if the HTML element is located in an external HTML document (in which Verge3D application's **.html** file is embedded using **iframe**). Also works with lists of element ids.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-set-attr.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#set_style)

**"set style"**

Sets a [CSS property](https://www.w3schools.com/cssref/default.asp) for an HTML element with a specified id. The "in parent doc" checkbox should be enabled if the HTML element is located in an external HTML document (in which Verge3D application's **.html** file is embedded using **iframe**). Also works with lists of element ids.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-set-style.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#set_css_rule)

**"set css rule"**

Sets a [CSS property](https://www.w3schools.com/cssref/default.asp) for a specified CSS rule (found in **.css** files of an application). The "in parent doc" checkbox should be enabled if the style sheets belong to an external HTML document (in which Verge3D application's **.html** file is embedded using **iframe**).![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-set-css-rule.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#event)

**"event"**

Registers an [event listener](https://www.w3schools.com/jsref/dom_obj_event.asp) for an HTML element with a specified id. The "in parent doc" checkbox should be enabled if the HTML element is located in an external HTML document (in which Verge3D application's **.html** file is embedded using **iframe**). Once an event occurs, the puzzles placed in the "do" slot are triggered. Also works with lists of element ids.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-on-event.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#get_event_property)

**"get event property"**

Outputs the value of a [property](https://www.w3schools.com/jsref/obj_events.asp) of an event generated by the "event" puzzle.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-get-event-property.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#window)

**"window"**

Represents the [DOM window object](https://www.w3schools.com/jsref/obj_window.asp) - a browser tab or an iframe to which an HTML document is loaded.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-window.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#document)

**"document"**

Represents the [DOM document object](https://www.w3schools.com/jsref/dom_obj_document.asp) - the root node of an HTML document.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-document.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#body)

**"body"**

Represents the [DOM body object](https://www.w3schools.com/jsref/dom_obj_body.asp) - the \<body> element of an HTML document.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-body.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#draw_line)

**"draw line"**

Connects a specified 3D object with a specified HTML element by a dynamically updated line. The "in parent doc" checkbox should be enabled if the HTML element is located in an external HTML document (in which Verge3D application's **.html** file is embedded using **iframe**). You can also set the width, color and offset for the line.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-draw-line.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#remove_line)

**"remove line"**

Removes a previously created line from a specified object.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-remove-line.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#bind_element)

**"bind element"**

Makes a specified HTML element follow the center of a specified 3D object in screen space. The "in parent doc" checkbox should be enabled if the HTML element is located in an external HTML document (in which Verge3D application's **.html** file is embedded using **iframe**). A more customizable variant of the "add annotation" puzzle.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-bind-element.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#init_fullscreen)

**"init fullscreen"**

Makes a specified HTML element behave as a fullscreen mode button - the first click on it triggers entering the fullscreen mode, the second click exits fullscreen. Puzzles placed in the "on enter do" and "on exit do" slots are triggered upon entering or exiting the fullscreen mode. Puzzles placed in the "if unavailable do" are triggered if fullscreen is not supported by the browser (e.g. iOS Safari).![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-init-fullscreen.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#get_url_data)

**"get URL data"**

Retrieves URL data of the window to which an application is loaded:

* **Entire URL** - text, e.g. "<https://www.example.com/my\\_awesome\\_app.html?image\\_url=https://www.uploadserver.com/path/to/image.jpg>"
* **Parameters** - dictionary, e.g. {"image\_url": "<https://www.uploadserver.com/path/to/image.jpg"}>
* **Host name** - text, e.g. "[www.example.com](http://www.example.com)"

![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-get-url-data.jpg)

This puzzle may be useful in situations when the configuration data of an application are stored in its URL. For example, you can specify an image to be used as a texture in the following way:

```
https://www.example.com/my_awesome_app.html?image_url=https://www.uploadserver.com/path/to/image.jpg
```

Then you can retrieve the **image\_url** parameter, load and apply the texture as follows:![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-get-url-data-example.jpg)

See the **Custom Image** demo in your Verge3D distribution for a working example.

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#set_url_param)

**"set URL param"**

Assigns or updates a value of a parameter in a specified URL by automatically forming a valid [query string](https://en.wikipedia.org/wiki/Query_string) if necessary, and returns the updated URL.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-set-url-param.jpg)

This puzzle may be useful in situations when the configuration data of an application are stored in its URL. For example, you can specify an image to be used as a texture in the following way:

```
https://www.example.com/my_awesome_app.html?image_url=https://www.uploadserver.com/path/to/image.jpg
```

You can upload a texture, retrieve its server-side path and save it to the **image\_url** parameter of the app URL as follows:![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-set-url-param-example.jpg)

See the **Custom Image** demo in your Verge3D distribution for a working example.

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#take_screenshot)

**"take screenshot"**

Takes a screenshot of the viewport and outputs it in [Data URI](https://en.wikipedia.org/wiki/Data_URI_scheme#Examples_of_use) format.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-take-screenshot.jpg)

[#](https://www.soft8soft.com/docs/manual/en/puzzles/HTML.html#open_file)

**"open file" and "opened file"**

Invokes the browser's native dialog window for selecting files from the user's device. Once the user have selected a file, returns the file's contents in [Data URI](https://en.wikipedia.org/wiki/Data_URI_scheme#Examples_of_use) format.![](https://www.soft8soft.com/docs/files/puzzles/puzzles-html-open-file.jpg)


# AR/VR


# Sound


# Physics


# Post-processing


# Dictionaries


# Variables


# Procedures


# System


# Library


# 编程基础

Programming Basics 待校订

本节的目的是简要介绍Verge3D。我们将首先使用旋转立方体设置场景。页面底部提供了一个工作示例，以防您遇到困难并需要帮助。

### 在我们开始之前

在使用Verge3D之前，您需要在某处显示它。将以下HTML保存到计算机上的文件中，并在应用程序目录中保存Verge3D副本，然后在浏览器中打开它。`<!DOCTYPE html> <html> <head> <meta charset=utf-8> <title>My first Verge3D app</title> <style> body { margin: 0; } canvas { width: 100%; height: 100% } </style> </head> <body> <script src="v3d.js"></script> <script> // Our Javascript will go here. </script> </body> </html>`就这样。下面的所有代码都进入空的\<script>标记。

### 创建场景

要实际能够使用Verge3D显示任何内容，我们需要三件事：场景，相机和渲染器，以便我们可以使用相机渲染场景。`var scene = new v3d.Scene(); var camera = new v3d.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); var renderer = new v3d.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement);`我们花一点时间来解释这里发生了什么。我们现在已经设置了场景，我们的相机和渲染器。Verge3D中有几个不同的摄像头。现在，让我们使用**PerspectiveCamera**。第一个属性是**视野**。FOV是在任何给定时刻在显示器上看到的场景的范围。该值以度为单位。第二个是**宽高比**。你几乎总是想要使用元素的宽度除以高度，或者你会得到与在宽屏电视上播放旧电影时相同的结果 - 图像看起来很紧。接下来的两个属性是**近**剪裁平面和**远**剪裁平面。这意味着，远离相机的物体**远远**超过**近**或近的物体将不会被渲染。您现在不必担心这一点，但您可能希望在应用中使用其他值以获得更好的性能。接下来是渲染器。这就是魔术发生的地方。除了我们在这里使用的WebGLRenderer之外，Verge3D还附带了一些其他功能，通常用作旧浏览器用户的后备或者由于某些原因没有WebGL支持的用户。除了创建渲染器实例之外，我们还需要设置我们希望它渲染应用程序的大小。使用我们想要用我们的应用程序填充的区域的宽度和高度是个好主意 - 在这种情况下，浏览器窗口的宽度和高度。对于性能密集型应用程序，您还可以为**setSize提供**较小的值，例如**window\.innerWidth / 2**和**window\.innerHeight / 2**，这将使应用程序呈现为一半大小。如果您希望保持应用程序的大小但是以较低的分辨率渲染它，可以通过调用**setSize**并将其作为**updateStyle**（第三个参数）来调用。例如，假设您的\<canvas>具有100％的宽度和高度，**setSize（window\.innerWidth / 2，window\.innerHeight / 2，false）**&#x5C06;以半分辨率呈现您的应用。最后但并非最不重要的是，我们将**渲染器**元素添加到HTML文档中。这是渲染器用于向我们显示场景的\<canvas>元素。*“这一切都很好，但你承诺的那个立方体在哪里？”* 我们现在加上吧。`var geometry = new v3d.BoxGeometry(1, 1, 1); var material = new v3d.MeshBasicMaterial({ color: 0x00ff00 }); var cube = new v3d.Mesh(geometry, material); scene.add(cube); camera.position.z = 5;`要创建一个立方体，我们需要一个**BoxGeometry**。这是一个包含多维数据集的所有点（**顶点**）和填充（**面**）的对象。我们将来会更多地探讨这个问题。除了几何外，我们还需要一种材料来为它着色。Verge3D有几种材料，但我们**暂时**坚持使用**MeshBasicMaterial**。所有材料都采用将应用于它们的属性对象。为了使事情变得非常简单，我们只提供**0x00ff00**的颜色属性，它是绿色的。这与CSS或Photoshop（**十六种颜色**）中的**颜色相同**。我们需要的第三件事是**Mesh**。网格是一个采用几何体的对象，并将一个材质应用于它，然后我们可以将其插入到场景中，并自由移动。默认情况下，当我们调用**scene.add（）时**，我们添加的东西将被添加到坐&#x6807;**（0,0,0）中**。这会导致相机和立方体彼此在一起。为了避免这种情况，我们只需将相机移出一点。

### 渲染场景

如果您将上面的代码复制到我们之前创建的HTML文件中，您将无法看到任何内容。这是因为我们实际上还没有呈现任何东西。为此，我们需要所谓的**渲染或动画循环**。`function animate() { requestAnimationFrame(animate); renderer.render(scene, camera); } animate();`这将创建一个循环，使渲染器每秒绘制场景60次。如果您不熟悉在浏览器中编写游戏，您可能会&#x8BF4;*“我们为什么不创建一个setInterval？”* 问题是 - 我们可以，但**requestAnimationFrame**有许多优点。也许最重要的一点是当用户导航到另一个浏览器标签时它会暂停，因此不会浪费他们宝贵的处理能力和电池寿命。

### 动画多维数据集

如果您将上面的所有代码插入到我们开始之前创建的文件中，您应该会看到一个绿色框。让旋转它让它变得更有趣。在**animate**函数中的**renderer.render**调用上方添加以下内容：`cube.rotation.x += 0.1; cube.rotation.y += 0.1;`这将在每帧（每秒60次）运行，并为立方体提供一个很好的旋转动画。基本上，在应用程序运行时您想要移动或更改的任何内容都必须通过动画循环。你当然可以从那里调用其他函数，这样你就不会得到数百行的**动画**函数。

### 结果

恭喜！您现在已经完成了第一个Verge3D应用程序。这很简单，你必须从某个地方开始。完整代码如下。玩弄它以更好地理解它是如何工作的。`<html> <head> <title>My first Verge3D app</title> <style> body { margin: 0; } canvas { width: 100%; height: 100% } </style> </head> <body> <script src="v3d.js"></script> <script> var scene = new v3d.Scene(); var camera = new v3d.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000); var renderer = new v3d.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); var geometry = new v3d.BoxGeometry(1, 1, 1); var material = new v3d.MeshBasicMaterial({ color: 0x00ff00 }); var cube = new v3d.Mesh(geometry, material); scene.add(cube); camera.position.z = 5; var animate = function() { requestAnimationFrame(animate); cube.rotation.x += 0.1; cube.rotation.y += 0.1; renderer.render(scene, camera); }; animate(); </script> </body> </html>`


# 矩阵变换

Matrix Transformations 待校订

Verge3D使用**矩阵**编码3D变换 - 平移（位置），旋转和缩放。Object3D的每个实例都有一个矩阵，用于存储该对象的位置，旋转和缩放。本页介绍如何更新对象的转换。

### 便利性和**matrixAutoUpdate**

有两种方法可以更新对象的转换：

1. 修改对象的**位置**，**四元数**和**缩放**属性，让Verge3D从这些属性中重新计算对象的矩阵： 默认情况下，**matrixAutoUpdate**属性设置为true，矩阵将自动重新计算。如果对象是静态的，或者您希望在重新计算时手动控制，则可以通过将属性设置为false来获得更好的性能： 在更改任何属性后，手动更新矩阵：`object.position.copy(start_position); object.quaternion.copy(quaternion);object.matrixAutoUpdate = false;object.updateMatrix();`
2. 直接修改对象的矩阵。该Matrix4类有修改矩阵的各种方法： 注意**matrixAutoUpdate** *必须*设置为**假**在这种情况下，你应该确保*不*调用**updateMatrix**。调用**updateMatrix**将破坏对矩阵所做的手动更改，从**位置**，**比例等**重新计算矩阵。`object.matrix.setRotationFromQuaternion(quaternion); object.matrix.setPosition(start_position); object.matrixAutoUpdate = false;`

### 对象和世界矩阵

对象的矩阵存储对象*相*对于对象父级的转换; 要在*世界*坐标中获取对象的变换，您必须访问对象的Object3D.matrixWorld。

当父对象或子对象的转换发生更改时，您可以通过调用updateMatrixWorld（）来请求更新子对象的matrixWorld。

### 旋转和四元数

Verge3D提供了两种表示3D旋转的方法：欧拉角和四元数，以及两者之间的转换方法。欧拉角受到称为“万向节锁定”的问题，其中某些配置可能失去一定程度的自由度（防止物体绕一个轴旋转）。因此，对象旋转*始终*存储在对象的四元数中。

该库的**早期**版本包含一个**useQuaternion**属性，当设置为false时，将导致从Euler角度计算对象的矩阵。这种做法已被弃用 - 相反，您应该使用setRotationFromEuler方法，该方法将更新四元数。


# 动画系统

Animation System 待校订

### 概观

在Verge3D动画系统中，您可以为模型的各种属性设置动画：蒙皮和装配模型的骨骼， 变形目标，不同材质属性（颜色，不透明度，布尔值），可见性和变换。动画属性可以淡入，淡出，交叉淡化和扭曲。可以独立地改变同一对象以及不同对象上的不同同时动画的权重和时间尺度。可以同步在相同和不同对象上的各种动画。\
\
为了在一个同类系统中实现所有这一切，Verge3D动画系统 [在2015年彻底改变了](https://github.com/mrdoob/three.js/issues/6881) （注意过时的信息！），它现在有一个类似于Unity /虚幻引擎4的架构。这个页面简要概述了系统的主要组件以及它们如何协同工作。

#### 动画片段

如果您已成功导入动画3D对象（如果它具有骨骼或变形目标或两者都无关紧要） - 例如，使用Blender导出器将其从Blender导出并使用GLTFLoader将其加载到Verge3D场景中，其中一个几何体加载网格的属性应该是一个名为“animations”的数组，其中包含此模型的AnimationClips（请参阅下面的可能加载器列表）。\
\
每个**AnimationClip**通常保存对象的某个活动的数据。例如，如果网格是一个角色，则可能有一个动作剪辑用于步行循环，第二个用于跳跃，第三个用于回避等等。

#### 关键帧轨道

在这样的**AnimationClip**内部，每个动画属性的数据存储在单独的KeyframeTrack中。假设一个角色对象有一个骨架，一个关键帧轨道可以存储下臂骨骼随时间的位置变化的数据，一个不同的轨道用于相同骨骼的旋转变化的数据，第三个是轨道位置，旋转或缩放另一个骨头，等等。应该清楚的是，AnimationClip可以由许多这样的轨道组成。\
\
假设模型具有变形目标（例如，一个变形目标显示友好的面部，另一个显示愤怒的面部），每个轨道保存有关影响的信息 在剪辑的执行期间某个变形目标的变化。

#### 动画混音器

存储的数据仅构成动画的基础 - 实际播放由AnimationMixer控制。你可以想象这不仅仅是一个动画播放器，而是一个模拟硬件，如真正的调音台控制台，它可以同时控制几个动画，混合和合并它们。

#### 动画动作

该**AnimationMixer**本身只有很少的（一般）属性和方法，因为它可以通过控制AnimationActions。通过配置 **AnimationAction，**&#x60A8;可以确定某个**AnimationClip**何时应在其中一个混音器上播放，暂停或停止，是否必须重复剪辑，是否应该使用淡入淡出或时间缩放，以及其他的东西，例如交叉淡化或同步。

#### 动画对象组

如果希望一组对象接收共享动画状态，则可以使用 AnimationObjectGroup。

#### 支持的格式和加载器

请注意，并非所有模型格式都包含动画（特别是OBJ），并且只有一些Verge3D加载器支持AnimationClip序列。有几个是做 支持这种动画类型：

* v3d.JSONLoader
* v3d.ObjectLoader
* v3d.BVHLoader
* v3d.ColladaLoader
* v3d.FBXLoader
* v3d.GLTFLoader
* v3d.MMDLoader
* v3d.SEA3DLoader

请注意，3ds max和Maya当前无法将多个动画（即不在同一时间轴上的动画）直接导出到单个文件。

### 例

`var mesh; // Create an AnimationMixer, and get the list of AnimationClip instances var mixer = new v3d.AnimationMixer(mesh); var clips = mesh.animations; // Update the mixer on each frame function update () { mixer.update(deltaSeconds); } // Play a specific animation var clip = v3d.AnimationClip.findByName(clips, 'dance'); var action = mixer.clipAction(clip); action.play(); // Play all animations clips.forEach(function(clip) { mixer.clipAction(clip).play(); });`


# 创建文本

Creating Text 待校订

有时您可能需要在Verge3D应用程序中使用文本 - 这里有几种方法可以执行此操作。

### 1. DOM + CSS

使用HTML通常是添加文本最简单，最快捷的方式。这是大多数Verge3D示例中用于描述性叠加的方法。

您可以向a添加内容`<div id="info">Description</div>`

并使用CSS标记绝对位于所有其他位置的z-index位置，尤其是在运行Verge3D全屏时。`#info { position: absolute; top: 10px; width: 100%; text-align: center; z-index: 100; display:block; }`

### 2.将文本绘制到画布并用作纹理

如果您希望在Verge3D场景中的平面上轻松绘制文本，请使用此方法。

### 3.在您喜欢的3D应用程序中创建模型并导出到Verge3D

如果您更喜欢使用3d应用程序并将模型导入Verge3D，请使用此方法

### 4.程序文本几何

如果您更喜欢纯粹在v3d.js中工作或创建过程和动态3D文本几何，则可以创建一个几何为v3d.TextGeometry实例的网格：

`new v3d.TextGeometry(text, parameters);`

但是，为了使其工作，TextGeometry将需要在其“font”参数上设置v3d.Font的实例。有关如何执行此操作的详细信息，每个接受参数的说明以及v3d.js分发本身附带的JSON字体列表，请参阅TextGeometry页面。

#### 例子

[WebGL /几何/文本](https://cdn.soft8soft.com/demo/examples/index.html#webgl_geometry_text)\
[WebGL / shadowmap](https://cdn.soft8soft.com/demo/examples/index.html#webgl_shadowmap)

如果Typeface已关闭，或者您想要使用不存在的字体，那么有一个带有blender的python脚本的教程，允许您将文本导出为Verge3D的JSON格式：[http](http://www.jaanga.com/2012/03/blender-to-threejs-create-3d-text-with.html)： [//www.jaanga.com/2012/03 /blender-to-threejs-create-3d-text-with.html](http://www.jaanga.com/2012/03/blender-to-threejs-create-3d-text-with.html)

### 5.位图字体

BMFonts（位图字体）允许将字形批处理为单个BufferGeometry。BMFont渲染支持自动换行，字母间距，字距调整，带标准导数的带符号距离场，多通道有符号距离场，多纹理字体等。请参阅[three-bmfont-text](https://github.com/Jam3/three-bmfont-text)。

库存字体在[A-Frame Fonts](https://github.com/etiennepinchon/aframe-fonts)等项目中可用 ，或者您可以从任何.TTF字体创建自己的字体，优化以仅包括项目所需的字符。

一些有用的工具：

* [msdf-bmfont-web ](http://msdf-bmfont.donmccurdy.com/)（基于网络）
* [msdf-bmfont-xml ](https://github.com/soimy/msdf-bmfont-xml)（命令行）
* [hiero ](https://github.com/libgdx/libgdx/wiki/Hiero)（桌面应用）


# 绘制线条

Drawing Lines 待校订

假设您要绘制直线或圆，而不是线框网格。首先，我们需要设置渲染器，场景和相机（请参阅创建场景页面）。

这是我们将使用的代码：`var renderer = new v3d.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); var camera = new v3d.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); camera.position.set(0, 0, 100); camera.lookAt(0, 0, 0); var scene = new v3d.Scene();`

接下来我们要做的是定义一种材料。对于行，我们必须使用LineBasicMaterial或LineDashedMaterial。`//create a blue LineBasicMaterial var material = new v3d.LineBasicMaterial({ color: 0x0000ff });`

在材质之后，我们需要一个带有一些顶点的Geometry或BufferGeometry（建议使用BufferGeometry，因为它更高效，但为了简单起见，我们将在这里使用Geometry）：`var geometry = new v3d.Geometry(); geometry.vertices.push(new v3d.Vector3(-10, 0, 0)); geometry.vertices.push(new v3d.Vector3(0, 10, 0)); geometry.vertices.push(new v3d.Vector3(10, 0, 0));`

请注意，在每对连续的顶点之间绘制线条，但不在第一个和最后一个顶点之间绘制线条（线条未关闭）。

现在我们有两条线和一条材料的点，我们可以将它们组合在一起形成一条线。`var line = new v3d.Line(geometry, material);`

剩下的就是将它添加到场景中并调用渲染。`scene.add(line); renderer.render(scene, camera);`

你现在应该看到一个向上的箭头，由两条蓝线组成。


# 更新事物

How to Update Things 待校订

## 如何用代码更新事物

默认情况下，所有对象都会自动更新它们的矩阵（如果它们已添加到场景中）`var object = new v3d.Object3D(); scene.add(object);`或者如果它们是已添加到场景中的另一个对象的子节点：`var object1 = new v3d.Object3D(); var object2 = new v3d.Object3D(); object1.add(object2); scene.add(object1); //object1 and object2 will automatically update their matrices`

但是，如果您知道对象将是静态的，则可以禁用此选项并在需要时手动更新转换矩阵。`object.matrixAutoUpdate = false; object.updateMatrix();`

### 几何形状

#### BufferGeometry

BufferGeometries存储信息（如顶点位置，面指数，法线，色彩，UV的，并且任何自定义属性）在缓冲液 -即， [类型化数组](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays)。这使得它们通常比标准几何图形更快，但代价是更难以使用。

关于更新BufferGeometries，最重要的是要理解你无法调整缓冲区的大小（这非常昂贵，基本上相当于创建一个新的几何体）。但是，您可以更新缓冲区的内容。

这意味着如果您知道BufferGeometry的属性将增长（例如顶点数），则必须预先分配足够大的缓冲区以容纳可能创建的任何新顶点。当然，这也意味着BufferGeometry将有一个最大大小 - 没有办法创建一个可以无限期有效扩展的BufferGeometry。

我们将使用在渲染时扩展的行的示例。我们将在缓冲区中为500个顶点分配空间，但最初只使用BufferGeometry.drawRange绘制两个顶点。`var MAX_POINTS = 500; // geometry var geometry = new v3d.BufferGeometry(); // attributes var positions = new Float32Array(MAX_POINTS * 3); // 3 vertices per point geometry.addAttribute('position', new v3d.BufferAttribute(positions, 3)); // draw range var drawCount = 2; // draw the first 2 points, only geometry.setDrawRange(0, drawCount); // material var material = new v3d.LineBasicMaterial({ color: 0xff0000, linewidth: 2 }); // line var line = new v3d.Line(geometry, material); scene.add(line);`

接下来，我们将使用以下模式随机向线条添加点：`var positions = line.geometry.attributes.position.array; var x, y, z, index; x = y = z = index = 0; for (var i = 0, l = MAX_POINTS; i < l; i++) { positions[index ++] = x; positions[index ++] = y; positions[index ++] = z; x += (Math.random() - 0.5) * 30; y += (Math.random() - 0.5) * 30; z += (Math.random() - 0.5) * 30; }`

如果要更改第一次渲染后渲染*的点数*，请执行以下操作：`line.geometry.setDrawRange(0, newValue);`

如果要在第一次渲染后更改位置数据值，则需要设置needsUpdate标志，如下所示：`line.geometry.attributes.position.needsUpdate = true; // required after the first render`

如果在初始渲染后更改位置数据值，则可能需要调用\`.computeBoundingSphere（）\`以重新计算几何的边界球。`line.geometry.computeBoundingSphere();`

[这是一个小提琴，](http://jsfiddle.net/w67tzfhx/)显示一个动画线，你可以适应你的用例。

#### 例子：

[WebGL / custom / attributes ](https://cdn.soft8soft.com/demo/examples/index.html#webgl_custom_attributes)\
[WebGL / buffergeometry / custom / attributes / particles](https://cdn.soft8soft.com/demo/examples/index.html#webgl_buffergeometry_custom_attributes_particles)

#### 几何

以下标志控制各种几何属性的更新。仅为需要更新的属性设置标志，更新成本很高。缓冲区更改后，这些标志会自动重置为false。如果要继续更新缓冲区，则需要将它们设置为true。请注意，这仅适用于Geometry 而不适用于BufferGeometry。`var geometry = new v3d.Geometry(); geometry.verticesNeedUpdate = true; geometry.elementsNeedUpdate = true; geometry.morphTargetsNeedUpdate = true; geometry.uvsNeedUpdate = true; geometry.normalsNeedUpdate = true; geometry.colorsNeedUpdate = true; geometry.tangentsNeedUpdate = true;`

在[r66](https://github.com/mrdoob/three.js/releases/tag/r66)网格之前的版本中，还需要启用*动态*标志（以保持内部类型化数组）：`//removed after r66 geometry.dynamic = true;`

#### 例子：

[WebGL /几何/动态](https://cdn.soft8soft.com/demo/examples/index.html#webgl_geometry_dynamic)<br>

### 物料

所有制服值都可以自由更改（例如颜色，纹理，不透明度等），每帧都会将值发送到着色器。

此外，GLstate相关参数可以随时更改（depthTest，blend，polygonOffset等）。

平滑/平滑的阴影被烘焙成法线。您需要重置法线缓冲区（见上文）。

在运行时无法轻松更改以下属性（一旦材质至少呈现一次）：

* 制服的数量和类型
* 数字和灯的类型
* 存在与否
  * 质地
  * 多雾路段
  * 顶点颜色
  * 剥皮
  * 变形
  * 阴影贴图
  * 阿尔法测试

这些变化需要构建新的着色器程序。你需要设置`material.needsUpdate = true`

请记住，这可能会非常缓慢并导致帧率的急动（特别是在Windows上，因为着色器编译在DirectX中比OpenGL慢）。

为了获得更流畅的体验，您可以通过“虚拟”值（如零强度灯，白色纹理或零密度雾）在一定程度上模拟这些功能的变化。

您可以自由更改用于几何块的材质，但是无法更改对象如何划分为块（根据面材）。

#### 如果您需要在运行时使用不同的材料配置：

如果材料/块的数量很少，您可以事先预先划分物体（例如，人的头发/脸部/身体/上衣/裤子，前部/侧面/顶部/玻璃/轮胎/内部用于汽车）。

如果数量很大（例如，每个面可能有所不同），请考虑使用不同的解决方案，例如使用属性/纹理来驱动不同的每个面部外观。

#### 例子：

[WebGL /材料/汽车](https://cdn.soft8soft.com/demo/examples/index.html#webgl_materials_cars)\
[WebGL / webgl\_postprocessing / dof](https://cdn.soft8soft.com/demo/examples/index.html#webgl_postprocessing_dof)

### 纹理

如果更改了图像，画布，视频和数据纹理，则需要设置以下标志：`texture.needsUpdate = true;`

渲染目标会自动更新。

#### 例子：

[WebGL /材料/视频](https://cdn.soft8soft.com/demo/examples/index.html#webgl_materials_video)\
[WebGL / rtt](https://cdn.soft8soft.com/demo/examples/index.html#webgl_rtt)

### 相机

相机的位置和目标会自动更新。如果你需要改变

* FOV
* 方面
* 近
* 远

那么你需要重新计算投影矩阵：`camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix();`


# 约定

Conventions 待校订

### 约定汇总表

![Verge3D约定总表](/files/-LcJrU_XTA0bah934jJX)

### Conventions Summary Table

![Conventions Summary Table](/files/-LcJdBbiMAT7SIXGYrBp)


# 获取资源

How to Obtain Sources 待校订

## 如何获取Verge3D源

完整的Verge3D源代码作为Verge3D Enterprise软件包的一部分提供（请参阅[本页](https://www.soft8soft.com/licensing/)的许可证比较图表）。

但是，由于Verge3D基于开源的Three.js框架，因此可以仅使用[GitHub上托管的](https://github.com/mrdoob/three.js) Three.js源来掌握其API和内部结构。

如果您在使用任何API方法时遇到困难，请查看Verge3D [示例应用程序](https://cdn.soft8soft.com/demo/examples/index.html)或咨询Soft8Soft [论坛](https://www.soft8soft.com/forums/)上的Verge3D开发人员和社区。


# Animation


# AnimationAction

## AnimationAction

AnimationActions调度存储在AnimationClips中的动画的表现。\
注意：大多数AnimationAction的方法都可以链接。\
有关Verge3D动画系统的不同元素的概述，请参阅本手册“后续步骤”部分中的“动画系统”一文。

### 构造函数

#### AnimationAction(mixer : AnimationMixer, clip : AnimationClip, localRoot : Object3D)

mixer - the **AnimationMixer** that is controlled by this action.\
clip - the **AnimationClip** that holds the animation data for this action.\
localRoot - the root object on which this action is performed.\
\
注意：不应直接调用此构造函数，而应使用AnimationMixer.clipAction实例化AnimationAction，因为此方法提供了缓存以获得更好的性能。

### 属性

#### #.clampWhenFinished : Boolean

If **clampWhenFinished** is set to true the animation will automatically be paused on its last frame.\
\
如果**clampWhenFinished**设置为false，则在操作的最后一个循环结束时，enabled将自动切换为false，因此该操作不会产生进一步的影响。\
\
默认值为false。\
\
Note: **clampWhenFinished** has no impact if the action is interrupted (it has only an effect if its last loop has really finished).

#### #.enabled : Boolean

Setting **enabled** to **false** disables this action, so that it has no impact. Default is **true**.\
\
When the action is re-enabled, the animation continues from its current time (setting **enabled** to **false** doesn't reset the action).\
\
Note: Setting **enabled** to **true** doesn’t automatically restart the animation. Setting **enabled** to **true** will only restart the animation immediately if the following condition is fulfilled: paused is **false**, this action has not been deactivated in the meantime (by executing a stop or reset command), and neither weight nor timeScale is 0.

#### #.loop : Number

The looping mode (can be changed with setLoop). Default is v3d.LoopRepeat (with an infinite number of repetitions)\
\
Must be one of these constants:\
\
v3d.LoopOnce - playing the clip once,\
v3d.LoopRepeat - playing the clip with the choosen number of **repetitions**, each time jumping from the end of the clip directly to its beginning,\
v3d.LoopPingPong - playing the clip with the choosen number of **repetitions**, alternately playing forward and backward.

#### #.paused : Boolean

Setting **paused** to **true** pauses the execution of the action by setting the effective time scale to 0. Default is **false**.\ <br>

#### #.repetitions : Number

The number of repetitions of the performed AnimationClip over the course of this action. Can be set via setLoop. Default is **Infinity**.\
\
Setting this number has no effect, if the loop mode is set to v3d.LoopOnce.

#### #.time : Number

The local time of this action (in seconds, starting with 0).\
\
The value gets clamped or wrapped to 0...clip.duration (according to the loop state). It can be scaled relativly to the global mixer time by changing timeScale (using setEffectiveTimeScale or setDuration).<br>

#### #.timeScale : Number

Scaling factor for the time. A value of 0 causes the animation to pause. Negative values cause the animation to play backwards. Default is 1.\
\
Properties/methods concerning **timeScale** (respectively **time**) are: getEffectiveTimeScale, halt, paused, setDuration,setEffectiveTimeScale, stopWarping, syncWith, warp.

#### #.timeStart : Number

The local start time for this action (in seconds). Use with AnimationClip.duration to set the playback range.\ <br>

#### #.weight : Number

The degree of influence of this action (in the interval \[0, 1]). Values between 0 (no impact) and 1 (full impact) can be used to blend between several actions. Default is 1. \
\
Properties/methods concerning **weight** are: crossFadeFrom, crossFadeTo, enabled, fadeIn, fadeOut, getEffectiveWeight,setEffectiveWeight, stopFading.

#### #.zeroSlopeAtEnd : Boolean

Enables smooth interpolation without separate clips for start, loop and end. Default is **true**.

#### #.zeroSlopeAtStart : Boolean

Enables smooth interpolation without separate clips for start, loop and end. Default is **true**.

### 方法

#### #.crossFadeFrom (fadeOutAction : AnimationAction, durationInSeconds : Number, warpBoolean : Boolean) : AnimationAction

Causes this action to fade in, fading out another action simultaneously, within the passed time interval. This method can be chained.\
\
If warpBoolean is true, additional warping (gradually changes of the time scales) will be applied.\
\
Note: Like with **fadeIn**/**fadeOut**, the fading starts/ends with a weight of 1.

#### #.crossFadeTo (fadeInAction : AnimationAction, durationInSeconds : Number, warpBoolean : Boolean) : AnimationAction

Causes this action to fade out, fading in another action simultaneously, within the passed time interval. This method can be chained.\
\
If warpBoolean is true, additional warping (gradually changes of the time scales) will be applied.\
\
Note: Like with **fadeIn**/**fadeOut**, the fading starts/ends with a weight of 1.

#### #.fadeIn (durationInSeconds : Number) : AnimationAction

Increases the weight of this action gradually from 0 to 1, within the passed time interval. This method can be chained.

#### #.fadeOut (durationInSeconds : Number) : AnimationAction

Decreases the weight of this action gradually from 1 to 0, within the passed time interval. This method can be chained.

#### #.getEffectiveTimeScale () : Number

Returns the effective time scale (considering the current states of warping and paused).

#### #.getEffectiveWeight () : number

Returns the effective weight (considering the current states of fading and enabled).

#### #.getClip () : AnimationClip

Returns the clip which holds the animation data for this action.

#### #.getMixer () : AnimationMixer

Returns the mixer which is responsible for playing this action.

#### #.getRoot () : Object3D

Returns the root object on which this action is performed.

#### #.halt (durationInSeconds : Number) : AnimationAction

Decelerates this animation's speed to 0 by decreasing timeScale gradually (starting from its current value), within the passed time interval. This method can be chained.

#### #.isRunning () : Boolean

Returns true if the action’s time is currently running.\
\
In addition to being activated in the mixer (see isScheduled) the following conditions must be fulfilled: paused is equal to false, enabled is equal to true, timeScale is different from 0, and there is no scheduling for a delayed start (startAt).\
\
Note: **isRunning** being true doesn’t necessarily mean that the animation can actually be seen. This is only the case, if weight is additionally set to a non-zero value.

#### #.isScheduled () : Boolean

Returns true, if this action is activated in the mixer.\
\
Note: This doesn’t necessarily mean that the animation is actually running (compare the additional conditions for isRunning).

#### #.play () : AnimationAction

Tells the mixer to activate the action. This method can be chained.\
\
Note: Activating this action doesn’t necessarily mean that the animation starts immediately: If the action had already finished before (by reaching the end of its last loop), or if a time for a delayed start has been set (via startAt), a reset must be executed first. Some other settings (paused=true, enabled=false, weight=0, timeScale=0) can prevent the animation from playing, too.

#### #.reset () : AnimationAction

Resets the action. This method can be chained.\
\
This method sets paused to false, enabled to true, time to 0, interrupts any scheduled fading and warping, and removes the internal loop count and scheduling for delayed starting.\
\
Note: .**reset** is always called by stop, but .**reset** doesn’t call .**stop** itself. This means: If you want both, resetting and stopping, don’t call .**reset**; call .**stop** instead.

#### #.setDuration (durationInSeconds : Number) : AnimationAction

Sets the duration for a single loop of this action (by adjusting timeScale and stopping any scheduled warping). This method can be chained.

#### #.setEffectiveTimeScale (timeScale : Number) : AnimationAction

Sets the timeScale and stops any scheduled warping. This method can be chained.\
\
If paused is false, the effective time scale (an internal property) will also be set to this value; otherwise the effective time scale (directly affecting the animation at this moment) will be set to 0.\
\
Note: .**paused** will not be switched to **true** automatically, if .**timeScale** is set to 0 by this method.

#### #.setEffectiveWeight (weight : Number) : AnimationAction

Sets the weight and stops any scheduled fading. This method can be chained.\
\
If enabled is true, the effective weight (an internal property) will also be set to this value; otherwise the effective weight (directly affecting the animation at this moment) will be set to 0.\
\
Note: .**enabled** will not be switched to **false** automatically, if .**weight** is set to 0 by this method.

#### #.setLoop (loopMode : Number, repetitions : Number) : AnimationAction

Sets the loop mode and the number of repetitions. This method can be chained.

#### #.startAt (startTimeInSeconds : Number) : AnimationAction

Defines the time for a delayed start (usually passed as AnimationMixer.time + deltaTimeInSeconds). This method can be chained.\
\
Note: The animation will only start at the given time, if .**startAt** is chained with play, or if the action has already been activated in the mixer (by a previous call of .**play**, without stopping or resetting it in the meantime).

#### #.stop () : AnimationAction

Tells the mixer to deactivate this action. This method can be chained.\
\
The action will be immediately stopped and completely reset.\
\
Note: You can stop all active actions on the same mixer in one go via mixer.stopAllAction.

#### #.stopFading () : AnimationAction

Stops any scheduled fading which is applied to this action. This method can be chained.

#### #.stopWarping () : AnimationAction

Stops any scheduled warping which is applied to this action. This method can be chained.

#### #.syncWith (otherAction : AnimationAction) : AnimationAction

Synchronizes this action with the passed other action. This method can be chained.\
\
Synchronizing is done by setting this action’s time and timeScale values to the corresponding values of the other action (stopping any scheduled warping).\
\
Note: Future changes of the other action's **time** and **timeScale** will not be detected.

#### #.warp (startTimeScale : Number, endTimeScale : Number, durationInSeconds : Number) : AnimationAction

Changes the playback speed, within the passed time interval, by modifying timeScale gradually from **startTimeScale** to **endTimeScale**. This method can be chained.

### 事件

There are two events indicating when a single loop of the action respectively the entire action has finished. You can react to them with:`mixer.addEventListener('loop', function(e) { …}); // properties of e: type, action and loopDelta mixer.addEventListener('finished', function(e) { …}); // properties of e: type, action and direction`

### 资源

有关如何获取此模块源代码的详细信息，请参阅[此页面](http://www.soft8soft.com/docs/manual/en/introduction/How-to-obtain-Verge3D-sources.html)。


# AnimationClip


# AnimationMixer


# AnimationObjectGroup


# AnimationUtils


# KeyframeTrack


# PropertyBinding


# PropertyMixer


# Animation / Tracks


# BooleanKeyframeTrack


# ColorKeyframeTrack


# NumberKeyframeTrack


# QuaternionKeyframeTrack


# StringKeyframeTrack


# VectorKeyframeTrack


# Application


# App


# AppPuzzles


# AppUtils


# Audio


# Audio


# AudioAnalyser


# AudioContext


# AudioListener


# PositionalAudio


# Cameras


# ArrayCamera


# Camera


# CubeCamera


# OrthographicCamera


# PerspectiveCamera


# StereoCamera


# Constants


# Animation


# Core


# CustomBlendingEquation


# DrawModes


# DrawModes


# Materials




---

[Next Page](/llms-full.txt/1)

