没弄懂的 Texture Mipmap Streaming (Unity 2018.2)

首先,没弄懂 这个东西是否带来了性能上的提升?

它用少量CPU资源以节省潜在的大量GPU内存。

        Texture mipmap Streaming系统使您可以控制实际加载到内存中的mipmap级别。 通常Unity会加载存储在磁盘上的所有mipmap级别,但是使用此系统,您可以直接控制加载哪些mipmap级别。

      通常,这样的系统通过仅加载渲染场景中当前相机位置所需的mipmap来减少纹理所需的总内存量。 它可以节省少量CPU成本,从而节省大量GPU内存。

在维京村的场景中,系统节省了25-30%的纹理内存,具体取决于相机的位置。

https://docs.unity3d.com/Manual/AsyncTextureUpload.html

这个异步纹理上传 和 Texture Streaming 有关系么????

 

使命召唤手游有 使用 : Texture Streaming

https://mp.weixin.qq.com/s?src=11&timestamp=1563935430&ver=1747&signature=qIm5L3zeFnOXEUDvHZn0BMxfp1TMSsc7e9cPfY4CEwtFIS4wzaMGEchnXLOE*7NPjmxY9rO2WSANiqc*ujdkEanX7o6njUbrLaJutf4clUjAJfg7bSW4OTHHloVpGEsM&new=1

-----------------------------------------------------

https://unity3d.com/fr/learn/tutorials/topics/best-practices/textures?playlist=30089

GPU上传 (GPU Upload)

完成加载后,Unity会将纹理直接上传到GPU,并且不会等到纹理在摄像机视锥中看到。

当加载线程完成加载场景或资产时,Unity需要唤醒它们。加载的位置和方式取决于Unity版本和用于初始化加载的调用。

加载行为

           如果从AssetBundles,Resources或Scenes加载资产,Unity会从预加载线程(磁盘I / O)转到图形线程(GPU上载)。如果您使用Unity 5.5或更高版本,并且启用了图形作业,Unity会从预加载作业直接进入GPU。

觉醒行为

           在唤醒所有场景游戏对象后,Unity直接唤醒主线程上的资产。如果使用AssetBundle.LoadAssetResources.LoadSceneManager.LoadScene来加载资产和场景,Unity会阻止主线程并唤醒所有资产。如果您正在使用这些调用的非阻塞版本(例如,AssetBundle.LoadAssetAsync),Unity会使用时间切片来唤醒资产。

记忆行为

          在一次加载多个纹理时,如果上传速度不够快或主线程停止,您可以调整纹理缓冲区。但是,更改默认值可能会导致高内存压力。在Unity指南中的Memory ManagementRingBuffer部分中使用时间片唤醒时,您可以阅读有关纹理缓冲区中内存限制的更多信息。

注意:如果GPU内存过载,GPU会卸载最近最少使用的纹理,并强制CPU在下次进入相机平台时重新上传它。

https://docs.unity3d.com/560/Documentation/Manual/AsyncTextureUpload.html

异步纹理上传

          异步纹理上载允许从磁盘异步加载纹理数据,并在Render-thread上启用时间片上传到GPU。这减少了主线程中GPU上传的等待时间。

笔记

          对于非读/写启用的纹理,TextureData是resS(流媒体资源)的一部分,现在上传发生在Render-Thread上。在调用AwakeFromLoad之前,可以保证Texture的可用性,因此在加载顺序或渲染上的Textures的可用性方面没有变化。

对于其他类型的纹理加载,例如启用读/写的纹理,直接使用LoadImage(byte []数据)函数加载的纹理,或从Resources文件夹加载,不使用异步缓冲区加载 - 使用较旧的同步方法。

优化加载性能:了解异步上载管道》中文翻译: https://mp.weixin.qq.com/s?__biz=MzU5MjQ1NTEwOA==&mid=2247495299&idx=1&sn=8f0a56a98a3c17fb6ccfacbccbda3000&chksm=fe1dda28c96a533e8fdfcf8feb5b41ccd595d66cd31968a5748413dacc95ae9e2f78f4d7802d&scene=21#wechat_redirect

Texture Mipmap Streaming()2018.2 》 有很多调试脚本的功能!!!!

https://docs.unity3d.com/Manual//TextureStreaming.html

https://docs.unity3d.com/Manual//TextureStreaming-API.htm

---------------------------------------------------------------------------------------------------------

转载自:   https://docs.google.com/document/d/1P3OUoQ_y6Iu9vKcI5B3Vs2kWhQYSXe02h6YrkDcEpGM/edit#

 警告: 文章中给的脚本 太容易导致闪退了, 我在编辑器下2018.2 版本中测试,必闪退!!!

Texture Mipmap Streaming (Unity 2018.2)

Overview

The Texture mipmap Streaming system gives you control over which mipmap levels are actually loaded into memory. Normally Unity will load all the mipmap levels that are stored on the disk, but with this system you can take direct control over which mipmap levels are loaded.

Typically a system like this is used to reduce the total amount of memory required for textures by only loading the mipmaps needed to render the current camera position in a scene. It trades a small amount of CPU cost for a potentially large GPU memory saving.

In the viking village scene the system saved 25-30% texture memory, depending on camera location.

There are two ways you can use this system. If you enable Streaming mipmaps on textures, the engine will try to ‘do the right thing’ and load appropriate mipmaps while observing the texture budget. For more low level control you can use the C# API to specify mipmap levels. These two systems can be used in conjunction with each other.

Moving large distances quickly or instantaneous camera cuts can cause noticeable texture quality changes as the mipmaps are streamed in. The API supports features for preloading mipmaps at a new camera location to reduce this problem.

Features

  • Engine support for picking the appropriate mipmap level based on camera view.

  • C# API to request a specific mipmap level for a texture.

  • Sample C# code that duplicates the engine logic for mipmap selection. This allows you to override the engine logic for your own use cases.

  • Set a total budget to be used by all textures in a game. Unity will automatically reduce mipmap levels in order to hit this budget. 

  • The budget includes non streaming textures so if your budget is 100MB and you have 90MB of non streaming textures Unity will try to fit all the streaming textures in 10MB.

Setup

Enable the feature and set the memory budget in the Quality Settings Panel.

 

For the textures you want to enable mipmap streaming set the ‘Streaming Mi

  • 6
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值