找回密码
 立即注册
搜索

[编辑器/功能拓展] Impostors - Runtime Optimization 1.0.2运行时优化工具

[复制链接]
88 |0
发表于 2023-8-4 12:19:32 | 显示全部楼层 |阅读模式














Next generation of Imposter System asset with DOTS in mind.

When creating big worlds it's important to show users large-scale scenes with lots of objects in the background. That's a tough task that requires optimizing shaders, materials, meshes, and so on.

With the help of Impostors, you can greatly simplify this task!

Impostor - fake object(quad), that tries to look like its original object. It's very cheap to render but with a trade-off between performance and visual quality.

We don't really need high visual quality at distance, because distant objects take tiny space on the screen. That's why there are techniques like LODs (Level Of Detail).

Impostors expand this approach, and in some cases can completely replace it.

Why impostors?
There are several problems with LODs
it requires manually creating additional assets for each object - meshes with fewer polygons and materials,
these additional assets increase build size,
there might be a noticeable difference between LODs, which pop in and out when player moves.

Poping problem is really hard to solve because it's just the trade-off between performance and visual quality. But with Impostors we can solve the first two issues:

impostors don't require manually creating additional assets,
impostors don't increase build size,
impostors work with stylized custom shading,
in perfect scenarios impostors look exactly like the original objects.

How impostors work
The concept of impostors is quite simple. We just take a photo of the object from a specific angle, and then show this photo as a sprite instead of the original object. Sprites are super cheap to render: they use special shader without lightning calculation and require only 2 triangles to draw. Whenever camera changes position we need to regenerate the photo to represent object from a new angle.

Important note
Again, we stuck with the trade-off between performance and visual quality.
Impostors are not a panacea and cannot replace standard rendering.
But it provides the opportunity to fill your scene with lots of distant details if your project fits several conditions.

When to use impostors
Before we continue with this chapter I want to mention: if you have any doubts or questions about impostors working with your project, feel free to contact me with some gameplay footage or at least a high-level overview of what is going on in your game. I will try my best to answer your questions and let you know whether Impostors fits your project.

Last note, Asset Store provides refunds, and I have never rejected refund requests, so you are covered.

1. Camera rarely changes position
The best scenario for impostors!
Regenerating impostor's image is a rendering operation, which we are trying to avoid as much as possible. When camera doesn't move we don't need to update anything.

Genres: VR with teleportation movement or steady gameplay, visual novels, side-scrollers.

2. First-person character camera
Works perfectly with impostors!
Genres: open-world FPS, battle-royal, survivals.

3. Flying or top-down camera
Such camera behavior requires constantly regenerating photos of impostors, which leads to way less performance boost. However, I can't say that impostors cannot be used in such games! Example scene shows exactly that scenario.

4. Fast-paced camera movement
The weak part of impostors.
Games like racing and flying simulators might not work with impostors as good as others. It depends on what you are trying to achieve. Feel free to contact me and we will try to understand whether your project works with impostors or not.
5. Games with procedural objects
If your game has procedurally generated meshes, I doubt you have LODs for them

In such a situation Impostors package comes handy because it generates everything at runtime!

6. Low-poly games
It depends on the platform you targeting and the count of objects you want to present in your scene. Generally speaking, impostors are overkill for games with a low poly count.

Limitations
- Requires shaders that support forward rendering and RGBA ColorMask.
- Whenever lighting condition changes impostors' images need to be updated.
- At a close distance it's quite easy to distinguish impostor from the original object, so they must be used at most at 10% of camera screen size.
- For now, Impostors doesn't support semi-transparent objects. Only Opaque and AlphaTest/Cutout shaders.
- For now, Impostors supports only one directional light plus ambient light.

Features:
Significant decrease in poly and drawcall counts
Works with stylized custom shading
No asset pre-processing, no baking
No additional assets
Doesn't increase build size
Generates everything at runtime
Fast setup
Multiple cameras
VR (tested with Oculus Quest)
Utilizes max performance using Jobs and Burst
Supports moving objects

Dependencies:
Unity 2020.3.16 - 2023.1.X
Burst
Mathematics
Collections
Supported Render Pipelines:
Built-in
Universal
It may be used in custo


下一代冒名顶替系统资产与DOTS的思想。

在创造大的世界时,向用户展示具有大量背景对象的大型场景是很重要的。这是一项艰巨的任务,需要优化着色器、材料、网格等。

在冒名顶替者的帮助下,您可以大大简化这项任务!

冒名顶替者-伪造对象(四元),试图看起来像它的原始对象。渲染成本很低,但需要在性能和视觉质量之间进行权衡。

我们真的不需要远距离的高视觉质量,因为远处的物体在屏幕上只占很小的空间。这就是为什么会出现lod(细节水平)之类的技术。

冒名顶替者扩展了这种方法,在某些情况下可以完全取代它。

为什么骗子?
lod有几个问题
它需要手动为每个对象创建额外的资产-网格与更少的多边形和材料,
这些额外的资产增加了建筑规模,
lod之间可能存在明显的差异,即当玩家移动时它们会出现或消失。

弹出问题真的很难解决,因为它只是性能和视觉质量之间的权衡。但是使用Impostors我们可以解决前两个问题:

冒名顶替者不需要手动创建额外的资产,
冒牌货不会增加建筑尺寸,
冒名顶替者使用风格化的自定义阴影,
在完美的场景中,冒名顶替者看起来和原作一模一样。

骗子是如何运作的
冒名顶替者的概念很简单。我们只是从一个特定的角度拍摄对象的照片,然后将这张照片作为精灵而不是原始对象显示。精灵的渲染成本非常低:它们使用特殊的着色器,不需要闪电计算,只需要绘制2个三角形。每当相机改变位置时,我们需要重新生成照片以从新的角度表示物体。

重要提示
再一次,我们坚持在性能和视觉质量之间进行权衡。
冒名顶替者不是万能的,也不能取代标准的渲染。
但如果你的项目符合几个条件,它提供了用许多遥远的细节填充场景的机会。

什么时候使用骗子
在我们继续这一章之前,我想提一下:如果你对冒名顶替者在你的项目中的工作有任何疑问或疑问,请随时与我联系,提供一些游戏玩法素材或至少是游戏中发生的高级概述。我会尽力回答你的问题,让你知道Impostors是否适合你的项目。

最后注意,Asset Store提供退款,我从来没有拒绝过退款请求,所以您可以退款。

1. 摄像机很少改变位置
这对骗子来说是最好的场景!
重新生成冒名者的图像是一个渲染操作,这是我们尽可能避免的。当摄像机不移动时,我们不需要更新任何东西。

类型:带有传送运动或稳定游戏玩法的VR,视觉小说,横向卷轴。

2. 第一人称角色摄像机
与骗子完美合作!
类型:开放世界FPS, battle-royal, survival。

3.飞行或自上而下的相机
这样的相机行为需要不断地重新生成冒名顶替者的照片,这导致了性能提升的减少。但是,我不能说在这样的游戏中不能使用冒名顶替者!示例场景准确地展示了该场景。

4. 快节奏摄像机移动
骗子的薄弱部分。
赛车和飞行模拟器等游戏可能不像其他游戏那样适合冒名顶替者。这取决于你想要达到什么目标。请随时与我联系,我们将尝试了解您的项目是否与冒名顶替者一起工作。
5. 带有程序对象的游戏
如果你的游戏有程序生成的网格,我怀疑你是否有适合它们的lod

在这种情况下,Impostors包很方便,因为它在运行时生成一切!

6. 低多边形游戏
这取决于你的目标平台和你想在场景中呈现的对象数量。一般来说,对于多边形数较低的游戏来说,冒名者是多余的。

限制
-需要着色器支持前向渲染和RGBA颜色蒙版。
-当光照条件改变时,冒充者的图像需要更新。
-在近距离很容易区分冒名顶替者和原始对象,所以他们必须使用最多10%的相机屏幕尺寸。
目前,Impostors不支持半透明对象。只有不透明和alpha /Cutout着色器。
-目前,Impostors只支持一个方向光加上环境光。

特点:
显着减少poly和drawcall计数
工作与风格化的自定义阴影
没有资产预处理,没有烘焙
无额外资产
不会增加构建尺寸
在运行时生成所有内容
快速设置
多个摄像头
VR (Oculus Quest测试)
利用最大的性能使用工作和突发
支持移动对象

依赖关系:
Unity 2020.3.16 - 2023.1.X
破裂
数学
集合
支持的渲染管道:
内置的
通用
它可以用于海关





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表