cg小白兔 发表于 2024-1-4 14:59:19

【更新】Impostors - Runtime Optimization 2.0.1

本帖最后由 微笑的猫 于 2024-1-5 10:48 编辑


Impostors - Runtime Optimization 系列索引

Impostors - Runtime Optimization 0.9.6   下载链接
Impostors - Runtime Optimization 1.0.1下载链接
Impostors - Runtime Optimization 1.0.2下载链接
Impostors - Runtime Optimization 1.0.3下载链接
Impostors - Runtime Optimization 1.0.5下载链接

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 custom RP (requires a bit of coding to embed impostors into RP)
NO OFFICIAL SUPPORT FOR HDRP
Supported platforms:
Every platform that supports render textures, which is almost every platform supported by Unity.
WebGL is an exception because it doesn't work with the multithreading Jobs System.



考虑到 DOTS 的下一代冒名顶替系统资产。
在创建大型世界时,向用户展示背景中有大量物体的大型场景非常重要。这是一项艰巨的任务,需要优化着色器、材质、网格等。

在冒牌货的帮助下,您可以大大简化这项任务!
冒牌货--假对象(quad),试图看起来像其原始对象。它的渲染成本很低,但需要在性能和视觉质量之间做出权衡。

我们其实并不需要远距离的高视觉质量,因为远处的物体在屏幕上只占很小的空间。这就是为什么有 LOD(细节层次)这样的技术。

冒牌货扩展了这种方法,在某些情况下甚至可以完全取代它。

为什么要使用冒牌货?
LOD 有几个问题
需要为每个对象手动创建额外的资产--具有较少多边形和材质的网格、
这些附加资产会增加构建大小、
LOD 之间可能存在明显差异,当玩家移动时,LOD 会弹出或弹入。

弹出问题确实很难解决,因为这需要在性能和视觉质量之间做出权衡。但有了冒牌货,我们就可以解决前两个问题:

冒牌货不需要手动创建额外的资产、
冒名顶替不会增加构建大小、
冒牌货可与风格化的自定义阴影一起使用、
在完美的情况下,冒牌物件看起来与原始物件一模一样。

冒牌货的工作原理
冒牌货的概念非常简单。我们只需从特定角度拍摄一张对象的照片,然后将这张照片显示为一个精灵,而不是原始对象。精灵的渲染成本极低:它们使用特殊的着色器,无需闪电计算,只需绘制 2 个三角形。每当摄像机改变位置时,我们都需要重新生成照片,以便从新的角度表现对象。

重要说明
我们再次在性能和视觉质量之间进行了权衡。
冒牌货不是万能的,无法取代标准渲染。
但是,如果您的项目符合某些条件,它可以为您提供机会,让您的场景充满大量远处的细节。

何时使用冒牌货
在继续本章之前,我想说的是:如果您对在项目中使用冒牌货有任何疑问或问题,请随时与我联系,并提供一些游戏画面,或至少提供您的游戏的高级概述。我会尽力回答您的问题,让您知道冒牌货是否适合您的项目。

最后要说明的是,Asset Store 提供退款服务,我从未拒绝过退款请求,所以您可以放心。
1. 摄像头很少改变位置
冒牌货的最佳方案!
重新生成冒名顶替者的图像是一个渲染操作,我们尽量避免这种操作。当摄像头不动时,我们不需要更新任何内容。

类型 带有传送移动或稳定游戏的 VR、视觉小说、侧滚动游戏。
2. 第一人称角色摄像头
与冒名顶替者完美配合!
类型:开放世界 FPS、皇室战争、生存游戏。

3. 飞行或俯视摄像机
这种相机行为需要不断再生冒牌货的照片,导致性能提升较少。不过,我不能说这类游戏中不能使用冒牌货!示例场景就展示了这种情况。

4. 快节奏的镜头移动
冒牌货的弱点。
赛车和飞行模拟器等游戏可能无法像其他游戏那样与冒牌货完美配合。这取决于您想要实现的目标。请随时与我联系,我们将尝试了解您的项目是否可以使用冒牌货。

5. 带有程序对象的游戏
如果您的游戏有程序生成的网格,我怀疑您是否有它们的 LOD:)。

在这种情况下,Impostors 软件包就派上用场了,因为它能在运行时生成一切!

6. 低多边形游戏
这取决于您所使用的平台以及您希望在场景中呈现的物体数量。一般来说,对于低多边形数量的游戏,Impostors 是多余的。

限制
- 需要支持前向渲染和 RGBA ColorMask 的着色器。
- 每当光照条件发生变化时,冒牌货的图像都需要更新。
- 在近距离内很容易区分冒牌货和原物体,因此冒牌货最多只能在摄像头屏幕尺寸的 10%处使用。
- 目前,Impostors 不支持半透明对象。只支持不透明和 AlphaTest/Cutout 着色器。
- 目前,Impostors 只支持一种方向光和环境光。

功能特点
大幅减少多边形和绘制调用次数
可使用风格化自定义着色
无需资产预处理和烘焙
无需额外资产
不增加构建大小
运行时生成所有内容
快速设置
多个摄像头
虚拟现实(使用 Oculus Quest 测试)
使用 "工作 "和 "突发 "功能实现最高性能
支持移动物体

依赖性
Unity 2020.3.16 - 2023.1.X
突发
数学
收集
支持的渲染管道:
内置
通用
可在自定义 RP 中使用(需要一些编码才能嵌入图像




页: [1]
查看完整版本: 【更新】Impostors - Runtime Optimization 2.0.1