纹理优化
Textures are often the most frequently used and the most memory-consuming assets. Big projects with a huge number of assets have to face the optimization stage to improve performance and have acceptable FPS.纹理通常是最常用和最消耗内存的资源。拥有大量资源的大型项目必须面临优化阶段以提高性能并具有可接受的 FPS。
An overview of the project's bottlenecks is given by Performance Profiler. By using the Rendering Performance Profiler, you can estimate the amount of video memory consumed by textures.项目瓶颈的概述如下性能分析器.通过使用Rendering Performance Profiler ,您可以估计纹理消耗的视频内存量。
Adjust the global Textures Settings to quickly choose the desired Quality or Maximum Resolution of all textures in the project and thus decrease the video memory consumption. Mipmaps of lower resolution are used for rendering textures of lower quality.调整全局纹理设置快速选择项目中所有纹理的所需质量或最大分辨率,从而减少视频内存消耗。较低分辨率的 Mipmap 用于渲染较低质量的纹理。
Asynchronous Streaming异步流#
Asynchronous Data Streaming of graphic resources ensures smooth texture loading without spikes and other impacts on performance at the first moments of run time.异步数据流图形资源确保平滑加载纹理,在运行时的最初时刻不会出现峰值和其他对性能的影响。确保它为您的世界启用了大量纹理,这些纹理肯定不适合视频内存。
为了确保不超过显存预算,有一个内存限制来控制释放不必要的资源。这个限制在渲染分析器中作为 VRAM Textures 的第二个值(斜杠之后)可用。请注意,这个设置只是对引擎的建议,如果渲染当前帧需要纹理,则可能超过指定的内存限制。
为纹理设置较低的内存限制是不合理的,因为在这种情况下,纹理会不断地从磁盘存储中重新加载,从而影响性能。
纹理缓存用于在加载全尺寸纹理时进行渲染也会占用视频内存。虽然它通常占用很少的空间,但请考虑降低分辨率,从而降低缓存纹理的大小以获得更多可用内存。
Texture Formats纹理格式#
You can control each texture asset in its Import Parameters.您可以控制其中的每个纹理资源导入参数.
It is usually inappropriate to use textures with the Unchanged option enabled unless they have the *.dds or *.texture format. Otherwise, compression may affect the color data a lot (like with custom hdri textures).通常不适合使用启用了 Unchanged 选项的纹理,除非它们具有 *.dds 或 *.texture 格式。否则,压缩可能会对颜色数据产生很大影响(例如使用自定义 hdri 纹理)。
It is crucial to use the correct Texture Preset for every texture, depending on its applicability. Thus, you ensure to use only needed channels and apply a proper compression algorithm. If the list does not provide a required preset, you can select the Custom option and choose the needed options.使用正确的方法很重要纹理预设对于每种纹理,取决于其适用性。因此,您确保只使用需要的通道并应用适当的压缩算法。如果列表未提供所需的预设,您可以选择 Custom 选项并选择所需的选项。
You can also manually select the desired resolution of the texture in the Import Options.您也可以手动选择所需的纹理分辨率导入选项.
Texture ProfilerTexture Profiler#
To clearly understand which assets can be optimized or deleted, Texture Profiler is used. Using this tool, you can see how much memory every texture used in the project takes, easily find it in Asset Browser, and delete or resize it.为了清楚地了解可以优化或删除哪些资源,使用了 Texture Profiler。使用此工具,您可以查看项目中使用的每个纹理占用了多少内存,在 Asset Browser 中轻松找到它,并删除或调整它的大小。
To open the Texture Profiler window, choose Tools -> Content Profiler on the Menu Bar of UnigineEditor and switch to the Textures tab. By using the Location switch, you can choose to inspect the textures either from the entire video memory or only the ones displayed in the Editor viewport at the moment.要打开 Texture Profiler 窗口,请在 UnigineEditor 的菜单栏上选择 Tools -> Content Profiler 并切换到 Textures 选项卡。通过使用 Location 开关,您可以选择从整个视频内存中检查纹理,所有仅显示在编辑器视口中的纹理。
Texture Profiler allows sorting by path, extension, occupied RAM or Video Memory size, format, or resolution.Texture Profiler 允许按路径、扩展名、占用的 RAM 或显存大小、格式或分辨率进行排序。