NinjaLive is providing real time, responsive fluid simulation inside Unreal. For baking fluid simulation, see NinjaTools NinjaLive 正在 Unreal 中提供实时、响应式流体模拟。有关流体模拟的烘焙,请参见 NinjaTools。
Multiple fluidsim components in a single character 多个流体模拟组件在一个角色中
LINK
Hands: two dedicated sim components tracking all fingers 手:两个专用的模拟组件跟踪所有手指
LINK
2. Introduction 2. 引言
FluidNinja LIVE is providing real time, responsive fluid simulation for PC and Console developers, inside Unreal. Following a 5 minute setup (see Chapter 9), responsive fluid simulation Actors could be placed on level. Live ActorComponent could be added to user defined Actors and drive other Components (eg. Niagara, VolumeSmoke, Fog). Live is easy to customize, features Preset based sim management and user editable Output Materials. All-in-one tutorial video: LINK FluidNinja LIVE 为 PC 和主机开发者提供实时、响应式流体模拟,集成在 Unreal 中。经过 5 分钟的设置(见第 9 章),可以在关卡中放置响应式流体模拟 Actor。可以将 Live ActorComponent 添加到用户定义的 Actor,并驱动其他组件(例如 Niagara、VolumeSmoke、Fog)。Live 易于自定义,具有基于预设的模拟管理和用户可编辑的输出材质。全方位教程视频:链接
2.1 Inputs 2.1 输入
Niagara Particles (position, velocity), StaticMeshes, PhysicsBodies (position, size and velocity), Skeletal Meshes (bone position and velocity), Textures and Materials (density, velocity) SceneCaptureCamera, Streaming video, User gestures (via mouse and touchscreen) 尼亚加拉粒子(位置,速度),静态网格,物理体(位置,大小和速度),骨骼网格(骨骼位置和速度),纹理和材质(密度,速度),场景捕捉相机,流媒体视频,用户手势(通过鼠标和触摸屏)
2.2 Level & game design 2.2 关卡与游戏设计
Live offers LOD, Proximity based Sleep/Wake and Memory Pooling - supporting a design approach with multiple sim containers placed on level and attached to characters. Live 1.7 comes with complete World-Space support, driving Volumes, Niagara particles, Landscape Materials and Foliage - enabling users to drive all dynamic systems with fluidsim. Live 提供 LOD、基于距离的睡眠/唤醒和内存池支持——支持将多个模拟容器放置在关卡上并附加到角色的设计方法。Live 1.7 配备完整的世界空间支持,驱动体积、Niagara 粒子、地形材质和植被——使用户能够通过流体模拟驱动所有动态系统。
2.3 Rendering 2.3 渲染
Live uses 2D fluid simulation, combined with technology that makes it behave like a volume 实时使用 2D 流体模拟,结合使其表现得像一个体积的技术
A. Camera Projection is using a volume to track objects in the sim area, mapping 3D positional and velocity data to the 2D sim using Line Trace from the camera - or from a user defined point A. 相机投影使用一个体积来跟踪模拟区域中的物体,将 3D 位置和速度数据映射到使用相机的线性追踪或用户定义点的 2D 模拟中。
B. ScreenSpace: in case we are running the sim on a camera facing plane, viewers could walk around the interaction volume, while the patterns generated by overlapping objects appear in the correct spatial position. B. 屏幕空间:如果我们在一个面朝相机的平面上运行模拟,观众可以在交互体积周围走动,同时重叠物体生成的图案会出现在正确的空间位置。
C. World Space: a 3D inertial frame of reference is supported. In case the sim area is moving (eg. attached to a pawn or vehicle), fluid density "lags behind", velocity and acceleration is properly handled. The moving direction of overlapping objects is also captured, tapping into simulation velocity C. 世界空间:支持三维惯性参考系。如果模拟区域在移动(例如,附加到一个棋子或车辆上),流体密度会“滞后”,速度和加速度会得到正确处理。重叠物体的移动方向也会被捕捉,利用模拟速度。
D. HeighFields: sim density and pressure could be used to drive true 3D volumes as a height-map, while sim velocity drives the flow of volumetric noise. Alternatively, the height could be used to distort geometry (eg. water) or for Parallax Occlusion Mapping D. HeighFields:模拟密度和压力可以用来驱动真实的 3D 体积作为高度图,而模拟速度则驱动体积噪声的流动。或者,高度可以用来扭曲几何体(例如水)或用于视差遮挡映射。
E. Raymarching: level placed light sources could generate dynamic self shadows on the 2D fluid or in the 3D volumes. E. 光线行进:放置的光源可以在 2D 流体或 3D 体积中生成动态自阴影。
In the end, we have dynamic fluid in 3D - with the GPU demand of a 2D sim. 最后,我们在 3D 中拥有动态流体——其 GPU 需求与 2D 模拟相同。
2.4 NINJALIVE vs NINJATOOLS 2.4 NINJALIVE 与 NINJATOOLS
Both FluidNinja projects are focusing on fluid simulation inside UE. FluidNinja LIVE is for interactive fluidsim. Fluid Ninja VFX TOOLS is for baked, non-interactive fluidsim. The same visual aesthetics could be achieved with both projects - the main difference is, that TOOLS runs "standalone": it is an editor tool to generate game assets, it is NOT running together with the game and it is optimized to BAKE fluidsim to simple, looped sequences and materials that play these sequences. 两个 FluidNinja 项目都专注于 UE 中的流体模拟。FluidNinja LIVE 用于交互式流体模拟。Fluid Ninja VFX TOOLS 用于烘焙的非交互式流体模拟。这两个项目可以实现相同的视觉美学,主要区别在于 TOOLS 是“独立运行”的:它是一个编辑工具,用于生成游戏资产,它并不与游戏一起运行,并且经过优化以将流体模拟烘焙为简单的循环序列和播放这些序列的材料。
LIVE and TOOLS could be used separately, or combined. For example: having a church interior with hundreds of candles definitely needs a baked solution - while having a flaming ball on the player character's hand or making a portal that interacts with the player might need a responsive sim solution. LIVE 和 TOOLS 可以单独使用,也可以结合使用。例如:拥有一个内部装饰有数百支蜡烛的教堂肯定需要一个烘焙解决方案,而在玩家角色手中有一个燃烧的球或制作一个与玩家互动的传送门可能需要一个响应式模拟解决方案。
3. Location & Size 3. 位置与大小
NinjaLive is a compact Unreal Project - its feature set could be utilized in games by merging, see Chapter 9. It is based on standard Unreal assets (Blueprints, Materials), does not contain C++ code / pre-compiled elements / third party content. Cooking, compiling and packaging is tested for Windows PC, Apple PC, Android Mobile and iOS mobile. Compiled demo: LINK NinjaLive 是一个紧凑的虚幻项目——其功能集可以通过合并在游戏中使用,见第 9 章。它基于标准的虚幻资产(蓝图、材质),不包含 C++代码/预编译元素/第三方内容。已针对 Windows PC、Apple PC、Android 移动设备和 iOS 移动设备进行了烹饪、编译和打包测试。编译的演示:链接
Live blueprints are annotated, visually organized and cross referenced with links, to help developers understand and modify them. Example screenshots: BP1, BP2, BP3 实时蓝图经过注释、视觉组织和交叉引用链接,以帮助开发人员理解和修改它们。示例截图:BP1,BP2,BP3
The project is located in a single folder: /Content/FluidNinjaLive 该项目位于一个文件夹中:/Content/FluidNinjaLive
Functional core is 30 Megabytes. Removable Tutorials 120 MB, UseCases 190 MB. The two most important files, NinjaLive (Actor class) and NinjaLiveComponent (ActorComponent class) are 2 MB and 7 MB , respectively. 功能核心为 30 兆字节。可移除教程 120 兆字节,使用案例 190 兆字节。两个最重要的文件,NinjaLive(Actor 类)和 NinjaLiveComponent(ActorComponent 类)分别为 2 兆字节和 7 兆字节。
4. Versions 4. 版本
NinjaLive is developed in separate branches to ensure compatibility with different UE versions Check the version of your NinjaLive project at: /Edit /Project Settings/Project/Description NinjaLive 在不同的分支中开发,以确保与不同的 UE 版本兼容。请在以下位置检查您的 NinjaLive 项目版本:/编辑 /项目设置/项目/描述
NinjaLive is a standalone Project. As a first step, open it in Unreal Editor: check the Tutorial and Usecase Levels! When starting the game / pressing "Play": Use Play in "Selected Viewport" Mode -- do NOT use "Simulate" Mode For running ninja in Standalone Mode, see: chapter 21.3.6 (LiveCompatibility) NinjaLive 是一个独立项目。第一步,在虚幻编辑器中打开它:查看教程和用例关卡!启动游戏/按“播放”时:使用“选定视口”模式——请勿使用“模拟”模式。要在独立模式下运行忍者,请参见:第 21.3.6 章(实时兼容性)
In order to utilize fluidsim features in your project, NinjaLive should be merged: 为了在您的项目中使用 fluidim 功能,NinjaLive 应被合并:
Prepare the target project to host NinjaLive, by setting the directly specified settings: 准备目标项目以托管 NinjaLive,通过设置直接指定的设置:
See Chapter 9: Merging NinjaLive to your Project 请参见第 9 章:将 NinjaLive 合并到您的项目中
Once merging is done, place/spawn NinjaLive fluidsim Actors at your levels - or add NinjaLive fluidsim Component to your own object classes. To make fluidsim Component work properly in your Actors, apply the directly specified Low Level Settings to the host actor class: See Chapter 10.3 合并完成后,在您的关卡中放置/生成 NinjaLive fluidsim 角色 - 或将 NinjaLive fluidsim 组件添加到您自己的对象类中。为了使 fluidsim 组件在您的角色中正常工作,请将直接指定的低级设置应用于主机角色类:请参见第 10.3 章。
Optionally you could utilize additional tools like Preset Manager with custom GUI, 可选地,您可以使用像带有自定义 GUI 的预设管理器等附加工具,
Memory Manager, Utilities ( See Chapter 11) and Interface Controller. 内存管理器,实用工具(见第 11 章)和接口控制器。
Fluidsim related parameters could be stored / loaded as Presets and handled by the Preset Manager (See Chapters 6.4 and 21). 流体仿真相关参数可以作为预设存储/加载,并由预设管理器处理(见第 6.4 章和第 21 章)。
Functional parameters (eg. LOD settings, interaction filters) could be set at the Actor and ActorComponent Details panel - as exposed variables - or set by blueprints using Live Interface. 功能参数(例如 LOD 设置、交互过滤器)可以在 Actor 和 ActorComponent 详细信息面板中设置 - 作为暴露变量 - 或通过蓝图使用实时接口进行设置。
Besides NinjaLive Managers, UE Sequencer could be used to control SimContainers. See Chapter 23. 除了 NinjaLive 管理者,UE Sequencer 还可以用来控制 SimContainers。请参见第 23 章。
6. Core Functions 6. 核心功能
6.1 NinjaLiveComponent 6.1 忍者直播组件
FluidNinja Live is a library of functions built around a single, compact unit: FluidNinja Live 是一个围绕单个紧凑单元构建的函数库:
"NinjaLiveComponent", often addressed as "sim component", located in the project root. It is an "ActorComponent" class object that should be added to a host Actor in order to use it. The host is always called "owner". The sim component could run autonomously (loading its default preset, creating RenderTargets for itself) - OR - it could connect to the interactive Preset Manager and to the Memory Manager. An important restriction: sim component does not have built in overlap detection volume. By default, Live Actor is feeding the embedded LiveComponent with information on overlapping agents. When LiveComponent is not receiving specific overlap information from the owner (eg. the owner is not a ninja Actor), it is constantly tracking predefined owner components (eg. Bones, Sockets, StaticMesh Components... ). Imagine the Component being added to a "Torch" Actor, constantly tracking the torch-head socket to generate fire at that point. "NinjaLiveComponent",通常称为“sim component”,位于项目根目录。它是一个“ActorComponent”类对象,应该添加到主 Actor 中以便使用。主 Actor 始终被称为“owner”。sim component 可以自主运行(加载其默认预设,为自己创建 RenderTargets)——或者——它可以连接到交互式预设管理器和内存管理器。一个重要的限制是:sim component 不具有内置的重叠检测体积。默认情况下,Live Actor 正在向嵌入的 LiveComponent 提供有关重叠代理的信息。当 LiveComponent 没有从 owner 接收特定的重叠信息时(例如,owner 不是忍者 Actor),它会不断跟踪预定义的 owner 组件(例如,骨骼、插槽、静态网格组件……)。想象一下,该组件被添加到“火炬” Actor 中,不断跟踪火炬头插槽以在该点生成火焰。
6.2 NinjaLive 6.2 忍者直播
"NinjaLive", an "Actor" class object, referred as "sim container" or "sim area", located at /Content/FluidNinjaLive ... is a dedicated owner, embedding "NinjaLiveComponent" and adding two important features to its core feature set: "NinjaLive"是一个“Actor”类对象,称为“模拟容器”或“模拟区域”,位于/Content/FluidNinjaLive ... 是一个专用的拥有者,嵌入了“NinjaLiveComponent”,并为其核心功能集添加了两个重要特性:
(A) activation volume (usually much larger than the sim area): the proximity of any user defined agent could switch the sim component between wake/sleep states. (A) 激活体积(通常比模拟区域大得多):任何用户定义的代理的接近都可以在唤醒/睡眠状态之间切换模拟组件。
(B) interaction volume (usually same size as the sim area): detecting overlapping / colliding objects and forwarding the spatial information + velocity to the sim component. Using the interaction volume, anything could interact with the simulation: Static- and Dynamic Meshes, SkeletalMeshes, PhysicsBodies, Destructibles. (B) 交互体积(通常与仿真区域大小相同):检测重叠/碰撞的物体并将空间信息 + 速度转发给仿真组件。使用交互体积,任何物体都可以与仿真进行交互:静态网格和动态网格、骨骼网格、物理体、可破坏物体。
6.3 Actor Details VS ActorComponent Details 6.3 演员详情与演员组件详情
When selecting an Actor on level, the Details panel is displaying all the exposed variables of that instance. In the case of "NinjaLive" Actor, the variables are collected into 4 groups, all starting with "Live" prefix: Activation, Interaction, Debug, ComponentOverrides. 在选择关卡中的演员时,详细信息面板会显示该实例的所有公开变量。在“NinjaLive”演员的情况下,这些变量被分为四组,均以“Live”前缀开头:激活、交互、调试、组件覆盖。
IMPORTANT: NinjaLiveComponent settings are exposed on the component level - accessible only at the Component Details panel - NOT visible at the Actor Details panel 重要提示:NinjaLiveComponent 设置在组件级别上公开 - 仅在组件详细信息面板中可访问 - 在演员详细信息面板中不可见
Accessing Component Details: 访问组件详情:
Select NinjaLive Actor - or any other sim component owner Actor on level. At the Details panel, there is a top section, where Actor Components are listed (to see all components, this "top list window" should be rescaled). Select "NinjaLiveComponent". 选择 NinjaLive Actor 或任何其他模拟组件拥有者 Actor。在详细信息面板中,有一个顶部区域,列出了 Actor 组件(要查看所有组件,此“顶部列表窗口”应重新调整大小)。选择“NinjaLiveComponent”。
Here is a visual guide on "how to select NinjaLiveComponent" ---> IMAGE LINK 这里是关于“如何选择 NinjaLiveComponent”的视觉指南 ---> 图片链接
Until the Component is selected, the Details panel displays its (the component's) properties and NOT the owner properties. NinjaLiveComponent variables are collected to 9 groups, all starting with "Live" prefix: 在选择组件之前,详细信息面板显示的是其(组件的)属性,而不是所有者的属性。NinjaLiveComponent 变量被收集为 9 个组,全部以 "Live" 前缀开头:
In this document, we are referring to the two states of the Details pane as "Actor Details" and "Component Details". 在本文档中,我们将详细信息窗格的两个状态称为“演员详细信息”和“组件详细信息”。
6.4 Preset Manager and Presets 6.4 预设管理器和预设
Ninja simulation parameters (eg. speed, forces, inputs) are stored in PRESET files. PRESET MANAGER is an editor only tool with a custom UI, made to.. 忍者模拟参数(例如,速度、力量、输入)存储在预设文件中。预设管理器是一个仅限编辑的工具,具有自定义用户界面,旨在...
A. develop / tweak fluidsim parameters in real-time A. 实时开发/调整流体仿真参数
B. load / save settings as preset files B. 将设置加载/保存为预设文件
PresMan. is a helper function, not needed to run ninja at all. In case you'd like to control sim via game logic like Preset Manager does, read Chapter 26.: "Controlling Live in real time". PresMan 是一个辅助函数,完全不需要运行 ninja。如果您想像预设管理器那样通过游戏逻辑控制模拟,请阅读第 26 章:“实时控制”。
6.4.1 A level placed NinjaLive container is associated with a Default preset at: 6.4.1 放置的 NinjaLive 容器与默认预设相关联:
NinjaLive Actor Details /NinjaLiveComponent /LiveGeneric /DefaultPreset Fluidsim params stored in the Default Preset are loaded when a sim container initializes (No PresMan needed, containers are autonomous!) NinjaLive 演员详情 /NinjaLiveComponent /LiveGeneric /DefaultPreset 默认预设中的 Fluidsim 参数在模拟容器初始化时加载(不需要 PresMan,容器是自主的!)
6.4.2 Preset Manager could be used by placing/FluidNinjaLive/NinjaLive PresetManager blueprint actor on a level. The most important UI elements are (see more at 21.1): 6.4.2 预设管理器可以通过在关卡中放置/FluidNinjaLive/NinjaLive 预设管理器蓝图演员来使用。最重要的用户界面元素是(详见 21.1):
A. In the top row, you could enable Tooltips (recommended!) A. 在顶部行中,您可以启用工具提示(推荐!)
B. In the second row (printed in red) you could SELECT a given NinjaLive Actor B. 在第二行(以红色打印)中,您可以选择一个特定的 NinjaLive 演员。
C. In the third row (printed in blue) you could LOAD a preset for the selected actor The default preset of a given NinjaLive Actor is marked with * symbol C. 在第三行(以蓝色打印)中,您可以为选定的演员加载预设。给定 NinjaLive 演员的默认预设用 * 符号标记。
D. Using the floppy disk icons, you could save and duplicate presets D. 使用软盘图标,您可以保存和复制预设。
6.4.3 More Preset Manager related topics in this Manual: 6.4.3 本手册中更多与预设管理器相关的主题:
10.2.2
Preset Usage 预设使用
14.1
Remove Preset Manager From Levels Before Compile 在编译之前从关卡中移除预设管理器
A. Level-placed PresMan could be de-activated, at PresMan Actor Details Panel Icon turns gray (when enabled, it is black). A. 级别放置的 PresMan 可以被停用,当 PresMan 演员详细信息面板图标变为灰色时(启用时为黑色)。
B. PresMan tries to reach clients at startup. You could define the default client at the PresMan Actor Details panel. In case the default client field is empty / or client is not present / or client is asleep: PresMan tries to load someone else. Once started, you could manually select which client (which NinjaLive Actor) you would like to load for tweaking. B. PresMan 尝试在启动时联系客户。您可以在 PresMan 演员详细信息面板中定义默认客户。如果默认客户字段为空 / 或客户不存在 / 或客户处于休眠状态:PresMan 会尝试加载其他人。一旦启动,您可以手动选择要加载的客户(哪个 NinjaLive 演员)进行调整。
C. Multiple Preset Managers per level: DO NOT C. 每个级别多个预设管理器:请勿
D. PresMan can't find clients - case1: D. PresMan 找不到客户 - 案例 1:
Preset Manager could go blank when it can not connect a valid ninja container. A possible cause: containers are usually set to be proximity activated. When the pawn or spectator camera (that triggers the proximity sensor) is away, the container is inactive (asleep). PresMan can NOT wake sleeping containers. This is communicated via an explicit on screen message 预设管理器在无法连接有效的忍者容器时可能会变为空白。一个可能的原因是:容器通常设置为靠近激活。当棋子或观众摄像头(触发靠近传感器)远离时,容器处于非活动状态(休眠)。预设管理器无法唤醒休眠的容器。这通过屏幕上的明确消息进行传达。
E. PresMan can't find clients - case2 E. PresMan 找不到客户 - 案例 2
PresMan recognizes clients via the Live INTERFACE -- in case you are not using the standard NinjaLive BP - eg. you have embedded NinjaLiveComponent to your custom BP, like a pawn - make sure you have added "Live Interface" under BP/Class Defaults/Interfaces PresMan 通过实时接口识别客户——如果您没有使用标准的 NinjaLive BP,例如,您将 NinjaLiveComponent 嵌入到自定义 BP 中,就像一个棋子一样——请确保您在 BP/类默认设置/接口下添加了“实时接口”。
F. PresMan can't find presets: F. PresMan 找不到预设:
NinjaLive actors contain a non-dynamic reference for preset LOOKUP location By default, it is: /Content/FluidNinjaLive/Presets In case you have moved ninja to a new subfolder: update the "PresetSearchPaths" variable in NinjaLiveComponent Blueprint. NinjaLive 演员包含一个非动态引用的预设查找位置,默认值为:/Content/FluidNinjaLive/Presets。如果您已将 Ninja 移动到新的子文件夹,请在 NinjaLiveComponent 蓝图中更新 "PresetSearchPaths" 变量。
G. Multiple NinjaLiveComponents per Actor: G. 每个角色多个 NinjaLiveComponents:
Preset Manager is currently not prepared to handle multiple NinjaLiveComponents embedded in a Single Actor. You could try developing presets for each component separately (using duplicated actors) - and when done, simply referencing the fina preset files for each Component under LiveGeneric/DefaultPreset. 预设管理器目前无法处理嵌入在单个角色中的多个 NinjaLive 组件。您可以尝试为每个组件单独开发预设(使用重复的角色)——完成后,只需在 LiveGeneric/DefaultPreset 下引用每个组件的最终预设文件。
6.5 Simple Painter Mode 6.5 简单画家模式
Briefly: track objects and draw trajectories without running fluidsim (eg. footsteps)! Mode switch is located at: NinjaLiveComponent /Live Interaction /SimplePainterMode Using the EnablePaintBufferOffsetInWorldSpace switch, we allow ninja to use SimplePainter IN WORLDSPACE. For practical examples: see Tutorial Levels 7, 32 简要说明:跟踪物体并绘制轨迹,而无需运行流体模拟(例如,脚步声)!模式切换位于:NinjaLiveComponent / 现场互动 / SimplePainterMode。通过启用 EnablePaintBufferOffsetInWorldSpace 开关,我们允许忍者在世界空间中使用 SimplePainter。有关实际示例,请参见教程关卡 7、32。
NinjaLive has the potential to track objects, detect collisions and write the data to RenderTarget - this is what we call "Collision Painter". The function could also accumulate and erode paint strokes by time NinjaLive 有潜力跟踪物体、检测碰撞并将数据写入 RenderTarget - 这就是我们所称的“碰撞画家”。该功能还可以随着时间的推移累积和侵蚀画笔笔触。
The built in switch - SimplePainterMode - (a) discouples Collision Painter from the rest of the system and (b) disables NinjaLive fluidsim functions. The result is a minimal system using only 1 or 2 RenderTarget (depending on WorldSpace usage), keeping GPU load on a very low level. Combined with the user editable Output Materials feature, SimplePainter could be used efficiently for certain VFX types (eg. feed particle fields with velocity, print footsteps) 内置开关 - SimplePainterMode - (a) 将碰撞绘制器与系统的其他部分解耦,并 (b) 禁用 NinjaLive 流体模拟功能。结果是一个最小化的系统,仅使用 1 或 2 个 RenderTarget(取决于世界空间的使用),保持 GPU 负载在非常低的水平。结合用户可编辑的输出材质功能,SimplePainter 可以高效地用于某些 VFX 类型(例如,给粒子场提供速度,打印脚步声)。
7. Memory Demand 7. 内存需求
NinjaLive allocates memory mainly for RenderTargets. The rendering pipeline uses 8 RenderTargets for a single simulation container by default: 1 four-channel [ RGBA, for CollisionPainter ], 5 single channel [ R, for Density and ScalarFields ] and 2 bi-channel [ RG, for VectorFields ] - all set to 16 bit precision. The pipeline could be reconfigured many ways (resolution, bit depth, channel usage). NinjaLive 主要为 RenderTargets 分配内存。渲染管线默认使用 8 个 RenderTargets 进行单个仿真容器:1 个四通道 [ RGBA,用于 CollisionPainter ],5 个单通道 [ R,用于 Density 和 ScalarFields ],以及 2 个双通道 [ RG,用于 VectorFields ] - 所有设置为 16 位精度。管线可以通过多种方式重新配置(分辨率、位深度、通道使用)。
A 256x256 fluidsim container with default settings allocates 1664 Kilobytes of memory - this could be crunched or expanded, depending on the needs. Similarly: area Kbytes, area Kbytes, area Kbytes. Of course, the sim area could be non-square (eg. ), mem consumption is changing accordingly. 一个 256x256 的流体模拟容器在默认设置下分配 1664 千字节的内存——这可以根据需要进行压缩或扩展。同样: 区域 千字节, 区域 千字节, 区域 千字节。当然,模拟区域可以是非正方形的(例如 ),内存消耗会相应变化。
Link1: See Help.uasset /Chart2 /RenderTargets for more details on possible RT configs. Link2: Select any actor containing the sim component, and switch on "/Component Details /LiveDebug /ShowMemoryManagement" for dynamic, on-screen report on actual memory consumption of a given container. 链接 1:有关可能的 RT 配置的更多详细信息,请参见 Help.uasset /Chart2 /RenderTargets。链接 2:选择任何包含模拟组件的演员,并打开“/组件详细信息 /实时调试 /显示内存管理”,以动态方式在屏幕上报告给定容器的实际内存消耗。
8. Performance (excerption) 8. 性能(摘录)
Important: Live 1.3 has been released with major performance improvements. The new results are NOT YET included in Chapter 12 / the currently available data is outdated. 重要提示:Live 1.3 已发布,带来了重大性能提升。新结果尚未包含在第 12 章中/当前可用的数据已过时。
The following exceptions (typical and peak) are here to represent the magnitude of changes. 以下例外(典型和峰值)用于表示变化的幅度。
TYPICAL PERFORMANCE LIVE 1.2 vs 1.3 典型性能 直播 1.2 对比 1.3
GTX 1070, UE 4.23, average FPS GTX 1070,UE 4.23,平均帧率
Level 11: SmokeChamber test scene FOUR 720 px fluidsim containers Live 1.2: 140 FPS vs Live 1.3: 230 FPS 第 11 级:SmokeChamber 测试场景 四个 720 px 流体模拟容器 Live 1.2:140 FPS vs Live 1.3:230 FPS
Level 13: SmokeChamber test scene TWENTY 720 px fluidsim containers Live 1.2: 100 FPS vs Live 1.3: 190 FPS 第 13 级:SmokeChamber 测试场景 二十个 720 像素流体模拟容器 实时 1.2:100 帧每秒 vs 实时 1.3:190 帧每秒
PEAK PERFORMANCE 巅峰表现
LIVE 1.3 (unlit scene, antialias and postprocessing offi GTX 1070, UE 4.23 实时 1.3(未点亮场景,抗锯齿和后处理关闭,GTX 1070,UE 4.23)
GTX 1070 Ninja peak performance GTX 1070 忍者峰值性能
9. Merging NinjaLive to your project 9. 将 NinjaLive 合并到您的项目中
Before merging ninja, the target project (your project) needs to be prepared 在合并 ninja 之前,目标项目(您的项目)需要做好准备
Open your project in the Unreal Editor. 在虚幻编辑器中打开您的项目。
STEP 1: add custom Trace Channe 步骤 1:添加自定义追踪通道
NinjaLiveComponent uses a custom channel - FluidTrace - to perform line tracing, while projecting the coordinates of overlapping objects to the fluid simulation space. NinjaLiveComponent 使用自定义通道 - FluidTrace - 进行线条追踪,同时将重叠对象的坐标投影到流体模拟空间。
A. Go to /Edit /Project Settings/Collisions/Trace Channels A. 转到 /编辑 /项目设置/碰撞/追踪通道
B. Choose "Set New trace channel B. 选择“设置新追踪通道”
C. Name FluidTrace, Default Response =Ignore C. 名称 FluidTrace,默认响应 = 忽略
Note: Trace Channel Index does not matter - "FluidTrace" could be added to an existing set of Trace Channels, no need to re-configure the order of channels 注意:追踪通道索引无关紧要 - “FluidTrace”可以添加到现有的追踪通道集中,无需重新配置通道的顺序
Go to: /Edit /Project Settings/Engine/Physics /Optimization and enable the "Support UV From Hit Results" option. Collision data is projected on the TraceMesh by linetrace as "Hit". Using this feat, 3D Hit coords could be converted to 2D sim UV-space instantly 前往:/编辑 /项目设置/引擎/物理/优化,并启用“支持来自命中结果的 UV”选项。碰撞数据通过线性追踪投影到 TraceMesh 上,作为“命中”。利用此功能,3D 命中坐标可以瞬间转换为 2D 模拟 UV 空间。
Please double check the above steps - compare your editor to this screenshot: LINk 请仔细检查上述步骤 - 将您的编辑器与此截图进行比较:链接
STEP 3: merging 步骤 3:合并
A. Quit Unreal. Copy /Content/FluidNinjaLive subfolder from the original (non-merged Live project to the target project (/Content) using file manager, while UE is not running (Briefly: copy "FluidNinjaLive" subfolder located in the Contents - to your Contents) Do not use Unreal Migrate or Import functions. Copy the above described subfolder. A. 退出虚幻引擎。使用文件管理器在虚幻引擎未运行时,从原始(未合并的)Live 项目中复制/Content/FluidNinjaLive 子文件夹到目标项目(/Content)(简而言之:将位于 Contents 中的“FluidNinjaLive”子文件夹复制到您的 Contents 中)。请勿使用虚幻引擎的迁移或导入功能。复制上述描述的子文件夹。
B. Open NinjaLiveComponent Blueprint with blueprint editor. B. 使用蓝图编辑器打开 NinjaLiveComponent 蓝图。
Set the default value of TraceChannel and CollisionChannel variables to: "FluidTrace" See this visual guide on blueprint editing: LINK 将 TraceChannel 和 CollisionChannel 变量的默认值设置为:“FluidTrace”。请参阅此蓝图编辑的视觉指南:链接
Press "Compile", then "Save". 按“编译”,然后“保存”。
In case the blueprint compiles without errors, we are almost done. 如果蓝图编译没有错误,我们就快完成了。
C. In level editor, select a NinjaLive Actor on a level. Select NinjaLiveComponent (HOW? In the LiveCompatibility group: top 3 input fields should be already set to "FluidTrace". C. 在关卡编辑器中,选择关卡上的 NinjaLive 演员。选择 NinjaLiveComponent(如何操作?在 LiveCompatibility 组中:顶部的 3 个输入字段应该已经设置为“FluidTrace”。
STEP 4: UE 5.1 specific steps 步骤 4:UE 5.1 特定步骤
A. Pawn Control: starting with UE 5.1, Default Input Settings changed - and ninja example pawn does not respond to WASD keyboard input when merged to a project. There are TWO, separate solutions to this problem: A. 兵控制:从 UE 5.1 开始,默认输入设置发生了变化 - 当忍者示例角色合并到项目中时,无法响应 WASD 键盘输入。对此问题有两个独立的解决方案:
Copy this INI file to /YourProject/Config/... folder: LINK — or: - Set up Enhanced Input, as described in this guide: LINK 将此 INI 文件复制到 /YourProject/Config/... 文件夹:链接 — 或:- 按照本指南中的说明设置增强输入:链接
B. Vehicles: to access vehicle related examples, placed on UseCase Levels 5 and 8-B enable Chaos Vehicles Plugin. This is OPTIONAL: only needed IF vehicles are used B. 车辆:要访问与车辆相关的示例,请在用例级别 5 和 8-B 上启用混沌车辆插件。这是可选的:仅在使用车辆时需要。
10. Settings 10. 设置
10.1 Ninjalive Actor Parameters (briefly) 10.1 Ninjalive 演员参数(简要)
Chapter 21.2 is providing a full description on all NinjaLive Actor parameters. Right here, we are covering only a few key settings. 第 21.2 章提供了关于所有 NinjaLive Actor 参数的完整描述。在这里,我们仅涵盖一些关键设置。
Once the original NinjaLive project is opened - OR - merging NinjaLive to another project is finished, NinjaLive Actor (sim container) is ready to be deployed to game levels. 一旦原始的 NinjaLive 项目被打开 - 或者 - 将 NinjaLive 合并到另一个项目完成,NinjaLive Actor(模拟容器)就可以部署到游戏关卡中。
(1) drag-n-drop NinjaLive from the Content Browser to a level - OR - (2) copy-paste already configured Actors from NinjaLive tutorial levels to your project levels - and modify them to get satisfactory results. Start experimenting with the settings, try to understand how Actors on tutorial levels are set up. You can find tutorial videos in this (1) 从内容浏览器将 NinjaLive 拖放到一个关卡 - 或 - (2) 将已经配置好的演员从 NinjaLive 教程关卡复制粘贴到你的项目关卡 - 并进行修改以获得满意的结果。开始尝试设置,了解教程关卡中的演员是如何设置的。你可以在这个 中找到教程视频。
When selecting a "NinjaLive" Actor on level, the Details panel is displaying exposed variables, collected in FOUR groups 在选择等级上的“NinjaLive”演员时,详细信息面板显示了分为四组的公开变量
LiveActivation: [9 params], disable switch + wake/sleep related params (activator, range...etc) Livelnteraction: [12 params], scale sim area + filter interaction types by class or bone name LiveDebug: enable on screen status messages 实时激活:[9 个参数],禁用开关 + 唤醒/睡眠相关参数(激活器、范围等)实时交互:[12 个参数],缩放模拟区域 + 按类别或骨骼名称过滤交互类型实时调试:启用屏幕状态消息
LiveComponentOverrides: helper function to set variables when multiple actors are selected. See NinjaLive blueprint / GROUP1 / SUBGROUP003 for more information. LiveComponentOverrides:当选择多个角色时,设置变量的辅助函数。有关更多信息,请参见 NinjaLive 蓝图 / GROUP1 / SUBGROUP003。
10.1.1 DISABLE/ENABLE 10.1.1 禁用/启用
NinjaLive actors could be "force deactivated" using the "Disable" flag NinjaLive 演员可以通过使用“禁用”标志来“强制停用”
(a) Select one/more "NinjaLive" Actor on level 选择一个或多个“NinjaLive”演员级别
(b) find "LiveActivation" param group on the Details panel (b) 在详细信息面板上找到“LiveActivation”参数组
(c) set Disable flag state: on/off (c) 设置禁用标志状态:开/关
The disable switch OVERRIDES activation settings: the Actor remains passive even if the activator is in range. Once disabled, the on-level Actor ICON turns gray (originally red). 禁用开关覆盖激活设置:即使激活者在范围内,演员仍然保持被动。一旦禁用,开启状态的演员图标将变为灰色(原本是红色)。
10.1.2 SCALING / SIZE 10.1.2 缩放 / 尺寸
Do _not_try to scale the sim container actor via viewport transform gizmo - nor using the numeric Scale Transform input at the Actor's Details panel. Find the "Live Interaction" param group at the Actor's Details panel, and set "Trace Mesh Size" and "Interaction Volume Size" to influence the size of fluid simulation plane and the size of interaction volume, respectively. 请勿尝试通过视口变换工具或在演员详细信息面板中使用数字缩放变换输入来缩放模拟容器演员。请在演员的详细信息面板中找到“实时交互”参数组,并分别设置“追踪网格大小”和“交互体积大小”以影响流体模拟平面的大小和交互体积的大小。
The default TraceMesh, found in NinjaLive Actor, is a planar mesh. For this reason, when you set "Trace Mesh Size" on the details panel, the Z-component of the input field does not have any effect on the visuals and workings. Later on, you will learn how to add a custom TraceMesh to your own actors. In case these meshes are not planar (eg. a hemisphere), the Z-scaling component starts to make sense - and that is the reason for that param being there. 默认的 TraceMesh,位于 NinjaLive Actor 中,是一个平面网格。因此,当您在详细面板上设置“Trace Mesh Size”时,输入字段的 Z 组件对视觉效果和功能没有任何影响。稍后,您将学习如何为自己的演员添加自定义 TraceMesh。如果这些网格不是平面的(例如半球体),那么 Z 缩放组件就开始变得有意义——这就是该参数存在的原因。
The Interaction Volume is a true 3D object by default, so all dimensions of the "Interaction Volume Size" param field have effect on the workings. 交互体积默认是一个真实的 3D 对象,因此“交互体积大小”参数字段的所有维度都会影响其工作。
Note: TraceMesh and InteractionVolume both have a separate visibility flag (at "Live Interaction" group). Make sure that these flags are on - to visualise the mentioned geometries. The two params are: "ShowTraceMeshInEditor" and "ShowInteractionVolumeInEditor" 注意:TraceMesh 和 InteractionVolume 都有一个单独的可见性标志(在“实时交互”组中)。确保这些标志已开启,以可视化提到的几何体。这两个参数是:“ShowTraceMeshInEditor”和“ShowInteractionVolumeInEditor”。
10.1.3 NON-UNIFORM SCALING 10.1.3 非均匀缩放
Using the above mentioned options, you could set up a rectangular (non-square) TraceMesh/ simulation plane. Since fluidsim resolution is also manually provided (non-automatic), you should make sure that side-proportions match - eg. a TraceMesh, sized is matched with a Fluidsim resolution set to or . 使用上述选项,您可以设置一个矩形(非正方形)TraceMesh/模拟平面。由于 fluidsim 的分辨率也是手动提供的(非自动),您应该确保边的比例匹配 - 例如,大小为 的 TraceMesh 应与设置为 或 的 Fluidsim 分辨率匹配。
Note: you could reach fluidsim resolution settings at the Details panel of NinjaLiveComponent Select NinjaLive Actor. At the Details panel, there is a top section, where Actor Components are listed (sometimes, to see all components, this "top list window" should be rescaled - by dragging the bottom part of the window-handle downwards). Select "NinjaLiveComponent". Until the component is selected, the Details panel displays its (the component's) properties and NOT the owner properties. 注意:您可以在 NinjaLiveComponent 的详细信息面板中访问 fluidim 分辨率设置。选择 NinjaLive Actor。在详细信息面板中,有一个顶部区域,列出了 Actor 组件(有时,为了查看所有组件,这个“顶部列表窗口”需要重新调整大小 - 通过向下拖动窗口手柄的底部)。选择“NinjaLiveComponent”。在选择组件之前,详细信息面板显示的是其(组件的)属性,而不是所有者的属性。
Find "Live Performance" submenu, set "Resolution " respectively. 找到“现场表演”子菜单,分别设置“分辨率 ”。
10.1.4 POSITION & ROTATION 10.1.4 位置与旋转
As opposed to Scaling: Position and Rotation of the sim area should be set using the viewport gizmo or the Transform input field at the Actor's Details panel. 与缩放相对:模拟区域的位置和旋转应使用视口小工具或演员详细信息面板中的变换输入字段进行设置。
Params related to this section are located at: Actor Details / Live Interaction 与本节相关的参数位于:演员详情 / 实时互动
While our simulation is 2D, we would like to seamlessly integrate it to 3D space - so, we came up with the "Overlap Projection" technique. Our fluid simulation container actor, placed on evel has two related components: 虽然我们的模拟是二维的,但我们希望将其无缝集成到三维空间中——因此,我们提出了“重叠投影”技术。我们的流体模拟容器演员,放置在 evel 上,有两个相关组件:
(A) InteractionVolume: used to detect overlapping / collision - objects inside this volume could interact with the simulation - initial and ongoing overlap events are continuously monitored (both entering and leaving the volume). The type of interactions could be defined / filtered by the user (see next chapter (A) 交互体积:用于检测重叠/碰撞 - 在此体积内的物体可以与模拟进行交互 - 初始和持续的重叠事件会不断监测(包括进入和离开体积)。交互的类型可以由用户定义/过滤(见下一章)。
(B) TraceMesh: we are mapping the simulation output to this mesh (by default a plane, but could be defined by the user) plus: we are going to perform a line trace against this mesh. (B) TraceMesh:我们将仿真输出映射到这个网格(默认是一个平面,但可以由用户定义),此外:我们将对这个网格执行线性追踪。
The sim container is triggered by objects that overlap with the Interaction Volume. Once overlapping object(s) / components are targeted, a line-trace is performed in their direction (A) from the camera or (B) from a user-defined point - against the TraceMesh. Line-trace hit the TraceMesh, the hit information is transformed to TraceMesh UV space (which is also simulation UV space), and the simulation density/velocity inputs are feeded with the related positional/velocity/size data. 模拟容器由与交互体积重叠的对象触发。一旦重叠的对象/组件被选中,就会从相机(A)或用户定义的点(B)朝它们的方向进行线性追踪,针对 TraceMesh。线性追踪击中 TraceMesh 后,击中信息被转换为 TraceMesh UV 空间(这也是模拟 UV 空间),并将相关的位置信息/速度/大小数据输入到模拟密度/速度中。
Velocity could be derived from Frame/PreviousFrame positional delta or alternatively by calling (requesting from the engine) the world space velocity of the colliding object and transforming it to sim space. NinjaLive uses both methods. What if the motion is perpendicular to the TraceMesh? NinjaLive contains a certain processor to handle this, by increasing pressure and velocity noise at the given location, giving an illusion of an object "blasting through" a surface, producing shockwaves (if velo is large). 速度可以通过帧/前一帧的位置差来推导,或者通过调用(从引擎请求)碰撞物体的世界空间速度并将其转换为模拟空间。NinjaLive 使用这两种方法。如果运动与 TraceMesh 垂直怎么办?NinjaLive 包含一个特定的处理器来处理这个问题,通过在给定位置增加压力和速度噪声,给人一种物体“穿透”表面的错觉,产生冲击波(如果速度很大)。
Non-perpendicular velocity vectors cause "drag-like" advection. We always check composite velocity, and add "blast factor" proportionally to the perpendicular component. 非垂直速度矢量会导致“拖曳式”平流。我们总是检查合成速度,并按比例将“冲击因子”添加到垂直分量中。
Now, imagine that we are forcing TraceMesh to be camera facing. So we are mapping collisions from the camera view to a camera facing plane. And remember: we are tracking objects / bones that are inside InteractionVolume, but not aligned on TraceMesh surface (imagine the limbs of a character or the debris of a crumbling wall): since trace-targets are moving in 3D space and the advection / density they generate is always positionally following them, the fluid seems spatially extended 现在,想象一下我们正在强制 TraceMesh 面向相机。因此,我们将碰撞从相机视角映射到一个面向相机的平面。请记住:我们正在跟踪位于 InteractionVolume 内的物体/骨骼,但它们并未与 TraceMesh 表面对齐(想象一个角色的四肢或一堵崩溃墙壁的碎片):由于追踪目标在 3D 空间中移动,并且它们产生的对流/密度始终在位置上跟随它们,流体似乎在空间上是扩展的。
More on Camera Facing: 10.2.5 关于相机朝向的更多信息:10.2.5
10.1.6 FILTERING INTERACTIONS 10.1.6 过滤交互
Params related to this section are located at: Actor Details /Live Interaction - allowing you to specify / filter interaction types for the simulation area. 与本节相关的参数位于:演员详情 / 实时互动 - 允许您为模拟区域指定/过滤互动类型。
/Overlap Filter Inclusive Object Type: an array, where you could add/remove objec type-classes: WorldStatic, WorldDynamic, Pawn, Vehicle, Destructible, PhysicsBody /Auto Exclude Large Overlapping Objects: eg. an extended floor object that overlaps the Interaction Volume, and we do not want it to interact with the fluid. You could do the same manually, under: /重叠过滤器包含对象类型:一个数组,您可以添加/删除对象类型类:WorldStatic、WorldDynamic、Pawn、Vehicle、Destructible、PhysicsBody /自动排除大型重叠对象:例如,一个扩展的地板对象与交互体积重叠,我们不希望它与流体互动。您可以在以下位置手动执行相同操作:
/Exclude Specific Actors From Overlap 排除特定参与者的重叠
Bone names: in case you have provided a skeletal mesh class (eg. Pawn) in the Filter array, the container is trying to detect all bones by default - most of the cases this is not what we want. "Partial name filter" allows you to type in "foot" ot "hand" - and all bones containing these strings will be included. Performance-wise, the most optimal solution is providing "Exact Bone Names": eg. "feet_r", "feet_l" for a Mannequin, walking in a puddle sim. 骨骼名称:如果您在过滤器数组中提供了一个骨骼网格类(例如,Pawn),容器默认会尝试检测所有骨骼——在大多数情况下,这并不是我们想要的。“部分名称过滤器”允许您输入“foot”或“hand”——所有包含这些字符串的骨骼将被包含在内。从性能角度来看,最优的解决方案是提供“精确骨骼名称”:例如,对于在水坑中行走的人形模型,使用“feet_r”、“feet_l”。
10.1.7 WORLD SPACE VELOCITY 10.1.7 世界空间速度
There is a single param for channelling World Space velocity to the simulation: eg. we have a kettle full of swirling liquid, and we start to push the kettle / or we have a pawn with flaming hands, and he starts to run, and we expect the smoke/flames to be left behind. 有一个参数用于将世界空间速度传递到模拟中:例如,我们有一个装满旋转液体的水壶,我们开始推动水壶;或者我们有一个手中燃烧着火焰的棋子,他开始奔跑,我们期望烟雾/火焰会被留在后面。
The param that influences this phenomena is a "preset" param, that could be changed using the preset manager, 影响这一现象的参数是一个“预设”参数,可以通过预设管理器进行更改
see "Velocity Field influenced by sim area motion" on the GUI - or modified by manually editing the preset file (defined at Component Details / LiveGeneric) at "VeloFromSimAreaMotion" field. 在 GUI 上查看“受模拟区域运动影响的速度场” - 或通过手动编辑预设文件(在组件详细信息/ LiveGeneric 中定义)中的“VeloFromSimAreaMotion”字段进行修改。
10.2 Ninjalive Actor Component Parameters (briefly) 10.2 Ninjalive 演员组件参数(简要)
Chapter 21.3 is providing a full description on all NinjaLive Component parameters Right here, we are covering only a few key settings. 第 21.3 章提供了对所有 NinjaLive 组件参数的完整描述。在这里,我们仅涵盖一些关键设置。
Select any NinjaLive-Component-Owner Actor on level (eg. "NinjaLive" Actor or Orb, Pawn). Select NinjaLiveComponent* at the Actor Details panel (see Actor Components list at the top) 选择关卡中的任何 NinjaLive-Component-Owner 角色(例如“ NinjaLive”角色或 Orb、Pawn)。在角色详细信息面板中选择 NinjaLiveComponent*(请参见顶部的角色组件列表)。
*Here is a visual guide on "how to select NinjaLiveComponent" ---> 这里是关于“如何选择 NinjaLiveComponent”的视觉指南 --->
IMAGE LINK 图像链接
Notice: as you select the actor component, the "Details" panel changes and you could see the exposed Component Variables, collected in 9 groups, all starting with "Live" prefix. 注意:当您选择演员组件时,“详细信息”面板会发生变化,您可以看到暴露的组件变量,这些变量分为 9 组,全部以“Live”前缀开头。
Listed in order of importance: 按重要性排序:
Interaction [11 params] - continuous (non-overlap based) interaction AND single target mode Generic [14 params] - PRESET and INPUT / OUTPUT MATERIAL definitions + more Performance [19 params] - resolution, LOD, render pipeline settings MemoryManagement [3 params] - in case mem.manager is placed on level: set up connection Raymarching [16 params] - picking lightsource for raymarching, setting params Compatibility [6 params] - system level switches, eg.: Flip RenderTargets for Mobile compile BrushSettings [11 params] - collision painter brush size overrides and noise settings Activation [1 param] - component level disable switch (actor level is preferred, when available Debug [10 params] - enable on-screen reporting of LOD, memory...etc 交互 [11 个参数] - 连续(非重叠基础)交互和单目标模式 通用 [14 个参数] - 预设和输入/输出材料定义 + 更多 性能 [19 个参数] - 分辨率、LOD、渲染管线设置 内存管理 [3 个参数] - 如果内存管理器放置在关卡上:设置连接 光线行进 [16 个参数] - 选择光源进行光线行进,设置参数 兼容性 [6 个参数] - 系统级开关,例如:翻转移动编译的渲染目标 画笔设置 [11 个参数] - 碰撞画笔大小覆盖和噪声设置 激活 [1 个参数] - 组件级禁用开关(优先使用演员级,若可用) 调试 [10 个参数] - 启用屏幕上 LOD、内存等的报告
10.2.1 DISABLE/ENABLE 10.2.1 禁用/启用
When talking about NinjaLive Actor, we have TWO disable switches available: 当谈到 NinjaLive 演员时,我们有两个禁用开关可用:
Actor Details /LiveActivation /Disable 演员详情 /实时激活 /禁用
(preferred) 请提供要翻译的文本
Actor Component Details /LiveActivation /Disable 演员组件详情 /实时激活 /禁用
(not preferred) 请提供要翻译的文本
Normally, we disable systems on the Actor Detail level. Once NinjaLiveComponent is added to a random owner (eg. pawn), the high level (actor level) disable is not there anymore. In this case, the component level disable could be used. 通常,我们在演员详细信息级别禁用系统。一旦将 NinjaLiveComponent 添加到随机所有者(例如,棋子),高层(演员级别)禁用就不再存在。在这种情况下,可以使用组件级别的禁用。
10.2.2 PRESET USAGE 10.2.2 预设使用
Component Details /Live Generic / Default Preset - this is where you could associate a default preset for a NinjaLiveComponent - this preset will be automatically loaded at area initialization. Note: in the Preset Manager, you could load / try arbitrary presets for a given area - but you have to provide DEFAULT here, at the Component Details 组件详情 / 实时通用 / 默认预设 - 这是您可以为 NinjaLiveComponent 关联默认预设的地方 - 此预设将在区域初始化时自动加载。注意:在预设管理器中,您可以加载/尝试给定区域的任意预设 - 但您必须在组件详情中提供默认值。
10.2.3 OUTPUT MATERIAL USAGE 10.2.3 输出材料使用
Output Materials: NinjaLive rendering pipeline is a chain of Blueprint controlled Materials, writing to RenderTargets. Any RenderTarget could be used as output, depending on the needs (typically Density, Velocity, Pressure and PainterInput). So, a typical "Ninja Output" material contains at least one "Parametric Texture Object" with Specified name, eg. "DensityBuffer", "PressureBuffer"...etc. these materials are tapped into the rendering pipeline, and use the needed raw sim output to create arbitrary shaders. 输出材料:NinjaLive 渲染管线是一系列由蓝图控制的材料,写入渲染目标。根据需求(通常是密度、速度、压力和绘画输入),可以使用任何渲染目标作为输出。因此,一个典型的“忍者输出”材料至少包含一个具有指定名称的“参数纹理对象”,例如“DensityBuffer”、“PressureBuffer”等。这些材料被接入渲染管线,并使用所需的原始模拟输出来创建任意着色器。
Note: by default, the render pipeline is processing MONOCHROMATIC density data, and the output is COLORIZED - based on the available data (eg. Tonemapping monochrome density with two colors). The density could be sent to a raymarch shader or Pressure used to perform WorldPositionOffset, Divergence for Refraction... really up to you. Have a look at the provided output material examples at: /Content/FluidNinjaLive/OutputMaterials/ 注意:默认情况下,渲染管线处理的是单色密度数据,输出是基于可用数据的彩色化(例如,用两种颜色进行单色密度的色调映射)。密度可以发送到光线行进着色器,或用于执行世界位置偏移、折射的发散……这完全取决于你。请查看提供的输出材质示例:/Content/FluidNinjaLive/OutputMaterials/
Below the array of output materials, there is an INTEGER input field, labeled as: 在输出材料的下方,有一个标记为整数的输入字段:
"Output Material Selected" - provide here the array index for your default/favourite material. "已选择输出材料" - 在此提供您默认/最喜欢材料的数组索引。
The array is also accessible in the Preset Manager - so you could check variations in runtime. 该数组在预设管理器中也可以访问,因此您可以检查运行时的变化。
Btw, runtime: you could start/leave open the standard Unreal Material Instance Editor UI and tweak output material params while Ninja is running - and you see the real time fluidsim in the main viewport - very efficient way to fine-tune params 顺便说一下,运行时:你可以在 Ninja 运行时启动/保持打开标准的虚幻材质实例编辑器 UI,并调整输出材质参数——同时在主视口中看到实时流体模拟——这是一种非常高效的微调参数的方法
10.2.4 RAYMARCHING 10.2.4 光线行进
To set up NinjaLiveComponent for Raymarching, check these settings at Component Details: 要为 Raymarching 设置 NinjaLiveComponent,请检查组件详细信息中的这些设置:
LiveGeneric / OutputMaterials array: make sure there is a raymarch capable output material on the list LiveGeneric / OutputMaterials 数组:确保列表中有一个能够进行光线行进的输出材料
LiveGeneric / OutputMaterialSelected: set the array index for the above materia 设置上述材料的数组索引
10.2.5 INTERACTIONS 10.2.5 互动
Component Details /Live Interaction: these settings are partly described in the next chapter, see: STEP 9-10, Setting up "non-overlap based" or "continuous" interaction with the owner. 组件详情 / 实时互动:这些设置在下一章中部分描述,见:步骤 9-10,设置“非重叠基础”或“连续”与所有者的互动。
Note: Continuous Interaction should be flagged ON every time you include Live Component to a new owner (the new host is NOT NinjaLive Actor, but some other class) - this flag ensures that LiveComponent could interact with the new owner. Other settings in this submenu: 注意:每次将实时组件添加到新所有者时,连续交互应标记为开启(新主机不是 NinjaLive 演员,而是其他类) - 此标记确保实时组件可以与新所有者进行交互。此子菜单中的其他设置:
Single Target Mode: focusing on a single superfast target (eg. pawn fist) 单目标模式:专注于单个超快速目标(例如:兵拳)
Character animation could be erratic, extremely fast movements occur, the temporal sampling of the collision painter simply can not cope with this, we see density dots. This mode focuses on a single target, and connects the sampling points via interpolation, creating a continuous motion-trajectory, drawing density and velocity lines between the sparse sampled position data points - this way making "fluid ribbons" / "smoke or flame trails" behind the superfast moving object. The target is the first item in the "Bone names" list - or the first element found based on type filtering 角色动画可能会不稳定,出现极快的运动,碰撞绘制器的时间采样根本无法应对这种情况,我们看到的是密度点。此模式专注于单一目标,通过插值连接采样点,创建连续的运动轨迹,在稀疏采样位置数据点之间绘制密度和速度线——这样就形成了在超快速移动物体后面的“流动丝带”/“烟雾或火焰轨迹”。目标是“骨骼名称”列表中的第一个项目——或根据类型过滤找到的第一个元素。
Using the "Single Target Set Sim Speed" flag, a bullet-time like "time dilation effect" could be achieved: the moving speed of the single target influences fluidsim play speed. 使用“单目标设置模拟速度”标志,可以实现类似子弹时间的“时间膨胀效果”:单个目标的移动速度会影响流体模拟的播放速度。
Camera Facing: performed by a generic function, stored at: 相机朝向:由通用功能执行,存储在:
/Content/FluidNinjaLive/Core/NinjaLiveFunctions - usually called by the sim component (see MODULEO36 in the blueprint) /Content/FluidNinjaLive/Core/NinjaLiveFunctions - 通常由模拟组件调用(请参见蓝图中的 MODULEO36)
Important Note: when using NinjaLive as a component IN MOVING AGENTS (eg.: a Pawn), keep Camera Facing in the sim component switched OFF and call the "Camera Facing" function in the owner Blueprint's Tick flow. This results in smoother rotation. Reason: the ticking of Pawn transform and TraceMesh transform should be synchronized (in case of non-moving owner sync does not matter) 重要提示:在将 NinjaLive 作为移动代理(例如:一个棋子)的组件时,请将模拟组件中的相机朝向关闭,并在所有者蓝图的 Tick 流程中调用“相机朝向”功能。这将导致更平滑的旋转。原因:棋子变换和 TraceMesh 变换的时钟应保持同步(在非移动所有者的情况下,同步并不重要)。
See included "motile owner" type blueprints - referred at 10.3 请参见附带的“可动所有者”类型蓝图 - 在 10.3 中提到。
10.2.6 USE CUSTOM LINE TRACE SOURCE (instead of camera) 10.2.6 使用自定义线条追踪源(而不是相机)
New feature, added to NinjaLive 1.2 ---- Ul access: 新功能,添加到 NinjaLive 1.2 ---- Ul 访问:
Levels demonstrating the feature: LEVEL 2C -- LEVEL 21 Stage 6B -- LEVEL 24A, 25, 26 Tutorial video on feature: LINK 展示该功能的级别:LEVEL 2C -- LEVEL 21 第 6 阶段 -- LEVEL 24A, 25, 26 功能教程视频:链接
NinjaLive uses line tracing to project 3D collision data to the 2D simulation plane. By default, the trace line starts from the camera and targets the overlapping / colliding object. At the point where the trace line intersects the TraceMesh, the collision painter is drawing to the collision buffer. This is how overlapping objects generate density/velocity for the simulation NinjaLive 使用线追踪将 3D 碰撞数据投影到 2D 模拟平面。默认情况下,追踪线从相机开始,目标是重叠/碰撞的物体。在追踪线与 TraceMesh 相交的点,碰撞绘制器正在绘制到碰撞缓冲区。这就是重叠物体为模拟生成密度/速度的方式。
Using the new feature, we could define a custom line tracing source point 使用新功能,我们可以定义自定义的线条追踪源点
by adding XYZ offset to the sim container position 通过将 XYZ 偏移量添加到模拟容器位置
Advantage 2: detaching simulation container and simulation output - running the sim in the background while the user and the camera is somewhere else 优势 2:分离模拟容器和模拟输出 - 在后台运行模拟,同时用户和相机在其他地方
Note1: before adding this new feature, NinjaLive was already capable to run "non-interactive" simulations in the absence of camera, eg. using a texture or material to generate density while ignoring overlapping objects --- see Level 24B setup! 注意 1:在添加此新功能之前,NinjaLive 已经能够在没有摄像头的情况下运行“非交互式”模拟,例如使用纹理或材料生成密度,同时忽略重叠对象——请参见 24B 级设置!
Note2: to perform the "run a sim while we are away" feature, we need to switch off LOD and "Pause sim when not visible" --- see Levels 24A,24B,25,26 for details 注意 2:要执行“我们离开时运行模拟”功能,我们需要关闭 LOD 和“在不可见时暂停模拟”——详见第 24A、24B、25、26 级
Advantage 3: no impact doubling when running the simulation on hollow meshes and viewing "from the other side". Imagine a sphere, used as TraceMesh - and an object colliding to the RIGHT hemisphere. In case we watch the impact "from the other side" the trace line (starting from the camera) crosses the LEFT hemisphere as well, generating UNWANTED simulation input. In case we are NOT using the camera as trace source, this could be avoided --- see Level21, Stage 6B! 优势 3:在空心网格上运行模拟并从“另一侧”查看时没有影响加倍。想象一个球体,作为 TraceMesh - 一个物体与右半球碰撞。如果我们从“另一侧”观察碰撞,追踪线(从相机开始)也会穿过左半球,从而产生不必要的模拟输入。如果我们不使用相机作为追踪源,这可以避免——见 Level21,Stage 6B!
Advantage 4: we could avoid VR artefacts - when the user is rapidly changing his point of view and the overlapping object "hovers" above the TraceMesh (not exactly intersecting the tracemesh), the projected collision point wanders (like a shadow of an "above the floor object" while you are moving the torch). By using a fixed line trace source point, this could be avoided. 优势 4:我们可以避免虚拟现实伪影——当用户快速改变视角时,重叠的物体“悬浮”在 TraceMesh 上方(并未完全与 TraceMesh 相交),投影的碰撞点会漂移(就像在移动手电筒时“悬在地面上方的物体”的影子)。通过使用固定的线性追踪源点,可以避免这种情况。
10.3 Adding NinjaLive Component To Your Own Actor Classes 10.3 将 NinjaLive 组件添加到您自己的演员类中
We are going to update an existing actor class to contain NinjaLiveComponent. Typical cases include Pawns, Vehicles and other motile agents. 我们将更新现有的演员类,以包含 NinjaLiveComponent。典型案例包括棋子、车辆和其他可移动代理。
Before start, we'd like to mention: on the NinjaLive tutorial levels you'll find multiple examples for this setup - including a floating orb and the classic UE-Mannequin pawn, both with NinjaLiveComponent added. Blueprints could be found at these locations (folders): 在开始之前,我们想提到:在 NinjaLive 教程关卡中,您会找到多个此设置的示例——包括一个漂浮的球体和经典的 UE-Mannequin 角色,二者都添加了 NinjaLiveComponent。蓝图可以在以下位置(文件夹)找到:
Important: NinjaLiveComponent does not have built in overlap detection functionality, interacts only with predefined (user defined) owner components (eg. Bones, Sockets, 重要提示:NinjaLiveComponent 不具备内置的重叠检测功能,仅与预定义(用户定义)的所有者组件交互(例如:Bones、Sockets,
Meshes). This type of interaction is labeled "non-overlap based" or "continuous" interaction, handled by MODULE021 in the NinjaLiveComponent blueprint. Below, you'll find instructions on how to manage this (STEP 8-9, explained) 网格)。这种交互类型被标记为“非重叠基础”或“连续”交互,由 NinjaLiveComponent 蓝图中的 MODULE021 处理。下面是关于如何管理此项的说明(步骤 8-9,详解)。
Let us start with a quick step-by-step guide, followed by explanation on the non-trivial steps: 让我们先从一个快速的逐步指南开始,然后再解释一些非平凡的步骤:
open owner (the planned sim component host blueprint) 打开所有者(计划的模拟组件主机蓝图)
set the value of "TraceMeshComponent" variable of NinjaLiveComponent (value = TraceMesh) 设置 NinjaLiveComponent 的“TraceMeshComponent”变量的值(值 = TraceMesh)
set TraceMesh properties (note: scale is related to resolution!) 设置 TraceMesh 属性(注意:缩放 与 分辨率相关!)
add NinjaLiveInterface to the owner blueprint (at Class Settings /Interface) 将 NinjaLiveInterface 添加到所有者蓝图中(在类设置/接口处)
set NinjaLiveComponent default properties: while remaining in the blueprint editor select NinjaLiveComponent in the "Components" list of owner to access NinjaLiveComponent Details panel. Find "Live Interaction" parameter group 设置 NinjaLiveComponent 默认属性:在蓝图编辑器中,选择所有者的“组件”列表中的 NinjaLiveComponent,以访问 NinjaLiveComponent 详细信息面板。找到“实时交互”参数组。
set the "Continuous Interaction with Owner Actor" switch to "ON" 将“与所有者角色的持续互动”开关设置为“开启”
set continuous Interaction Inclusive Object Type / Bone names 设置连续交互包容对象类型 / 骨骼名称
set the default value of all other params here (in the blueprint) - eg. default preset, material 在这里(在蓝图中)设置所有其他参数的默认值 - 例如,默认预设、材料
All NinjaLiveComponent owners must contain a StaticMeshComponent labeled as 所有 NinjaLiveComponent 的拥有者必须包含一个标记为 StaticMeshComponent 的组件
"TraceMesh". TraceMesh has two functions: linetrace is performed against it - and the fluidsim is mapped on it. Depending on the context, we could call this mesh "simulation plane" or "tracemesh" - it is the same. "TraceMesh"。TraceMesh 有两个功能:对其进行线性追踪 - 并且流体模拟映射在其上。根据上下文,我们可以称这个网格为“模拟平面”或“追踪网格” - 这两者是一样的。
Any mesh would do - NinjaLive contains a simple StaticMesh type plane as default object, add that one for start: /FluidNinjaLive/NinjaLiveTraceMesh 任何网格都可以 - NinjaLive 默认包含一个简单的 StaticMesh 类型平面,首先添加这个:/FluidNinjaLive/NinjaLiveTraceMesh
STEP 4, TELL NINJALIVE ABOUT THE TRACEMESH 步骤 4,告诉 NINJALIVE 关于 TRACEMESH
NinjaLiveComponent contains a "TraceMeshComponent" variable that MUST be set by the owner. Please have a look at this blueprint: NinjaLiveComponent 包含一个必须由所有者设置的“TraceMeshComponent”变量。请查看这个蓝图:
OnEventBeginplay, set TraceMesh as "value" to "TraceMeshComponent" variable of NinjaLiveComponent. Steps: 在事件开始播放时,将“value”设置为 NinjaLiveComponent 的“TraceMeshComponent”变量的 TraceMesh。步骤:
a. pull NinjaLiveComponent to the blueprint editing-surface 将 NinjaLiveComponent 拖到蓝图编辑面板上
b. pull a data-flow thread from the component, and type: "TraceMeshComponent" place a "set" node b. 从组件中拉出一个数据流线程,并输入:“TraceMeshComponent”放置一个“set”节点
c. pull TraceMesh to the blueprint editing-surface - and wire it to the above "SET" node This way, we are explicitly telling NinjaLiveComponent about the TraceMesh, contained by the owner. From now on, the component does a lot of things with the mesh, all automatically. c. 将 TraceMesh 拖到蓝图编辑面板上,并将其连接到上面的 "SET" 节点。通过这种方式,我们明确告诉 NinjaLiveComponent 有关拥有者包含的 TraceMesh。从现在开始,该组件将自动对网格执行许多操作。
STEP 5, SET TRACEMESH PROPERTIES 步骤 5,设置追踪网格属性
a. Editor Visibility could be switched off: TraceMesh component details / Rendering / Visibility b. Collision settings are extremely important - but NinjaLiveComponent handles this automatically by force setting all the necessary params: see MODULE004 in the sim component. a. 编辑器可见性可以关闭:TraceMesh 组件详情 / 渲染 / 可见性 b. 碰撞设置非常重要 - 但 NinjaLiveComponent 会自动处理此问题,通过强制设置所有必要的参数:请参见模拟组件中的 MODULE004。
One thing that could _not_be set from blueprint: double sided. This property should be enabled at the Mesh Editor. For our ready-to-use plane it is flagged "on". 有一件事无法从蓝图设置:双面。此属性应在网格编辑器中启用。对于我们现成的平面,它被标记为“开启”。
c. Scale: three methods to set TraceMesh scale c. 缩放:三种方法设置 TraceMesh 缩放
At the level placed instance - by selecting the component (this effects only that instance - In the owner blueprint, selecting TraceMesh and set default transform (effects all instances) - Via an exposed variable (NinjaLive Actor does it this way, so you could customize instances) Important: scale is related to simulation resolution - see: 10.1.3 NON-UNIFORM SCALING 在放置实例的级别 - 通过选择组件(这只影响该实例) - 在所有者蓝图中,选择 TraceMesh 并设置默认变换(影响所有实例) - 通过一个暴露的变量(NinjaLive Actor 以这种方式实现,因此您可以自定义实例)重要:缩放与模拟 分辨率相关 - 见:10.1.3 非均匀缩放
STEP 6, ADD INTERFACE 步骤 6,添加接口
Add NinjaLiveInterface to the owner blueprint at: Class Settings / Interface 将 NinjaLiveInterface 添加到所有者蓝图中:类设置 / 接口
NinjaLiveComponent-Containing-Actors (owners) should have this interface implemented... NinjaLiveComponent-包含-演员(所有者)应该实现此接口...
a. to be visible/accessible for GUI-controlled preset management a. 以便在图形用户界面控制的预设管理中可见/可访问
b. to be excluded from the line tracing of OTHER owners b. 被排除在其他所有者的线路追踪之外
c. to access / modify exposed variables of any level placed sim component owne c. 访问/修改任何级别的暴露变量,放置模拟组件所有者
Both NinjaLiveComponent and NinjaLive_PresetManager identify / collect "clients" based on INTERFACE (Get all Actors with Interface). NinjaLiveComponent 和 NinjaLive_PresetManager 根据接口(获取所有具有接口的演员)识别/收集“客户端”。
See: NinjaLiveComponent: MODULEO2O (exclusion from linetrace) / NinjaLive PresetManager: SUBGROUP003 On Tutorial Level 5 you could find a setup where NinjaLive_InterfaceController is communicating with a NinjaLive Actor using the interface, initiating a "fade off / shutdown" sequence, have a look! The clients are defined in the Actor Details/ Interface Target Actors array of controller. 查看:NinjaLiveComponent:MODULEO2O(排除在 linetrace 之外)/ NinjaLive PresetManager:SUBGROUP003 在教程第 5 级中,您可以找到一个设置,其中 NinjaLive_InterfaceController 通过接口与 NinjaLive Actor 进行通信,启动“淡出/关闭”序列,看看吧!客户端在控制器的 Actor Details/Interface Target Actors 数组中定义。
Next, we are going to set NinjaLiveComponent default properties. While remaining in the blueprint editor, select NinjaLiveComponent in the "Components" list of owners - to access NinjaLiveComponent Details panel 接下来,我们将设置 NinjaLiveComponent 的默认属性。在蓝图编辑器中,选择“所有者”中的 NinjaLiveComponent,以访问 NinjaLiveComponent 详细信息面板。
At the Component Details panel, find the "Live Interaction" parameter group. Set the "Continuous Interaction with Owner Actor" flag to "ON". 在组件详细信息面板中,找到“实时交互”参数组。将“与拥有者角色的持续交互”标志设置为“开启”。
When a sim component is embedded to its native host - NinjaLive Actor - the owner is doing overlap detection and telling the component's line tracer "who to track". Sim component does not have built-in overlap detection functionality. When embedded to new owner (eg. pawn), line tracer falls back to a user defined list on "who to track" - the list contains type filters (StaticMesh, Dynamesh, Pawn...etc) and bone/socket lists ("Inclusive Object Type" and "Bone names"). This is all very similar to the Interaction settings of the Actor Detail menu - see 10.1.6 FILTERING INTERACTIONS for a general description on interaction filtering and bone names. 当一个模拟组件嵌入到其本地宿主 - NinjaLive Actor - 时,所有者会进行重叠检测并告诉组件的线路追踪器“跟踪谁”。模拟组件没有内置的重叠检测功能。当嵌入到新的所有者(例如,棋子)时,线路追踪器会回退到用户定义的“跟踪谁”的列表 - 该列表包含类型过滤器(静态网格、动态网格、棋子等)和骨骼/插槽列表(“包含对象类型”和“骨骼名称”)。这一切与演员详细菜单的交互设置非常相似 - 请参见 10.1.6 过滤交互,以获取有关交互过滤和骨骼名称的一般描述。
STEP 10: 步骤 10:
Set the default value of all other params - eg. default preset, material We have been talking about this in the previous chapter. See 设置所有其他参数的默认值 - 例如,默认预设、材料。我们在上一章中讨论过这个。请参见
10.2.2 PRESET USAGE, 10.2.3 OUTPUT MATERIAL USAGE 10.2.2 预设使用,10.2.3 输出材料使用
While the brush size can be adjusted via Preset, you may want to tweak it in: Component Details /LiveBrushSettings 虽然画笔大小可以通过预设进行调整,但您可能想在以下位置进行微调:组件详细信息 / 实时画笔设置
Please note: with rotating/motile agents, it is better to call the Camera Facing function in the owner blueprint, see 10.2.5 INTERACTIONS / Camera Facing for case description 请注意:对于旋转/运动代理,最好在所有者蓝图中调用相机朝向功能,详见 10.2.5 交互/相机朝向的案例描述。
10.4 Other Ways To Include/embed/add Ninjalive To Actors 10.4 将 Ninjalive 包含/嵌入/添加到演员的其他方法
Adding NinjaLiveComponent to an object class is the preferred / advised way to equip any agent/object with fluidsim. However, there are other methods to do this. The updated version of this document will feature a chapter describing these methods. Briefly: 将 NinjaLiveComponent 添加到对象类是为任何代理/对象配备 fluidsim 的首选/建议方法。然而,还有其他方法可以做到这一点。该文档的更新版本将包含描述这些方法的章节。简而言之:
A. CHILD ACTOR COMPONEN A. 儿童演员组成
Unreal Engine implemented a structure not too long ago, called "ChildActorComponent". The structure enables us to add "Actor" class objects as components to another class (as opposed to adding "ActorComponent" class components). The UE implementation looks somewhat unfinished and accessing child parameters is a bit confusing - but we can add NinjaLive Actor with all its overlap and proxy activation management systems to any actor. We have managed to successfully embed NinjaLive Actor to the default Mannequin Pawn, see: 虚幻引擎不久前实现了一个结构,称为“ChildActorComponent”。该结构使我们能够将“Actor”类对象作为组件添加到另一个类中(而不是添加“ActorComponent”类组件)。UE 的实现看起来有些不完整,访问子参数有点混乱——但我们可以将 NinjaLive Actor 及其所有重叠和代理激活管理系统添加到任何 Actor 中。我们成功地将 NinjaLive Actor 嵌入到默认的人偶 Pawn 中,见:
ThirdPersonCharacter_NinjaAsChildActorComponent in this folder: 此文件夹中的 ThirdPersonCharacter_NinjaAsChildActorComponent:
NinjaLive Actor could be spawned by code / blueprints - and attached to the spawner, creating a similar situation as if it was an "owner". The main problem is, how to (pre)define the params of the "to-be-spawned" Actor? Two ways to do this: NinjaLive Actor 可以通过代码/蓝图生成,并附加到生成器上,创建类似于“拥有者”的情况。主要问题是,如何(预)定义“待生成”Actor 的参数?有两种方法可以做到这一点:
(a) spawn, set params instantly, re-initialize the spawned Live actor 生成,立即设置参数,重新初始化生成的实时演员
(b) by flagging "Expose on spawn" ON for variables in the "to be spawned" Blueprint (in this case NinjaLive), we could access them / set them before spawning - on the spawning node. We have tested this as well - see: ThirdPersonCharacter_NinjaSpawnedAttached in this folder: /Content/FluidNinjaLive /Tutorial /UE_Mannequin_UsageExamples 通过将“在生成时暴露”选项打开,针对“待生成”蓝图中的变量(在这种情况下是 NinjaLive),我们可以在生成节点上访问它们/设置它们。我们也进行了测试 - 请参见此文件夹中的 ThirdPersonCharacter_NinjaSpawnedAttached:/Content/FluidNinjaLive /Tutorial /UE_Mannequin_UsageExamples
10.5 Interaction: setting up Objects to trigger NinjaLive response 10.5 交互:设置对象以触发 NinjaLive 响应
---> See Tutorial Level 21 / Stage2 for examples 请参阅教程第 21 级/第 2 阶段以获取示例
NinjaLive is pre-configured to handle a wide range of interactions as "recipient" - but some steps should be taken on the "causer" side as well (causer = collider, overlapping object). NinjaLive 已预先配置以处理作为“接收者”的各种交互,但在“引发者”一侧也应采取一些步骤(引发者 = 碰撞体,重叠物体)。
A. OVERLAP A. 重叠
In case you want an agent to trigger NinjaLive Actor's OVERLAP sensor: 如果您希望代理触发 NinjaLive Actor 的重叠传感器:
tick ON the "Generate Overlap Events" option at Details /Collision (by default, it is OFF) Repeating: by default, all build-in Unreal objects (eg. a sphere, a plane) are set "not-to" generate "overlap events", this setting should be changed. 在详细信息/碰撞中勾选“生成重叠事件”选项(默认情况下为关闭)。重复:默认情况下,所有内置的虚幻对象(例如,一个球体,一个平面)设置为“不生成重叠事件”,此设置应进行更改。
An interesting fact [UE bug? :) ] - in case an object is INITIALLY (at BeginPlay) in the overlap zone (inside the interaction volume) of NinjaLive Actor, it will be detected as overlapping agent - the "generate overlap" setting influences only "latecomers" and everybody who wants to "leave". In case you have an agent that (1) starts in the area and (2) later leaves and (3) "GenerateOverlapEvents" is NOT enabled - NinjaLive will not receive a notice on the leaving and this might lead to anomalies 一个有趣的事实 [UE bug? :) ] - 如果一个对象在开始播放时(BeginPlay)最初位于 NinjaLive Actor 的重叠区域(交互体积内),它将被检测为重叠代理 - “生成重叠”设置仅影响“后来者”和所有想要“离开”的人。如果你有一个代理(1)最初在该区域内,(2)后来离开,并且(3)“GenerateOverlapEvents”未启用 - NinjaLive 将不会收到离开的通知,这可能导致异常。
B. SKELETAL MESHES B. 骨架网格
NinjaLive starts to track SkeletalMeshes if the "Pawn" interaction filter is active/added. What if a SkeletalMesh is not a pawn? Eg.: you place a SkeletalMesh class object to level and set it to play an animation, and it is not embedded in a blueprint? Not a problem: set the SkeletalMesh (or the object that contains it) to interact like a pawn: NinjaLive 开始跟踪 SkeletalMeshes,如果“Pawn”交互过滤器处于活动状态/已添加。如果一个 SkeletalMesh 不是一个 pawn 怎么办?例如:你将一个 SkeletalMesh 类对象放置到关卡中并设置它播放动画,而它没有嵌入在蓝图中?没问题:将 SkeletalMesh(或包含它的对象)设置为像 pawn 一样进行交互:
Go Details /Collision and set "Collision Preset" to "Pawn" 去详细信息 / 碰撞并将“碰撞预设”设置为“棋子”
In case you do not want to modify the whole collision preset, try to set only the "Object Type". 如果您不想修改整个碰撞预设,请尝试仅设置“对象类型”。
NinjaLive_Utilities Blueprint Actor could be optionally placed on game levels to help development. Symbol: a green letter N. Main features: NinjaLive_Utilities 蓝图演员可以选择性地放置在游戏关卡中以帮助开发。符号:一个绿色字母 N。主要特点:
LIGHT WIDGET 轻量小部件
Add main (directional) light rotation and intensity controller widget to viewport To use this feat, you need to manually add the widget and the target light. 将主(方向性)光源旋转和强度控制小部件添加到视口。要使用此功能,您需要手动添加小部件和目标光源。
EDITOR FPS 编辑器 FPS
By default, UE is set to run at 120 FPS. As a simple kind of performance measurement, legacy ninja versions (until 1.3) were UNLOCKING the UE limit, using the following console command: t.MaxFPS 900 (900 FPS is an arbitrary, theoretical limit) As a result, tutorial levels were running with no FPS-limit - usually around 200-400 FPS on a GTX 1070. This was a simple, good way to have instant feedback on performance bottlenecks. With the release of RTX 3000 series GeForce cards, a problem emerged: these cards were able to run test levels on 900+ FPS --- and the card got exhausted. The "Override Editor 120 FPS limit" got switched off, by default (on most levels). 默认情况下,UE 设置为以 120 FPS 运行。作为一种简单的性能测量,旧版忍者(直到 1.3)通过以下控制台命令解锁 UE 限制:t.MaxFPS 900(900 FPS 是一个任意的理论限制)。因此,教程关卡的帧率没有限制——通常在 GTX 1070 上约为 200-400 FPS。这是一种简单而有效的方法,可以即时反馈性能瓶颈。随着 RTX 3000 系列 GeForce 显卡的发布,出现了一个问题:这些显卡能够在 900+ FPS 下运行测试关卡——而显卡因此过载。默认情况下,“覆盖编辑器 120 FPS 限制”在大多数关卡中被关闭。
POSSESSING PAWN 拥有典当
Possess Nearest Pawn is a very useful function: In case it is OFF, we have a free / unbound spectator camera while in Play. In case it is ON, it will find the NEAREST pawn (compared to our current position in the world) and possess that. Ninja tutorial levels are often populated with multiple pawns at different stages - it is handy to navigate in editor, press Play and instantly possess that given pawn at that given stage. 拥有最近的棋子是一个非常有用的功能:如果它关闭,我们在游戏中有一个自由/无束缚的观众摄像机。如果它开启,它会找到离我们在世界中的当前位置最近的棋子并控制它。忍者教程关卡通常会在不同阶段有多个棋子 - 在编辑器中导航时非常方便,按下播放键并立即控制那个特定阶段的棋子。
The util (once placed on level) influences other SYSTEMIC things, like DOF, motion blur, antialias, camera and mouse-cursor smoothing. 该工具(放置在水平上)会影响其他系统性事物,如景深、运动模糊、抗锯齿、相机和鼠标光标平滑。
NinjaLive_Utilities(self) 忍者直播_工具(self)
4 Root (Inherited) 4 根(继承)
Editorlcon (Inherited) 编辑图标(继承)
Search Details 搜索详情
D Transform D 变换
Live Tools Generic 直播工具通用
Disable Blueprint 禁用蓝图
Show Mouse Cursor 显示鼠标光标
Widget to Rotate Directional Light 旋转方向光的小部件
Viewport_LightRotatorWidget - 视口_光源旋转器小部件 -
Widget Target Directional Light 小部件目标定向灯
Light Source 光源
Antialiasing Quality 抗锯齿质量
Depth Of Field Quality 景深质量
Motion Blur Quality 运动模糊质量
\
4 Live Tools- FPS 4 个实时工具 - FPS
Override Editor 120-FPS-Limit 覆盖编辑器 120 帧限制
Max Editor FPS 最大编辑器帧率
900
4 Live Tools Camera 4 个实时工具相机
Camera and Cursor Smoothing 相机和光标平滑处理
Max Camera Move Speed 最大相机移动速度
8000
Possess Nearest Pawn 拥有最近的棋子
14. Packaging, Compiling in general 14. 包装,编译一般情况
14.1 Remove Preset Manager From Levels Before Compile 14.1 在编译之前从级别中移除预设管理器
(A) Preset Manager is a developer feature: it is not needed for the final product to function (B) PresetManager is using "Editor Only" functions (for file management) that could block compiling - it is advised to remove it from Game Levels completely once development is finished / before compiling (A) 预设管理器是一个开发者功能:它不是最终产品正常运行所必需的 (B) 预设管理器使用了“仅限编辑器”的功能(用于文件管理),可能会阻止编译 - 建议在开发完成后/编译之前完全从游戏关卡中移除它
14.2 Please carefully study chapter 21.3.6 Live Compatibility in this document 14.2 请仔细研究本文件中的第 21.3.6 章 现场兼容性。
Compatibility settings include Trace Channel management and Dynamic Texture Lookup management - both being critical / having an impact in project compiling / packaging 兼容性设置包括追踪通道管理和动态纹理查找管理 - 这两者在项目编译/打包中都是关键的/有影响的
(A) trace channel "autofind" does NOT work in packaged projects - users need to define trace and collision channels manually before packaging - this is a global setting (could be forced to all containers by defining trace channel variable values in the NinjaLiveComponent blueprint) (A) 跟踪通道“自动查找”在打包项目中不起作用 - 用户需要在打包之前手动定义跟踪和碰撞通道 - 这是一个全局设置(可以通过在 NinjaLiveComponent 蓝图中定义跟踪通道变量值强制应用于所有容器)
(B) dynamic texture lookup does NOT work in packaged projects (B) 动态纹理查找在打包项目中不起作用
METHOD1: define sim density and velocity input textures on a per container basis at NinjaLiveComponent /LiveCompatibility /Overwrite*Input (NOT a global setting) 方法 1:在 NinjaLiveComponent / LiveCompatibility / Overwrite*Input 中按容器定义相似密度和速度输入纹理(不是全局设置)
METHOD2: go to Project settings /Packaging /Additional Non-Asset Directories to Package and link the folder where the velocity and density maps are, this forces the system to package the maps. (GLOBAL setting) 方法 2:前往项目设置 / 打包 / 额外非资产目录,打包并链接包含速度和密度图的文件夹,这会强制系统打包这些图。 (全局设置)
14.3 NinjaLive 1.1 - 1.2 blueprints are branched to APEX and non-APEX versions 14.3 NinjaLive 1.1 - 1.2 蓝图分支到 APEX 和非 APEX 版本
In case you are not using the APEX destruction plugin, you could completely remove all APEX related assets from the project before compiling. APEX assets are located at: /Content/FluidNinjaLive/Versions 如果您没有使用 APEX 销毁插件,您可以在编译之前完全从项目中删除所有与 APEX 相关的资产。APEX 资产位于:/Content/FluidNinjaLive/Versions
You could read more about the APEX removal in the Changelog: LINK (see v1.1 changes Important: in NinjaLive 1.3 and higher versions, all APEX related content is removed. 您可以在更新日志中阅读更多关于 APEX 移除的信息:链接(请参见 v1.1 更改 重要提示:在 NinjaLive 1.3 及更高版本中,所有与 APEX 相关的内容已被移除。
14.4 Mobile Rendering, Limitation 14.4 移动渲染,限制
(a) Android graphics drivers are flipping RenderTargets vertically. Since Ninja is using a chain of RenderTargets, only ODD pieces (seem to) flip! To prepare the system for this, go to: NinjaLiveComponent Details /LiveCompatibility - and set "Flip RenderTargets for Mobile" to ON (before compiling). (a) Android 图形驱动程序正在垂直翻转 RenderTargets。由于 Ninja 使用了一系列 RenderTargets,因此只有奇数部分(似乎)会翻转!为了准备系统,请前往:NinjaLiveComponent 详细信息 /LiveCompatibility - 并将“为移动设备翻转 RenderTargets”设置为开启(在编译之前)。
(b) Parallax Mapping is not working on Android Mobile with ES 3.1. Other features (like Raymarching) are tested: OK (b) 在使用 ES 3.1 的 Android 手机上,视差映射无法正常工作。其他功能(如光线行进)测试结果:正常
(c) In NinjaLive 1.0 - 1.2 Tutorial levels contain Destructible Meshes to demonstrate the interaction of fracturing meshes / fluid dynamics / LOD. During mobile packaging, UE returns a warning: "DM_box01_SphericalMapped has a LOD section with 150 bones and the maximum supported number for feature level ES3_1 is 75. ." Since the referenced destructible is not used on mobile levels, you could ignore the warning - it does not block compiling / packaging. (c) 在 NinjaLive 1.0 - 1.2 教程中,关卡包含可破坏网格,以演示破碎网格/流体动力学/LOD 的交互。在移动打包过程中,UE 返回一个警告:“DM_box01_SphericalMapped 有一个包含 150 个骨骼的 LOD 部分,而特性级别 ES3_1 支持的最大数量为 75。”由于引用的可破坏物体未在移动关卡中使用,因此可以忽略该警告——它不会阻止编译/打包。
14.3 RANDOM HINT: we could imitate mobile touchscreen in Unreal Editor, by: Edit/Editor Preferences/Level Editor/Play/Play in Editor/Use mouse for touch: ON 14.3 随机提示:我们可以在虚幻编辑器中模拟移动触摸屏,方法是:编辑/编辑器首选项/关卡编辑器/播放/在编辑器中播放/使用鼠标进行触摸:开启
(a) On the PC: install CodeWorks for Android 在电脑上:安装 Android 的 CodeWorks
(b) On the Mobile: Go to /Settings/About device/Software Info/Build Number: tap 7 times to enable developer mode. In the settings root, search for "developer options", enable USB debugging. 在手机上:前往 /设置/关于设备/软件信息/版本号:连续点击 7 次以启用开发者模式。在设置根目录中搜索“开发者选项”,启用 USB 调试。
15.2 setting up the Unreal Editor for Android packaging 15.2 为 Android 打包设置 Unreal 编辑器
go /Edit /Project Settings /Packaging /Build Config: Developing OR Shipping 去 /编辑 /项目设置 /打包 /构建配置:开发或发布
go /Supported Platforms: set to Android 去 / 支持的平台:设置为安卓
go /Settings (cogwheel icon) /Preview Rendering Level: Android ES 3.1 (Shader (re)compiling! 前往 /设置 (齿轮图标) /预览渲染级别:Android ES 3.1 (着色器 (重新)编译!
15.3 setting up Ninja for Android packagins 15.3 为 Android 打包设置 Ninja
Android graphics drivers are flipping RenderTargets vertically. Since Ninja is using a chain of RenderTargets, only ODD pieces (seem to) flip! To prepare the system for this, go to: Android 图形驱动程序正在垂直翻转 RenderTargets。由于 Ninja 使用了一系列 RenderTargets,因此只有奇数部分(似乎)会翻转!要为此准备系统,请前往:
NinjaLiveComponent Details /LiveCompatibility - and set "Flip RenderTargets for Mobile" to ON (before compiling). NinjaLiveComponent 详情 /LiveCompatibility - 并将“为移动设备翻转渲染目标”设置为开启(在编译之前)。
15.4 Packaging 15.4 包装
go /File /PackageProject /Android /...(ASTC) 去 /文件 /打包项目 /安卓 /...(ASTC)
Select a Folder for Android package and auto-installer (Subfolder is automatically generated) (a) You could follow the packaging process in the Output window. (b) Once done, plug your phone, go to the above provided folder, and start "Install*. bat" - (c) A console pops up with status, and in a minute the package is copied / installed on Android. (d) The package appears at the "All Apps" list with typic UE logo. 选择一个文件夹用于 Android 包和自动安装程序(子文件夹会自动生成) (a) 您可以在输出窗口中按照打包过程进行操作。 (b) 完成后,插入您的手机,进入上述提供的文件夹,启动“Install*.bat” - (c) 控制台弹出显示状态,过了一分钟,包就会复制/安装到 Android 上。 (d) 该包会出现在“所有应用”列表中,带有典型的 UE 标志。
Setting up an Android Phone for developing / package transfer: see UE documentation (enabling developer mode, allowing USB access at file transfer, finding the executable) + USB usage mode: charging VS USB for file transfer 设置 Android 手机以进行开发/包传输:请参阅 UE 文档(启用开发者模式,允许 USB 在文件传输时访问,找到可执行文件)+ USB 使用模式:充电与 USB 文件传输
17. Optimization 17. 优化
17.1 Use Activation Volume 17.1 使用激活体积
By using the "Activation Volume feature", you could reduce the number of parallelly running sim containers. 通过使用“激活体积功能”,您可以减少并行运行的模拟容器数量。
Performance data suggests that we could use 1-2 high res area and 3-6 character simultaneously (on one screen) without taking over too much resources reserved for other game components. For an in-game cinematic the budget is more allowing: a single ultra HD (2k) - OR - 2-4 high res (1k) area fx - AND - 4-8 character effects. 性能数据表明,我们可以同时在一个屏幕上使用 1-2 个高分辨率区域 和 3-6 个角色 ,而不会占用过多为其他游戏组件保留的资源。对于游戏内的电影场景,预算更加宽松:一个超高清(2k)- 或 - 2-4 个高分辨率(1k)区域特效 - 和 - 4-8 个角色特效。
Sim container sleep-wake state could be controlled at NinjaLive Actor Details pane LiveActivation. Sim 容器的睡眠-唤醒状态可以在 NinjaLive 演员详情面板的 LiveActivation 中进行控制。
When placing containers, please keep in mind: Live is not a robust "whole world system", but a system supporting a multitude of dispersed, local interactions. See chapter 8 and 12 on performance. 在放置容器时,请记住:Live 不是一个强大的“整体世界系统”,而是一个支持众多分散的本地互动的系统。请参见第 8 章和第 12 章关于性能的内容。
17.2 Use LOD 17.2 使用 LOD
Ninja is capable of distance-based quality reduction, regarding (a) sim sampling rate (FPS), (b) the number of pressure iteration cycles and (c) the number of tracked objects. See: NinjaLiveComponent Details /LivePerformance 忍者能够进行基于距离的质量降低,涉及(a)模拟采样率(FPS),(b)压力迭代周期的数量和(c)跟踪对象的数量。请参见:NinjaLiveComponent 详细信息 / 直播性能
17.3 Use Memory Pool Manage 17.3 使用内存池管理
Place a single RenderTarget Pool Manager actor on a (persistent) level and allow clients (NinjaLiveComponent owners) to acquire memory from the pool. The option to enable this feature is located at: 在一个(持久)关卡中放置一个单一的渲染目标池管理器角色,并允许客户端(NinjaLiveComponent 拥有者)从池中获取内存。启用此功能的选项位于:
Advantages: (a) Generate a pool of RenderTargets in advance, (b) Let waking / sleeping ninja components [acquire from] / [release to] pool, (c) Avoid lag caused by gametime rendertarget creation and destruction, (d) Spare unreal garbage-collector load 优势:(a)提前生成一组渲染目标,(b)让唤醒/休眠的忍者组件[从]池中[获取]/[释放],(c)避免因游戏时间渲染目标的创建和销毁而导致的延迟,(d)减轻虚幻垃圾收集器的负担
17.4 Reduce the number of Trace Targets 17.4 减少追踪目标的数量
NinjaLive is line tracing overlapping objects to project their position to the 2D sim plane The number of trace targets matter - with 10-20 objects, we are fine. As soon as the number of targets exceeds 50, we could experience a 10-15% drop in performance. Optimize by reducing the number of tracked targets NinjaLive 是通过线条追踪重叠物体,将它们的位置投影到 2D 模拟平面。追踪目标的数量很重要——10-20 个物体时,我们的表现良好。一旦目标数量超过 50 个,我们可能会经历 10-15% 的性能下降。通过减少追踪目标的数量来优化。
EXAMPLE1: DESTRUCTIBLES WITH MANY CHUNKS 示例 1:具有多个碎片的可破坏物体
Use the below option to make Ninja ignore a certain percentage (%) of chunks: 使用以下选项使忍者忽略某个百分比(%)的块:
Mannequin skeleton is made of 68 bones. Usually, we do not need them all - eg: for a full body collision we do not need all the fingers. By manually providing selected bone names at the below input field, we could cover the full body: 模特骨架由 68 块骨头组成。通常,我们并不需要所有的骨头——例如:对于全身碰撞,我们不需要所有的手指。通过在下面的输入框中手动提供选定的骨骼名称,我们可以覆盖全身:
Preset files could refer to bitmaps as density and velocity inputs. The preset stores only the bitmap's name and looks up the file dynamically, at sim initialization. This gives flexibility to the system, we could easily swap images and experiment. On the other hand, we need to handle this, to run the game in Standalone mode and to Package the game: 预设文件可以将位图作为密度和速度输入。预设仅存储位图的名称,并在模拟初始化时动态查找文件。这为系统提供了灵活性,我们可以轻松更换图像并进行实验。另一方面,我们需要处理这个问题,以便在独立模式下运行游戏并打包游戏:
(A) OPTIMIZATION (A) 优化
Once done with experimenting and a preset file is "final", the dynamic parsing/lookup feature is not needed anymore - we could bypass it and "hardwire" a bitmap input to the blueprint, using the below options: 一旦实验完成并且预设文件是“最终版”,动态解析/查找功能就不再需要 - 我们可以绕过它,并将位图输入“硬接入”蓝图,使用以下选项:
NinjaLiveComponent Details /LiveCompatibility /Overwrite Preset Density Input and /Overwrite Preset Velocity Input 忍者直播组件详情 /直播兼容性 /覆盖预设密度输入和 /覆盖预设速度输入
The Issues and FAQ PDF contains a step-by-step guide on disabling DAL: see i005 问题和常见问题 PDF 包含有关禁用 DAL 的逐步指南:请参见 i005
(B) COMPATIBILITY (B) 兼容性
The velocity and density maps from the presets are dynamically loaded in real time but the package system of UE4 doesn't consider dynamically loaded assets as assets it should cook in the final package - so it doesn't include it 预设中的速度和密度图是实时动态加载的,但 UE4 的打包系统并不将动态加载的资产视为应在最终包中烹饪的资产,因此不包括它
In case users do not want to use the "overwrite method" (option "A"), go to.. 如果用户不想使用“覆盖方法”(选项“A”),请前往..
Project settings/Packaging /Additional Non-Asset Directories to Package ...and link the folder where the velocity and density maps were 项目设置/打包/额外非资产目录以打包...并链接速度和密度图的文件夹
(/Content/FluidNinjaLive/Presets), this forces the system to package the maps. (/Content/FluidNinjaLive/Presets),这会强制系统打包地图。
17.6 Carefully plan Rendertarget resolution 17.6 仔细规划渲染目标分辨率
RenderTarget resolution influences performance. RT resolution could be scaled globally and selectively at: NinjaLiveComponent Details/LivePerformance 渲染目标分辨率会影响性能。RT 分辨率可以在以下位置进行全局和选择性缩放:NinjaLiveComponent 详细信息/实时性能
17.6 Carefully choose the Pressure Solver (2 types) and solver settings 17.6 仔细选择压力求解器(2 种类型)和求解器设置
Simulation Pressure Field is calculated using an iterative process. More iterations result in more detail in turbulent structures / vorticity. More iterations also need more RenderTarget read/write operations per frame. Since RenderTarget write operations have a critical impact on performance, we are facing a TRADE OFF situation: performance VS structural details 模拟压力场是通过迭代过程计算的。更多的迭代会导致湍流结构/涡量的细节增加。更多的迭代还需要每帧更多的 RenderTarget 读/写操作。由于 RenderTarget 写操作对性能有重大影响,我们面临着一个权衡:性能与结构细节。
Please have a look at this demo level: NinjaLive_Level02B_CriticalSettings - demonstrating the trade off. FIVE pressure iterations per frame (per render cycle) seems like a good compromise 5 is set as default for NinjaLive. You could adjust this value at: NinjaLiveComponent Details /LivePerformance 请查看这个演示关卡:NinjaLive_Level02B_CriticalSettings - 演示权衡。每帧(每个渲染周期)五次压力迭代似乎是一个不错的折衷,5 被设为 NinjaLive 的默认值。您可以在以下位置调整此值:NinjaLiveComponent 详细信息 / LivePerformance
17.8 Reduce the number of "per Tick" refreshed Dynamic Material Params 17.8 减少“每次刷新”动态材质参数的数量
To increase flexibility during VFX development, by default almost all fluidsim params are queried / refreshed / forwarded to sim materials ON A PER TICK BASIS. Once your project is about to finish / you are done with param tweaking, you could eliminate dynamic (per tick) param refreshing by putting non-changing values on a "do once" branch, or initializing them on "EventBeginPlay". Params like Noise tiling and offset are typically targeted for this optimization: probably nobody is going to animate noise dynamically in game. 为了在视觉特效开发过程中增加灵活性,默认情况下,几乎所有流体模拟参数都在每个时间刻度上被查询/刷新/转发到模拟材料。一旦您的项目即将完成/您完成了参数调整,您可以通过将不变的值放在“只做一次”分支上,或在“事件开始播放”时初始化它们,从而消除动态(每个时间刻度)参数刷新。像噪声平铺和偏移这样的参数通常是优化的目标:可能没有人会在游戏中动态地动画噪声。
17.9 Blueprint Nativization (will be deprecated in UE5!) 17.9 蓝图本地化(将在 UE5 中弃用!)
Turn on Blueprint Nativization to improve the performance of COMPILED (packaged) project at Project Settings/Packaging AND in the Ninja Core Blueprints, 打开蓝图本地化以提高在项目设置/打包中的已编译(打包)项目的性能,以及在忍者核心蓝图中
by opening the BP and visiting the Blueprint Class Settings: Nativize = TRUE 通过打开 BP 并访问蓝图类设置:Nativize = TRUE
18. Changelog / Updates 18. 更新日志 / 更新
This chapter is outsourced to a separate document: Link to PDF 本章已外包至单独的文档:链接到 PDF
19. Known Issues & FAQ 19. 已知问题与常见问答
This chapter is outsourced to a separate document: Link to PDF 本章已外包至单独的文档:链接到 PDF
20. Niagara 20. 尼亚加拉
Update: Live 1.7 has been released with Niagara two-way data flow: (A) driving particles using fluidsim -- (B) driving fluidsim using particles 更新:Live 1.7 已发布,带有尼亚加拉双向数据流:(A) 使用流体模拟驱动粒子 -- (B) 使用粒子驱动流体模拟
(A) is demonstrated on Tutorial Levels UseCase Level 11 (B) is showcased on Tutorial Level UseCase Levels (A) 在教程级别 的用例级别 11 中展示 (B) 在教程级别 的用例级别 中展示
20.1 Driving particle systems using real time fluid data 20.1 使用实时流体数据驱动粒子系统
NinjaLive is performing real-time fluid simulation. The sim buffers could be used to drive Niagara GPU-particle masses. Eg.: Sim velocity field is ideal for accelerating particles, sim pressure is good for vertical-position-offset, density could be used to control spawning or mask opacity or for tone-mapping. NinjaLive 正在进行实时流体模拟。模拟缓冲区可以用于驱动 Niagara GPU 粒子质量。例如:模拟速度场非常适合加速粒子,模拟压力适合垂直位置偏移,密度可以用于控制生成或遮罩不透明度或进行色调映射。
Niagara Systems on our example levels are using a 2D grid setup: particles are generated along an orthogonal grid and their XY position is used as UV to map them with 尼亚加拉系统在我们的示例级别中使用二维网格设置:粒子沿正交网格生成,它们的 XY 位置用作 UV 进行映射
2D Fluidsim data, received from NinjaLive via the TextureSample Niagara Module. 2D Fluidsim 数据,通过 TextureSample Niagara 模块从 NinjaLive 接收。
See video demonstrating Level 20: LINK 查看演示 20 级的视频:链接
20.3 LINKING NIAGARA AND NINJA 20.3 连接尼亚加拉和忍者
Update: Live 1.7 changed the way how niagara is driven (case A): feeding sim data to Niagara happens directly - no need to use on-disk RenderTargets anymore. 更新:Live 1.7 更改了 Niagara 的驱动方式(案例 A):将模拟数据直接馈送到 Niagara - 不再需要使用磁盘上的 RenderTargets。
VIDEO TUTORIAL: LINK (See original guide at 20.3.B) 视频教程:链接(请参阅原始指南 20.3.B)
Tag the actor that embeds the targeted Niagara Component 标记嵌入目标尼亚加拉组件的演员
t could be any Actor - even the same actor that embeds NinjaLiveComponent 它可以是任何演员——甚至是嵌入 NinjaLiveComponent 的同一个演员
To do: we are writing ninja internal simulation buffer(s) to external RenderTargets and set a given NiagaraSystem to read these RenderTarget(s) as input 待办事项:我们正在将忍者内部模拟缓冲区写入外部渲染目标,并设置给定的 Niagara 系统以将这些渲染目标作为输入读取
Create one or more RenderTargets in advance 提前创建一个或多个渲染目标
These are going to serve as a data-bridge to Niagara. Right click in the Content Browser, go to "Materials and Textures", choose "RenderTarget" 这些将作为通往尼亚加拉的数据桥。在内容浏览器中右键单击,转到“材质和纹理”,选择“渲染目标”。
Set ninja to write the RenderTarget(s) 设置忍者以编写渲染目标
a. switch on "Draw Internal RenderTargets to External" a. 打开“将内部渲染目标绘制到外部”
b. chose which buffers to export b. 选择要导出的缓冲区
c. pick an existing (previously created) empty RenderTarget to write 选择一个现有的(之前创建的)空 RenderTarget 进行写入
Once the RenderTargets are created and ninja is set up to write them: Tell Niagara to read the RTs 一旦创建了渲染目标并设置忍者以写入它们:告诉尼亚加拉读取渲染目标
a. select a Niagara System on level that you would like to drive 选择您想要驾驶的尼亚加拉系统的级别。
b. locate the actual uasset that is used (Details Panel /Niagara System asset b. 找到实际使用的 uasset(详细面板/ Niagara 系统资产)
c. open the system with Niagara editor (double click on it in the Content Browser c. 在内容浏览器中双击打开 Niagara 编辑器。
d. locate the "Sample Texture" module in the Stack d. 在堆栈中找到“样本纹理”模块
. provide the pre-created RenderTarget as input in the "Texture" field 在“纹理”字段中提供预创建的渲染目标作为输入。
Ease of use: we could handle Niagara texture input as a parameter - so we can provide RenderTarget input on the Actor Details panel (no need to edit actual Niagara Systems when picking RenderTargets) 易用性:我们可以将 Niagara 纹理输入作为参数处理 - 因此我们可以在 Actor 详细信息面板上提供 RenderTarget 输入(选择 RenderTargets 时无需编辑实际的 Niagara 系统)
A. create a Texture-Sample type "User Parameter" in the Niagara System 在 Niagara 系统中创建一个纹理样本类型的“用户参数”。
B. provide this param as input to the "Sample Texture" module B. 将此参数作为输入提供给“样本纹理”模块
C. set the value of this param by selecting the on-level niagara system, then going to the / Details Panel / Overrides C. 通过选择在线的尼亚加拉系统来设置此参数的值,然后转到 / 详细面板 / 覆盖。
21. Complete List of NinjaLive UI parameters 21. NinjaLive UI 参数完整列表
21.1 Preset Manager: Ul exposed params & functions 21.1 预设管理器:用户界面暴露的参数和功能
21.2 NinjaLive Actor params 21.2 NinjaLive 演员参数
21.3 NinjaLive Actor Component params 21.3 NinjaLive 演员组件参数
CHAPTER MOVED TO EXTERNAL PDF: LINK 章节已移至外部 PDF:链接
22. Live fluidsim pipeline: technical description 22. 实时流体仿真管道:技术描述
23. Using Sequencer to control NinjaLive Actors 23. 使用序列器控制 NinjaLive 演员
Related example content: Level 5, Stage 4 (added to Live 1.0.0.4) 相关示例内容:第 5 级,第 4 阶段(已添加到 Live 1.0.0.4)
Related Tutorial Video: LINK 相关教程视频:链接
NinjaLive interactions and behaviour could be keyframed by UE Sequencer. NinjaLive 的交互和行为可以通过 UE Sequencer 进行关键帧设置。
In general, we could animate (1) effectors - any agent that triggers NinjaLive response and (2) sim parameters - internal variables that change fluidsim behaviour and 一般来说,我们可以动画化 (1) 效果器 - 任何触发 NinjaLive 响应的代理,以及 (2) 模拟参数 - 改变流体模拟行为的内部变量
(3) output material instance parameters. Case " 3 " is not described in this document (3) 输出材料实例参数。案例 "3" 在本文件中未描述。
23.1 Effectors 23.1 效应器
An object / mesh could be effector if... 一个物体/网格可以是效应器,如果...
A. "Generate Overlap Events" option at Actor Details /Collision is flagged ON (by default, it is OFF) --- See 10.5 A. “生成重叠事件”选项在演员详情/碰撞中被标记为开启(默认情况下为关闭)--- 见 10.5
B. their "Collision Object Type" is set to one of the supported types ( WorldStatic, WorldDynamic, Pawn, Vehicle, Destructible, PhysicsBody ) B. 他们的“碰撞对象类型”设置为支持的类型之一(WorldStatic、WorldDynamic、Pawn、Vehicle、Destructible、PhysicsBody)
C. the class filters of the triggered (overlapped) container (NinjaLive Actor) are set to respond to the type of the given object. See 10.1.6 C. 触发的(重叠的)容器(NinjaLive Actor)的类过滤器被设置为响应给定对象的类型。见 10.1.6
If an effector meets the above criteria and is keyframed to collide / overlap with a NinjaLive container it should trigger fluid response 如果一个效应器符合上述标准并且被关键帧设置为与 NinjaLive 容器碰撞/重叠,它应该触发流体响应
(Make sure you have properly set "Interaction Volume" size) --- see 10.1.5, 21.2.2 (确保您已正确设置“交互音量”大小)--- 参见 10.1.5,21.2.2
Note 1: Live generates fluidsim at runtime. To preview effector-fluid interaction, you should run the game (press play in editor). In case you are running Live in a Viewport, you could fit Sequencer to a nearby panel and edit keyframes / move the time-slider while the sim is running. 注意 1:Live 在运行时生成流体模拟。要预览效应器与流体的交互,您应该运行游戏(在编辑器中按播放)。如果您在视口中运行 Live,可以将 Sequencer 适配到附近的面板,并在模拟运行时编辑关键帧/移动时间滑块。
Note 2: One method to run the already keyframed sequence automatically at Play (and set the sequence to repeat) is to edit the Level blueprint. See Screenshot: LINK 注意 2:一种在播放时自动运行已关键帧序列(并设置序列为重复)的方式是编辑关卡蓝图。请参见截图:链接
23.2 Parameters 23.2 参数
NinjaLiveComponent is using many params - most of them are set only once, at initialisation these can not be animated/keyframed (typically system variables). A subset of params (typically fluidsim params) are being refreshed every tick - and could be efficiently animated These params also appear on the Preset Manager UI. See 21.1 for a complete list NinjaLiveComponent 使用了许多参数 - 其中大多数仅在初始化时设置一次,这些参数无法进行动画/关键帧(通常是系统变量)。一部分参数(通常是流体模拟参数)在每个时钟周期都会刷新 - 并且可以高效地进行动画。这些参数也出现在预设管理器用户界面中。请参见 21.1 获取完整列表。
Important: NinjaLiveComponent blueprint params are by default NOT accessible for the sequencer. 重要提示:NinjaLiveComponent 蓝图参数默认情况下对序列器不可访问。
A. To make a given fluidsim param accessible for the sequencer: open/Content/FluidNinjaLive/NinjaLiveComponent blueprint, look up the param in the "Variables" list, select it, go to the Details panel (in the blueprint editor) and flag "Expose to Cinematics" = ON. Compile and Save the blueprint A. 要使给定的 fluidsim 参数可供序列器使用:打开/Content/FluidNinjaLive/NinjaLiveComponent 蓝图,在“变量”列表中查找该参数,选择它,转到详细信息面板(在蓝图编辑器中),并将“暴露给电影”标记为开启。编译并保存蓝图。
B. To animate "Exposed" fluidsim params, add a given NinjaLive Actor to the sequencer Track list (+), then add NinjaLiveComponent as subtrack (+), then add the (preemptively) exposed param as subtrack B. 要使“暴露”的流体模拟参数动画化,请将给定的 NinjaLive 演员添加到序列器轨道列表 (+),然后将 NinjaLiveComponent 添加为子轨道 (+),接着将(预先)暴露的参数添加为子轨道 。
NinjaLive is working fine with the new UE 4.26 Movie Render Queue NinjaLive 在新的 UE 4.26 电影渲染队列中运行良好。
With the predecessor Render to Sequence it does not work! 前身 Render to Sequence 无法使用!
Open the level that you would like to render ( NinjaLive_Level08_Demo_Roots is ideal for testing: single container, no proximity activation 打开您想要渲染的关卡(NinjaLive_Level08_Demo_Roots 非常适合测试:单个容器,无接近激活)
Select "BP_NinjaLive_Utilities" on level and on the Details Panel: switch OFF the "Possess Nearest Pawn" flag 在关卡中选择“BP_NinjaLive_Utilities”,在详细信息面板上:关闭“占有最近的棋子”标志
Place Actor Panel: drag a camera on level ---> set the camera to the needed position 放置演员面板:在关卡上拖动相机 ---> 将相机设置到所需位置
Content Browser: double-click on the level sequence 内容浏览器:双击级别序列
In Sequencer: right click, "Actor to Sequencer" --> add the recently placed Camera from the Leve 在 Sequencer 中:右键点击,“Actor 到 Sequencer” --> 添加最近放置的相机从关卡
Viewport, Top-Left corner UI /Perspective roll down menu: select Camera Actor 视口,左上角 UI / 透视下拉菜单:选择相机演员
In MRQ, click on the green "Render" roll down menu add the previously created Level Sequence 在 MRQ 中,点击绿色的“渲染”下拉菜单 ,添加之前创建的关卡序列
Adjust Output Folder and Config - if needed 调整输出文件夹和配置 - 如有需要
(by default: JPEG sequence, to "/Saved/MovieRenders/..") (默认:JPEG 序列,保存到“/Saved/MovieRenders/..”)
12. Check 23.4: QUALITY NOTES 12. 检查 23.4:质量备注
Press green "Render (Local)" in the Bottom-Right corner 在右下角按绿色的“渲染(本地)”按钮
After a few seconds of initialization, renders the image sequence to the provided folder 经过几秒钟的初始化, 将图像序列渲染到提供的文件夹中
23.4 IMPORTANT NOTES ON QUALITY 23.4 关于质量的重要说明
Note 1: on many levels, sim containers are Proximity Activated (work only when the spectator/pawn is close) - and the cinematic camera does not necessarily trigger the proximity sensor. In this case, your sim container is passive. Disable proximity sensor at: NinjaLive details panel /LiveActivation 注意 1:在许多层面上,模拟容器是接近激活的(仅在观众/棋子靠近时工作)——而电影摄像机不一定会触发接近传感器。在这种情况下,您的模拟容器是被动的。请在:NinjaLive 详细面板/实时激活中禁用接近传感器。
Note 2: many times, distance based LOD is enabled on sim containers (lowers quality) To make sure you render the sequence using the best available quality, disable LOD at: NinjaLive details panel /NinjaLiveComponent/LivePerformance/LOD bool flags 注意 2:许多情况下,基于距离的 LOD 在模拟容器上启用(降低质量)。为了确保您以最佳可用质量渲染序列,请在以下位置禁用 LOD:NinjaLive 详细信息面板 /NinjaLiveComponent/LivePerformance/LOD 布尔标志
Note 3: ninja is performing calculations in the 60 FPS range. When the Movie Render Queue is set to 30 FPS, it hurts ninja visual quality. Set MRQ rendering FPS to 60 and (if needed) achieve lower frame rates by skipping odd/even frames when compositing the output. 注意 3:ninja 正在以 60 帧每秒的范围进行计算。当电影渲染队列设置为 30 帧每秒时,会影响 ninja 的视觉质量。将 MRQ 渲染帧率设置为 60,并在合成输出时(如有需要)通过跳过奇数/偶数帧来实现较低的帧率。
Related chapter in the Manual 手册中的相关章节
Chapter 23, Sequencer (LINK) 第 23 章,序列器(链接)
Related tutorial videos: 相关教程视频:
FluidNinja LIVE - Using SEQUENCER to animate Objects and Simulation Containers (LINK) Improve Your Renders With Unreal Movie Render Queue (LINK) FluidNinja LIVE - 使用 SEQUENCER 动画对象和模拟容器 (链接) 使用虚幻电影渲染队列提升您的渲染效果 (链接)
24. Volumetrics 24. 体积测量
V2 (UE 5.3 and above) V2(UE 5.3 及以上)
Unreal Engine 5.3 came with a new volume type: Heterogeneous Volume. Accordingly, ninja has been updated with a new generic volume function, 虚幻引擎 5.3 带来了一个新的体积类型:异质体积。因此,忍者已更新为一个新的通用体积功能,
Handling ALL native UE volume types: fog, clouds - and heterogeneous volumes. 处理所有本机 UE 体积类型:雾、云和异构体积。
The update comes with... 更新内容包括...
wrapper materials for the new volume function 新体积功能的包装材料
minimal setups, showcasing volume function properties 最小设置,展示音量功能属性
Setups are demonstrating usage in the 1 meter to 100 kilometers size range, combining various volume types and exploring multilayer volumes. 设置展示了在 1 米到 100 公里的尺寸范围内的使用,结合了各种体积类型并探索多层体积。
COMPLETE VOLUMETRICS V2 DOCUMENTATION: LINK 完整的 V2 体积文档:链接
NEW CONTENT & LEVELS: /Content/FluidNinjaLive/Volumetrics_v2 新内容和关卡:/Content/FluidNinjaLive/Volumetrics_v2
TUTORIAL VIDEOS: WORK IN PROGRESS 教程视频:进行中
SHOWREEL VIDS: LINK1, LINK2 展示视频:链接 1,链接 2
The update also employs a new technique to align volumes with surfaces. 该更新还采用了一种新技术,将体积与表面对齐。
We are sampling landscape height using RVT volumes and forwarding the height data 我们正在使用 RVT 体积采样地形高度,并转发高度数据
to the volume material. The technique could potentially replace "floor snapper", 到体积材料。该技术有可能取代“地板夹”。
a previously introduced surface-aligning technique (See Chapter 31.2). 先前介绍的表面对齐技术(见第 31.2 章)。
RELATED TUTORIAL, LANDSCAPE ALIGNED VOLUMES: LINK 相关教程,按景观对齐的体积:链接
V1 (before UE 5.3) V1(在 UE 5.3 之前)
Ninja already supported Fog Volumes and Cloud Volumes before UE 5.3 and employed a third Custom Volume type, labeled as "Smoke Volume", Ninja 在 UE 5.3 之前已经支持雾体积和云体积,并使用了一种名为“烟雾体积”的第三种自定义体积类型。
that does pretty much the same as the recently introduced native UE Heterogeneous volume. 这基本上与最近推出的原生 UE 异构体积相同。
The functions, materials and example levels that demonstrate the original (v1) volume technology remain in the project - working fine / have not become deprecated. 该项目中仍保留展示原始(v1)体积技术的功能、材料和示例级别 - 运行良好/尚未被弃用。
COMPLETE VOLUMETRICS V1 DOCUMENTATION: LINK 完整的体积测量 V1 文档:链接
OLD CONTENT: /Content/FluidNinjaLive/Volumetrics 旧内容:/Content/FluidNinjaLive/体积测量
OLD LEVELS: Tutorial Levels 23-28, 30-31 旧关卡:教程关卡 23-28, 30-31
A feature to add dynamic, flowing details to low and medium resolution simulations at minimal cost. Introduced to NinjaLive 1.3 一种功能,可以以最低成本为低和中等分辨率的模拟添加动态、流畅的细节。已在 NinjaLive 1.3 中引入。
We are using sim velocity buffer as a flow map to advect a user defined map (typically procedural noise) - and mix the dynamically flowing details to the native simulation output 我们正在使用模拟速度缓冲区作为流动图,以传递用户定义的图(通常是程序噪声)——并将动态流动的细节与原生模拟输出混合
ncluded examples: 包括示例:
- Level 29 - 29 级
adding cell noise to flame or combustion type fluids 向火焰或燃烧型流体添加单元噪声
- Level 11 - 11 级
adding a cloud noise to a smoke-sim 在烟雾模拟中添加云噪声
- Level 10B, Stage1 - 10B 级,第一阶段
adding grainy "sand like" noise to viscous fluids 向粘稠液体添加颗粒状的“沙子般”噪音
sible at: 可在:
Output Material Instance /FlowMap parameter group 输出材质实例/流图参数组
Concept behind Detail Maps: 细节地图背后的概念:
Ninja fluid-sim pipeline is a collection of various data types like density, velocity, pressure divergence. Density is generally handled like the "final product" while others considered as "by-products". How about utilising sim "by-products" for something useful? Pressure is ideal for optical and geometric distortion (see Level21 Stage6), velocity could be used to drive particles (see Level 20A,B) or: to drive texture advection - traditionally called "flow mapping" The flowmap concept: we are using two identical copies of a static texture and distort the image-pair using a shifted period oscillation. Distortion is driven by a velocity map. A velocity map is a field with directional vectors, ideal to tell particles / texels "which direction to go". 忍者流体模拟管道是各种数据类型的集合,如密度、速度和压力散度。密度通常被视为“最终产品”,而其他则被视为“副产品”。如何利用模拟的“副产品”来做一些有用的事情呢?压力非常适合用于光学和几何失真(见第 21 关第 6 阶段),速度可以用来驱动粒子(见第 20A、B 关)或:驱动纹理平流——传统上称为“流动映射”。流动映射的概念是:我们使用两份相同的静态纹理,并通过移动周期振荡来扭曲这对图像。扭曲由速度图驱动。速度图是一个具有方向向量的场,理想用于告诉粒子/纹素“该朝哪个方向移动”。
Ninja already utilizes flowmaps - this is how we make volumetric noise flow on clouds - see Levels 24-28. Now, an other flowmap feature has been implemented: detail mapping 忍者已经使用流图——这就是我们如何让体积噪声在云层上流动——请参见第 24-28 级。现在,另一个流图功能已被实现:细节映射。
26. Controlling Live in real time 26. 实时控制
To grasp the idea of real time control, load any ninja tutorial level, place a Preset Manager, start the Game (Play) and use Preset Manager to (A) interactively set Fluidsim Parameters, (B) change Input Textures and (C) Output Materials. 要理解实时控制的概念,请加载任何忍者教程关卡,放置一个预设管理器,开始游戏(播放),并使用预设管理器(A)交互式设置流体模拟参数,(B)更改输入纹理和(C)输出材料。
See videos: changing Sim Params: LINK / changing Output Materials: LINK1, LINK2 查看视频:更改仿真参数:链接 / 更改输出材料:链接 1,链接 2
Similar control could be achieved by Game Logic (Blueprints, Code) or Sequencer. 类似的控制可以通过游戏逻辑(蓝图、代码)或序列器实现。
Practical example1: using NinjaLive Actor for an area FX. We would like to control the FX params using sequencer - to create a choreographed Cinematics Sequence See this video: LINK 实际示例 1:使用 NinjaLive Actor 进行区域特效。我们希望通过序列器控制特效参数,以创建编排的电影序列。请查看此视频:链接
Practical example2: character ability FX is delivered by an embedded NinjaLiveComponent - we switch the fluidsim preset and the output material as the character uses various ability-FX 实际示例 2:角色能力 FX 由嵌入的 NinjaLiveComponent 提供 - 当角色使用各种能力 FX 时,我们切换流体模拟预设和输出材料
Control subjects in the NinjaLiveComponent blueprint could be grouped as: 在 NinjaLiveComponent 蓝图中,控制对象可以分为以下几类:
Could be modified instantly 可以立即修改
Could be modified by re-initializing NinjaLiveComponent blueprint 可以通过重新初始化 NinjaLiveComponent 蓝图进行修改
Simple Variables (eg. floats, integers) could be modified instantly by accessing NinjaLiveComponent. Variables have "telling names" - and you could read about them using the Tooltips and the Manual. Pls open up NinjaLiveComponent Blueprint: Preset Variables (for example) could be found under the "NONPUBLICLive Preset Variables" group. --- by code you can access them anytime. In the Blueprint that embeds NinjaLiveComponent (eg. a character) params could be directly accessed. For other (external) blueprints, the LIVE INTERFACE could be used. To modify a variable by Sequencer, you need to set "expose to cinematics" to TRUE. See Level 5, demonstrating how to use the Interface and Sequencer. 简单变量(例如浮点数、整数)可以通过访问 NinjaLiveComponent 即时修改。变量具有“说明性名称”——您可以通过工具提示和手册了解它们。请打开 NinjaLiveComponent 蓝图:预设变量(例如)可以在“非公开实时预设变量”组下找到。——通过代码,您可以随时访问它们。在嵌入 NinjaLiveComponent 的蓝图中(例如,一个角色),参数可以直接访问。对于其他(外部)蓝图,可以使用实时接口。要通过 Sequencer 修改变量,您需要将“暴露给电影”设置为 TRUE。请参见第 5 级,演示如何使用接口和 Sequencer。
Asset-type-variables (like a DataTable with preset-values, or an OutputMaterial Instance) could be modified by re-initializing NinjaLive. (Trivial example: the Preset Manager re-initilizes ninja when changing materials or loading a new preset.) 资产类型变量(如带有预设值的数据表或输出材料实例)可以通过重新初始化 NinjaLive 进行修改。(简单示例:当更改材料或加载新预设时,预设管理器会重新初始化 Ninja。)
---> See image below: Preset File and OutputMaterial index changing - combined with RePlay 请参见下图:预设文件和输出材料索引更改 - 结合重放
Swapping Materials: only those output materials could be accessed (and used for swapping), that are previously added to the OutputMaterials array at LiveComponent /LiveGeneric Swapping process: (1) changing the OutputMaterialSelected INDEX, then (2) re-initialize ninja 交换材料:只有那些之前添加到 OutputMaterials 数组中的输出材料才能被访问(并用于交换),在 LiveComponent / LiveGeneric 交换过程中:(1)更改 OutputMaterialSelected 索引,然后(2)重新初始化忍者
Please open NinjaLiveComponent Blueprint, and locate MODULE001. Check the RePlay node. As the label tells us: this event could be called remotely (eg. by an interface, or event dispatcher) 请打开 NinjaLiveComponent 蓝图,并找到 MODULE001。检查 RePlay 节点。正如标签所示:此事件可以被远程调用(例如,通过接口或事件调度器)。
27. Mapping sim on 3D Mesh surfaces 27. 在 3D 网格表面上映射模拟
See this video, demonstrating the usage of 3D meshes: LINK 查看这个视频,演示 3D 网格的使用:链接
The technique is UE5 compatible. 该技术与 UE5 兼容。
NinjaLive is a 2D fluid sim. Besides the original (A) camera facing flat planes and (B) parallax mapping, new techniques are being added to enhance and spatialize sim output. NinjaLive 是一个 2D 流体模拟器。除了原始的 (A) 相机朝向平面和 (B) 视差映射外,还添加了新技术以增强和空间化模拟输出。
Live 1.2 could utilize (C) UE Volumetric Fog and (D) UE Volumetric Clouds (see Chapter 24). Live 1.2 可以利用 (C) UE 体积雾和 (D) UE 体积云(见第 24 章)。
Live 1.4 introduces two more techniques: Live 1.4 引入了两种新技术:
raymarching based translucent volumetrics (entitled as "VolumeSmoke" 基于光线行进的半透明体积渲染(标题为“体积烟雾”)
polygonal mesh based opaque 3D surfaces 多边形网格基础的不透明 3D 表面
This video demonstrates the two techniques: LINK + you could read about VolumeSmoke in Chapter 24. This chapter describes the mesh based solution. 该视频演示了两种技术:链接 + 你可以在第 24 章中阅读关于 VolumeSmoke 的内容。本章描述了基于网格的解决方案。
Originally, Ninja used Parallax Occlusion Mapping (POM) to imitate depth. POM does not look good from a low camera angle. Please have a look at LEVEL 10-B. The fluidsim containers on this Level are all using OPAQUE Output Material, which creates a discrete surface - the fluid surface is NOT at all fog like (it is non-translucent) - but opaque, shiny, reflective - like blood, mud, snow. 最初,Ninja 使用视差遮挡映射(POM)来模拟深度。从低角度拍摄时,POM 的效果并不好。请查看 LEVEL 10-B。此关卡上的流体模拟容器都使用不透明输出材质,这创造了一个离散的表面——流体表面完全不是雾状的(它是非半透明的)——而是不透明、光滑、反射的——像血液、泥土、雪。
The opaque surface property enables us to use real 3D meshes to display sim output: by defining a pre-tessellated (hi-poly) grid as TraceMesh, and using simulation density as a height-field to drive vertex World Position Offset (WPO), we could dynamically distort the TraceMesh: the result looks good from low camera angles as well. 不透明表面特性使我们能够使用真实的 3D 网格来显示模拟输出:通过将预先细分的(高多边形)网格定义为 TraceMesh,并使用模拟密度作为高度场来驱动顶点世界位置偏移(WPO),我们可以动态扭曲 TraceMesh:从低摄像机角度看,效果也很好。
27.1 Reconfiguring a sim container from POM usage to 3D sim mesh usage A STEP-BY-STEP GUIDE 27.1 将仿真容器从 POM 使用重新配置为 3D 仿真网格使用的逐步指南
Select Container 选择容器
Select TraceMesh Actor Component 选择 TraceMesh Actor 组件
Replace "NinjaLiveTraceMesh" (a single quad plane) with a tessellated plane (eg. SM_plane_300x300) 将“NinjaLiveTraceMesh”(一个单一的四边形平面)替换为一个细分平面(例如:SM_plane_300x300)
Enable "Cast Shadow" at the mesh component Details Panel 在网格组件详细面板中启用“投射阴影”
Select NinjaLiveComponent 选择 NinjaLiveComponent
Go to LiveGeneric param group, Locate the currently used OutputMaterial in the array (checking the OutputMaterialSelected INDEX below the array helps) 前往 LiveGeneric 参数组,定位数组中当前使用的 OutputMaterial(检查数组下方的 OutputMaterialSelected 索引有助于此)
Locate "Parallax" param group, disable ParallaxMapping (not needed when using a 3D sim mesh) 找到“视差”参数组,禁用视差映射(在使用 3D 模拟网格时不需要)
Ninja sim containers could be used two ways: 忍者模拟容器可以有两种使用方式:
(1) Fixed position containers are here since Live 1.0: eg. puddle, bonfire, portal.. 固定位置容器自 Live 1.0 起就存在:例如,水坑、篝火、传送门。
(2) Containers attached to moving Actors are improved through Live v1.2 - v1.7: imagine a large sim area attached to the player, always following, handling all interactions around the player - creating an illusion that we are moving in a full dynamic world. (2) 附加在移动角色上的容器通过 Live v1.2 - v1.7 得到了改进:想象一个大型模拟区域附加在玩家身上,始终跟随,处理玩家周围的所有互动——创造出我们在一个完全动态世界中移动的幻觉。
28.1 When the sim container is travelling in WorldSpace, we adjust sim density and velocity according to global movement direction and speed. Methods: 28.1 当模拟容器在世界空间中移动时,我们根据全球移动方向和速度调整模拟密度和速度。方法:
A. Offset all simulation buffers inverse moving direction A. 反向移动方向偏移所有仿真缓冲区
Makes the already emitted fluid to behave inertly / lag behind the emitter 使已经排出的流体表现得惰性 / 滞后于发射器
B. Add/subtract motion vector to sim velocity buffer B. 将运动矢量加/减到模拟速度缓冲区
Push fluid towards - or against - moving direction 将液体推向移动方向或与移动方向相反
Key params: Preset Manager /Fields / Velocity Field Influenced by Sim Area Motion 关键参数:预设管理器 / 字段 / 速度场受模拟区域运动影响
Tweaking A/B could produce very different outcomes: eg. forcing the sim to lag behind but also setting a negative velocity that pushes it along moving direction creates a fluid that creeps / lingers behind the emitter : 调整 A/B 可能会产生非常不同的结果:例如,强制模拟滞后,但同时设置一个负速度,使其沿移动方向推进,形成一种在发射器后面缓慢移动/停留的流体。
28.2 Additional settings to tweak: 28.2 额外的设置调整:
A. Feedback (Preset Manager UI /Sim section) Defines "Trail Lifetime" - the time needed to fade out the lingering fluid A. 反馈(预设管理器用户界面/模拟部分)定义“拖尾寿命” - 褪去残留液体所需的时间
B. Drag (PresetManager UI /Brush section) Stirring/dragging effect of moving objects on the simulation B. 拖动(预设管理器 UI / 画笔部分)移动物体在模拟中的搅动/拖动效果
C. Puncture-modify C. 穿刺修改
NinjaLiveComponent Details /LiveBrushSettings /SimAreaMotionEffectsBrushPuncture The Z component of sim area motion (perpendicular to TraceMesh) multiplies PUNCTURE --- in practice: when the sim container is moving towards/away from us, the "boiling" effect of puncture is more intense (by default) - and less intense when the param is set to ZERO NinjaLiveComponent 详细信息 /LiveBrushSettings /SimAreaMotionEffectsBrushPuncture 模拟区域运动的 Z 组件(垂直于 TraceMesh)乘以 PUNCTURE --- 实际上:当模拟容器朝我们移动/远离我们时,穿刺的“沸腾”效果更强(默认情况下) - 当参数设置为零时效果较弱
D. Latency NinjaLiveComponent /LiveInteraction /LegacySimAreaMotionEffectsSimDensity D. 延迟忍者实时组件 / 实时互动 / 传统模拟区域运动效果模拟密度
29. New features: Live 1.7 29. 新功能:实时 1.7
Interactive mini demo exe: LINK + Youtube playlist: LINK 互动迷你演示 exe:链接 + YouTube 播放列表:链接
Tutorial video covering this chapter: LINK + All-in-one Tutorial: LINK 本章的教程视频:链接 + 一体化教程:链接
Live 1.7 is a major update. Features: Live 1.7 是一个重大更新。功能:
(1) driving other systems directly (no intermediate assets. eg RenderTargets) (1) 直接驱动其他系统(没有中间资产,例如渲染目标)
(2) improved world-space motion (2) 改进的世界空间运动
(3) local solver combined with global pattern generator large responsive fields (3)局部求解器结合全球模式生成器 大响应区域
(4) driving multiple systems with a single fluidsim (eg. surface + volume + particles) (4) 使用单一流体仿真驱动多个系统(例如:表面 + 体积 + 粒子)
(6) modularity: add others as Component to Ninja / add Ninja as Component to others (6) 模块化:将其他作为组件添加到忍者 / 将忍者作为组件添加到其他组件
(7) niagara 2-way data flow: drive particles using fluidsim / drive fluidsim using particles (7) 尼亚加拉双向数据流:使用流体仿真驱动粒子 / 使用粒子驱动流体仿真
(8) tag based actor tracking (8) 基于标签的演员追踪
1. Direct drive 1. 直接驱动
Ninja could drive volumes, particles, foliage, landscape and water surfaces. Before 1.7, we used manually created intermediate assets to push data to other systems: RenderTargets for sim.buffers, ParamCollections for sim.pos & scale. In 1.7, we provide ninja with (1) a material that is going to be applied to the target system and (2) a tag to find targets At init, Ninja is creating a Dynamic Instance of the provided material, assigning it to targets with all params and buffers directly set. 忍者可以驱动体积、粒子、树叶、景观和水面。在 1.7 之前,我们使用手动创建的中间资产将数据推送到其他系统:用于模拟缓冲区的 RenderTargets,用于模拟位置和缩放的 ParamCollections。在 1.7 中,我们为忍者提供了(1)将应用于目标系统的材质和(2)用于查找目标的标签 。在初始化时,忍者正在创建提供的材质的动态实例,将其直接分配给所有参数和缓冲区设置的目标。
To drive Niagara: we don't even need any material to set params. 驱动尼亚加拉:我们甚至不需要任何材料来设置参数。
See 20.3 and 24.1 in this PDF for Niagara and Volume setups. 请参阅此 PDF 中的 20.3 和 24.1 以获取尼亚加拉和音量设置。
See UE project: levels with "IIVE17" name-tag are updated to direct drive. 查看 UE 项目:带有“IIVE17”标签的关卡已更新为直接驱动。
Note: Materials and NiagaraSystems used in the project are all prepared to handle the incoming ninja data. Open up NinjaLiveComponent Blueprint/MODULEO23 to see the standard param names. Top 3: VelocityDensityBuffer, TraceMeshPos, TraceMeshSize 注意:项目中使用的材料和 Niagara 系统都已准备好处理传入的忍者数据。打开 NinjaLiveComponent 蓝图/MODULEO23 以查看标准参数名称。前三个:VelocityDensityBuffer、TraceMeshPos、TraceMeshSize
2. Improved world-space motion 改进的世界空间运动
see Chapter 28, explaining WorldSpace in general. Live 1.7 improvements: 请参见第 28 章,概述 WorldSpace。Live 1.7 的改进:
(a) Automatic WorldSpaceOffset / no param tweaking needed 自动世界空间偏移/无需参数调整
(b) WS-offset modes: users could choose between Normal, Manual, Quantized The quantizer divides WorldSpace to grid cells - and the local solver moves by "jumping cells" / moves in large discrete steps - instead of "every frame a bit". As a result, the number of texture-buffer interpolation ops is reduced: no data loss / blurring demonstrated on Tutorial Level 32 (b) WS-offset 模式:用户可以选择正常、手动、量化。量化器将世界空间划分为网格单元,局部求解器通过“跳跃单元”/以大离散步长移动,而不是“每帧移动一点”。因此,纹理缓冲区插值操作的数量减少:没有数据丢失/模糊 在教程关卡 32 中演示。
Mode selector: /NinjaLiveComponent /LiveInteraction /TraceMeshMovingInWorldSpace (c) Axis lock: by locking fluidsim area move on a given axis (eg. Z, vertical) we could easily set up surfaces where agents could "jump-off-and-back the sim" - ideal for large horizontal areas like water or sand. 模式选择器:/NinjaLiveComponent /LiveInteraction /TraceMeshMovingInWorldSpace (c) 轴锁定:通过锁定流体模拟区域在给定轴上移动(例如 Z 轴,垂直),我们可以轻松设置代理可以“跳出并返回模拟”的表面 - 适合像水或沙子这样的大型水平区域。
Player-attached sim is generating fluid in a finite area. Sim data is seamlessly added to infinite noise and tile patterns: not obvious where sim area ends / non-sim area begins. Eg. local waves around moving bodies on a sea-surface, wheel-tracks in a desert. 玩家附加的模拟在有限区域内生成流体。模拟数据无缝地添加到无限噪声和瓦片图案中:模拟区域的结束和非模拟区域的开始并不明显。例如,海面上移动物体周围的局部波浪,沙漠中的车辙。
A NEW, GENERIC WORLD-SPACE BASE-MATERIAL IS INTRODUCED 引入了一种新的通用世界空间基础材料
Instances of the Generic WS material are used in ALL new examples (sea, snow, water): see Tutorial Levels 23, 24-C, 30-B, 31-A,B + UseCase Levels 1, 2, 11, 13, 14-A,B,C 通用 WS 材料的实例在所有新示例中使用(海洋、雪、水): 请参见教程第 23、24-C、30-B、31-A、B 级 + 用例第 1、2、11、13、14-A、B、C 级
The tile-generator is implemented in ALL sytems: (a) in the Generic WorldSpace mat and in VolumeFog material it is located under the TileMap Parameter Group. 瓷砖生成器在所有系统中实现:(a) 在通用世界空间材质和体积雾材质中,它位于瓷砖地图参数组下。
(b) In the VolumeSmoke and VolumeClouds mat: under Noise options. 在 VolumeSmoke 和 VolumeClouds 材质中:在噪声选项下。
4. Driving multiple systems with a single fluidsim 4. 用单一流体仿真驱动多个系统
Example: a single, pawn attached sim container is driving (a) water-surface, (b) volumetric vapor over the water and (c) Niagara splash particles 示例:一个单一的、附加的棋子模拟容器正在驱动(a)水面,(b)水面上的体积蒸汽,以及(c)尼亚加拉瀑布的飞溅粒子
Before Live 1.7, ninja had only a single OutputMaterial slot - and this slot was dedicated to TraceMesh: 在 Live 1.7 之前,ninja 只有一个 OutputMaterial 插槽 - 这个插槽专用于 TraceMesh:
Driving other systems happened indirectly, using manually configured on-disk RenderTargets, written by ninja, read by the target system. 驱动其他系统是间接进行的,使用手动配置的磁盘上的 RenderTargets,由 ninja 编写,目标系统读取。
In Live 1.7 tagged systems could be directly driven via DynamicMateriallnstances. The FIRST OutputMaterial slot has been generalized: could be applied to any system. Plus a SECOND slot is added - also generic: 在 Live 1.7 中,标记的系统可以通过 DynamicMaterialInstances 直接驱动。第一个 OutputMaterial 插槽已被通用化:可以应用于任何系统。此外,添加了第二个插槽 - 也是通用的:
Plus, Niagara also became directly accessible via tagging (no material needed) 此外,尼亚加拉也可以通过标签直接访问(无需材料)
Sum: in Live 1.7 three systems could be driven directly + arbitrary number of systems indirectly, using the original "RenderTarget based" method. 总计:在 Live 1.7 中,可以直接驱动三个系统 + 使用原始的“基于 RenderTarget 的”方法间接驱动任意数量的系统。
The two modes could be combined: 这两种模式可以结合起来:
see level: Usecase_015B_SandSimulated_PREVIEW_LIVE17 观看级别:用例_015B_沙子模拟_预览_直播 17
5. Improved Simple Painter Mode 5. 改进的简单画家模式
Track objects and draw trajectories in world-space, 跟踪物体并在世界空间中绘制轨迹,
without running fluidsim (ideal for footsteps, wheel-tracks) 无需运行流体仿真(适用于脚步声、车轮痕迹)
see chapter 6.5: Simple Painter Mode 请参见第 6.5 章:简单绘图模式
see Tutorial Levels 7,32 请参阅教程第 7 和 32 级
6. Modularity 6. 模块化
NinjaLive Actor and NinjaLiveComponent are present since Live 1.0 LiveComponent could be added to any user defined Actor. NinjaLive Actor 和 NinjaLiveComponent 自 Live 1.0 起就已存在,LiveComponent 可以添加到任何用户定义的 Actor。
Utilizing the previously described, tag based Direct Drive (see 29.1), NinjaLive Component could access and drive OTHER COMPONENTS - eg. NiagaraComponent or VolumeCloudComponent. In Live 1.7, a VolumeSmokeComponent is also available 利用之前描述的基于标签的直接驱动(见 29.1),NinjaLive 组件可以访问并驱动其他组件,例如 NiagaraComponent 或 VolumeCloudComponent。在 Live 1.7 中,还提供了 VolumeSmokeComponent。
Target components could be under the same Actor as NinjaLiveComponent. This way, we could use NinjaLive ACTOR as a compact system, containing both LiveComponent and the driven components - eg. VolumeSmokeComponent and NiagaraComponent. We could find this kind of compact setup on new UseCase levels, 目标组件可以与 NinjaLiveComponent 在同一个 Actor 下。这样,我们可以将 NinjaLive ACTOR 作为一个紧凑的系统,包含 LiveComponent 和驱动组件,例如 VolumeSmokeComponent 和 NiagaraComponent。我们可以在新的 UseCase 级别找到这种紧凑的设置。
for example on UC 14-B, by looking up NinjaLive_Area_Water Actor. 例如在 UC 14-B,通过查找 NinjaLive_Area_Water Actor。
7. Niagara two-way data flow 7. 尼亚加拉双向数据流
see Chapter 20 见第 20 章
(A) driving particles using fluidsim (A) 使用流体模拟驱动粒子
Since Live 1.1, particles could be driven by fluidsim. Using the new WorldSpace, DirectDrive and Modularity functions, NiagaraSystems could be easily added to the same Actor where NinjaLiveComponent is hosted, and controlled using automated methods / without RenderTarget intermediates. Usecase 11 demonstrates 5 different ways to create fluid driven particle systems (Stage1: SimplePainter driven particles!) see Tutorial Levels 20 A,B + UseCase Level 11 自 Live 1.1 以来,粒子可以通过流体模拟驱动。使用新的世界空间、直接驱动和模块化功能,Niagara 系统可以轻松添加到托管 NinjaLiveComponent 的同一 Actor 中,并通过自动化方法进行控制/无需 RenderTarget 中介。用例 11 演示了 5 种不同的创建流体驱动粒子系统的方法(阶段 1:简单画家驱动的粒子!) 请参见教程关卡 20 A、B + 用例关卡 11
(B) driving fluidsim using particles (B) 使用粒子驱动流体仿真
Live 1.7 has been released with UseCase 12 included: using the Niagara Modules of recently joined ninjadev Greg Resler aka Kynolin, we could capture particle data inside Niagara, and feed ninja with this. Particle dynamics is IDEAL to drive fluidsim! see Tutorial Level UseCase Levels 12 A,B,C Live 1.7 已发布,包含用例 12:使用最近加入的 ninjadev Greg Resler(又名 Kynolin)的 Niagara 模块,我们可以在 Niagara 中捕获粒子数据,并将其提供给 ninja。粒子动力学非常适合驱动流体模拟! 请参见教程级别 用例级别 12 A、B、C
8. Tag based actor and component tracking 8. 基于标签的演员和组件跟踪
NinjaLive could use object and bone position as simulation input. Tracked objects could be defined by (A) object type filters and (B) tags. NinjaLive 可以使用物体和骨骼位置作为模拟输入。被跟踪的物体可以通过(A)物体类型过滤器和(B)标签来定义。
Tagging has been added to Live 1.7 - and it has been improved since then. The latest features have been added to Live 1.9. For complete tag-guide, see Manual Chapter 32.3 标签功能已添加到 Live 1.7,并且自那时起得到了改进。最新功能已添加到 Live 1.9。有关完整的标签指南,请参见手册第 32.3 章。
The feature is located at NinjaLive Actor Details Panel: 该功能位于 NinjaLive 演员详情面板:
NinjaLive Actor /LiveInteraction /TrackActorPrimitiveComponentsWithTag /TrackActorSkeletalMeshComponentsWithTag 忍者直播 演员 /实时互动 /使用标签跟踪演员原始组件 /使用标签跟踪演员骨骼网格组件
30. New features: Live 1.8 30. 新功能:实时 1.8
Tutorial video covering THIS chapter: LINK + Generic all-in-one Tutorial: LINK 教程视频涵盖本章内容:链接 + 通用一体化教程:链接
New levels: /UseCases/Levels/Usecase_017_RiversAndLandscapes_LIVE18 /UseCases/LevelsSpecial/Usecase_015D_Snow_MultiLayerMaterial_LIVE18 新级别:/UseCases/Levels/Usecase_017_RiversAndLandscapes_LIVE18 /UseCases/LevelsSpecial/Usecase_015D_Snow_MultiLayerMaterial_LIVE18
New features: 新功能:
(1) SplineMesh based rivers 基于样条网格的河流
(2) Driving Landscape Components (2) 驱动景观组件
(3) Underwater & Caustics (3) 水下与光晕
1. SplineMesh based rivers 基于样条网格的河流
(a) SplineMesh generator blueprint is added: clones a user-defined mesh along a user-defined spline ----> made to create geometry for rivers. (a)添加了 SplineMesh 生成器蓝图:沿用户定义的样条线克隆用户定义的网格 ----> 用于创建河流的几何形状。
(b) Ninja accesses SplineMeshes via DirectDrive (see Chapter 29.1) & OutputMaterials. The most important OutputMaterial used to generate water surfaces, has been updated to properly handle splines. UAsset: M_NinjaOutput_WorldSpaceGeneric (b) Ninja 通过 DirectDrive(见第 29.1 章)和 OutputMaterials 访问 SplineMeshes。用于生成水面最重要的 OutputMaterial 已更新,以正确处理样条。UAsset: M_NinjaOutput_WorldSpaceGeneric
ALL pattern generators in the material could be switched between two modes: Local UV space -vs- World UV space. 材料中的所有图案生成器可以在两种模式之间切换:局部 UV 空间 - 与 - 世界 UV 空间。
While local Mesh-UV is sensitive to mesh scaling and distorted at sharp bends, it enables us to offset textures along the spline, which is perfect: patterns follow the river-curvature. The non-interactive patterns (flowmap, caustics, tile) are using LOCAL UV - while the responsive simulation visuals are using WORLD UV ("sim is worldspace"). For more info, see: UseCase-17 Level /Stage-0 /Substage-2,3,4 虽然局部网格 UV 对网格缩放敏感并在急弯处失真,但它使我们能够沿样条线偏移纹理,这非常完美:图案跟随河流的曲率。非交互式图案(流图、光晕、瓷砖)使用局部 UV,而响应式模拟视觉效果使用世界 UV(“模拟是世界空间”)。有关更多信息,请参见:UseCase-17 级别/阶段-0 /子阶段-2,3,4
2. Landscape Components 2. 景观组成部分
New utility blueprint added to connect ninja with landscape components. Blueprint asset: /UseCases/017 RiverAndLandscape/BP NinjaLiveLandscapeUtility For detailed usage instructions: open blueprint, see comments! 新增实用程序蓝图以连接忍者与景观组件。蓝图资产:/UseCases/017 RiverAndLandscape/BP NinjaLiveLandscapeUtility 有关详细使用说明:打开蓝图,查看注释!
(a) Fact: NinjaLive DirectDrive (see Chapter 29.1) is generating Dynamic Material Instances on the ninja side and applying these to external systems in RUNTIME. The advantage of this method is: all external systems are automatically receiving sim buffer / sim param updates during play. 事实:NinjaLive DirectDrive(见第 29.1 章)在忍者端生成动态材质实例,并在运行时将其应用于外部系统。此方法的优点是:所有外部系统在播放期间自动接收模拟缓冲区/模拟参数更新。
(b) Problem: landscapes can not be assigned with materials in runtime. Consequently DirectDrive can not access Landscapes (b) 问题:地形在运行时无法分配材质。因此,DirectDrive 无法访问地形。
(c) Solution: the landscape utility is made to get sim params from a given ninja (c) 解决方案:该景观工具旨在从给定的忍者获取模拟参数
SOURCE actor - and feed the params to the material applied on the TARGET landscape. 源演员 - 并将参数传递给应用于目标景观的材质。
Caustics generators have been added / updated in two base materials: 已在两种基础材料中添加/更新了腐蚀生成器:
(a) M_NinjaOutput_WorldSpaceGeneric /SingleLayerWaterOps param group (a) M_NinjaOutput_WorldSpaceGeneric /单层水操作参数组
(b) M UnderWaterPostProcess/Caustics param group (b) M UnderWaterPostProcess/折射参数组
BaseMaterial-A is responsible for caustics on underwater objects (eg. riverbed), as seen from ABOVE the water. BaseMat-A is surface domain. BaseMaterial-A 负责水下物体(例如河床)的光晕效果,从水面上方观察。BaseMat-A 是表面域。
BaseMaterial-B is responsible for caustics on underwater objects as seen from UNDER the water., BaseMat-B is postprocess domain. BaseMaterial-B 负责水下物体的光晕效果,正如从水下看到的那样。BaseMat-B 是后处理领域。
4. Caustics: Notes for UE5 4. 烧蚀:UE5 的笔记
While the underwater caustics is working fine under UE4 ---> UE5 is glitchy: 在 UE4 中,水下光晕工作正常 ---> UE5 存在故障:
The caustics pattern is being offset (slides over the objects), as the camera moves/rotates The problem is caused by the UE5 AbsoluteWorldPosition node, which gives back incorrect values in PostProcess Materials. This is an Unreal Engine bug -- described here ( URL1; URL2 ) 光照模式正在偏移(在物体上滑动),随着相机的移动/旋转。这个问题是由 UE5 的 AbsoluteWorldPosition 节点引起的,该节点在后期处理材质中返回不正确的值。这是一个虚幻引擎的 bug -- 在这里描述(URL1;URL2)
FIX: we are SPLITTING the single PostProcess material in to a duo of PRE-Tonemapper and POST-Tonemapper PostProcess Materials: 修复:我们将单一的后处理材质拆分为一对预调色器和后调色器后处理材质
Post Process Materials 后处理材料
จ Arrai
2 Array elements 2 数组元素
1.0
1.0
M_UnderWaterPostProcess_Caustics_LargeWater1_PreToneMap M_水下后处理_光晕_大水 1_预色调映射
MI_UnderWaterPostProcess_Caustics_LargeWater2_PostToneMap MI_水下后处理_光晕_大水 2_后调色映射
The Pre-Tonemap Mat. contains the Caustics (here, the WorldPos node works as expected) The Post-Tonemap Mat. contains all other functionalities (gradients, coloring, distortion)
FIX is released as a new ninja subversion: Live v 1.8.5.1 (on 28 Oct. 2022)
UPDATE (27 November 2022)
New Nvidia drivers (v. 517 and above) seem to FIX the AbsoluteWorldPosition issue
\section*{31. New features: Live 1.8.5.5}
Tutorial video covering THIS chapter: LINK + Generic all-in-one Tutorial: LINK
New levels: /UseCases/Levels/Usecase_018A_Snow_LIVE18 /UseCases/Levels/Usecase_018B_Sand_LIVE18
/UseCases/Levels/Usecase_015C SimplePainterDemo LIVE18
/UseCases/Levels/Usecase_004A_DoubleSim_TilingWaves_LIVE18
/UseCases/Levels/Usecase_004B_DoubleSim_Vortex_LIVE18
Updated levels: Usecase 1, 2, 7, 10, 11, 12, 14-ABC, 17
New features:
(1) One-sim-driven environment
(2) Surface alignment
(3) Optimize for UE5 \& reworking obsolete content
\section*{1. One-sim-driven environment}
Ninja uses Output Materials to DIRECTLY drive other systems ( see 29.1 + LINK). Originally, ninja had TWO Output Material slots (primary, secondary) + an output for Niagara Systems. Since a landscape material setup consumes two slots (see: LINK), volumes were handled with the INDIRECT method (manual setup, writing an extra on-disk rendertarget with ninja, and reading that with the volume)
By adding a \(3^{\text {rd }}\) output material slot: we can direct-drive landscape, particles and volumes with a single simulation - driving complex environments (see LINK). See: sand \& snow demo levels (UC18-A,B)
\section*{2. Surface alignment}
The new FloorSnapper utility dynamically modifies the transform of user provided objects - aligning object rotation with floor normal direction and matching object position with the floor surface. A typical use case: aligning pawn-attached, moving volume containers with a non-flat / sloped landscape, while the player moves. See this video: LINK.
Older levels have been reworked (eg. UC 14-A,B,C) - to utilize FloorSnapper, instead of the monstrous spaghetty of nodes in the Level Blueprint:
UPDATE: CHECK CHAPTER 24 / LANDSCAPE ALIGNED VOLUMES
\section*{3. Optimize for UE5 \& reworking obsolete content}
Unreal 5 adjusts level main-light intensity and color according to sun position. All ninja materials have been equipped with AtmosphericLight type nodes, making them sensitive to the color/luma changes. In sync with the material update, all levels have been reworked in terms of lighting and atmosphere to meet the new UE standard. Niagara systems are also updated, eliminating deprecated modules.
Usecase 4 \& 6 levels (double-sim, vortex) have been resurrected. See video LINK. Originally, ninja contained multiple, experimental base materials to cover different scenarios. Through the dev process, these experimental materials became obsolete. By re-implementing functions in the SINGLE unified world space base material, we are (again) capable to merge multiple simulation outputs - like a local interaction handler and a vortex: video LINK.
\section*{32. New features:}
Live 1.9.51
Tutorial video covering THIS chapter: LINK + Generic all-in-one Tutorial: LINK
New levels: /Tutorial/Levels/NinjaLive_Level33_Tagging_LIVE19 /Tutorial/Levels/NinjaLive_Leve134A_Painter_v2_Primitives_LIVE19
/Tutorial/Levels/NinjaLive_Level34B_Painter_v2_Bones_LIVE19
Updated levels: Tutorial 2 A + UseCase 14, 16, 17
New features
1) Fast object tracking: Painter v2
2) Multilayer materials
(3) Tagging (to filter tracked objects)
\section*{1. Fast object tracking: Painter v2}
Ninja is registering tracked objects using a Collision Painter - drawing a dot (or line) for each object. In Live 1.9, the painter has been updated to a more performant "v2", capable of handling hundreds of primitives \& bones as simulation input, also compatible with Metahuman skeletons.
Painter v2 also replaces "SingleTargetMode": connecting the registered dots with lines for ALL tracked objects - creating smooth, continuous motion trajectories.
The features are located at NinjaLive Component Details Panel
\(\rightarrow \quad\) NinjaLive Component /LiveInteraction /UsePAINTER_V2_ToTrackObjects
/PV2_Connect_TrackpointsWithLines
\section*{2. Multilayer materials}
Ninja is using a main "base" Output Material (M_NinjaOutput_WorldSpaceGeneric) for all Materiallnstances \(\rightarrow\) when driving large world-space surfaces - like lakes, sand dunes and snowy landscapes.
In Live 1.9, the main Output Material is available as MaterialFunction, to build true multilayer materials for landscapes. We have also included an example-material that blends the function with another basic material.
The assets could be found using Content Browser:
\(\rightarrow\) /OutputMaterials/BaseMaterials/MF_NinjaOutput_WorldSpaceGeneric /OutputMaterials/BaseMaterials/M_NinjaOutput_WorldSpaceGeneric_Multilayer
3. Tagging (to filter tracked objects)
"Tagging" is a generic method to access objects in Unreal. We assign strings to Actors or Components using the "Tag" input field at the Details Panel. Blueprints could access these objects using the tags
Ninja uses tagging in these cases:
- Live Actor uses tags to FILTER TRACKED OBJECTS (see next page + LINK
- Live Component uses tags to ASSIGN MATERIALS to objects (DirectDrive) - LINK
- Landscape and FloorSnapper Utility Actors identify targets via tags - LINK1, LINK2
NinjaLive could use object and bone position as simulation input.
In this subchapter we are discussing (A) object type filters (class filters) and (B) tags as methods to define tracked objects (LINK)
(Note: Tagging has been added to Live 1.7 - and it has been improved since then)
NinjaLive COMPONENT - when added to NON-ninja actors (eg. a Pawn) - is LIMITED to track components of the OWNER. No tagging, only class filters ( \(\rightarrow\) see Chapter 6.1)
NinjaLive ACTOR could track arbitrary objects - using the InteractionVolume to detect objects in the simulation area. We could tell NinjaLive Actor what kind of objects to track - using TWO methods:
\section*{A. CLASS FILTERS / OBJECT TYPE FILTERS}
We are telling ninja to track certain Object Types: StaticMesh, PhysicsBody... etc
On the "ninja side" the object type filter could be adjusted under:
\(\rightarrow\) NinjaLive Actor Details /LiveInteraction /OverlapFilterInclusiveObjectType
On the "target side" (the objects to be tracked) this could be adjusted under:
\(\rightarrow\) /Component Details /Collision /CollisionPresets /ObjectType
B. TAGGING
We are telling ninja to track tagged Primitive or SkeletalMesh Components
On the "ninja side" the tag filters could be adjusted under:
\(\rightarrow\) NinjaLive Actor/LiveInteraction/TrackActorPrimitiveComponentsWithTag /TrackActorSkeletalMeshComponentsWithTag
On the "target side" (the objects to be tracked) tags could be added at:
\(\rightarrow\) Component Details Panel /"Tag" input field
\section*{IMPORTANT}
Class Filters and Tags are ADDITIVE. When used together, the results from BOTH filtering are added to the same list. For example: we are tracking ALL StaticMesh type objects using a class filter and ONE specific Pawn, via "SkeletalMesh" tagging.
\section*{33. New features:}
Live 1.9.53
(1) Volumetrics v2
(2) Floor alignment v2
(3) LWC support (Large World Coordinates)
\section*{1. Volumetrics v2 (see updated Chapter 24}
Unreal Engine 5.3 came with a new volume type: Heterogeneous Volume Accordingly, ninja has been updated with a new generic volume function, Handling ALL native UE volume types: fog, clouds - and heterogeneous volumes.
The update comes with...
- wrapper materials for the new volume function
- minimal setups, showcasing volume function properties
- fluidsim driven and passive setups (passive = non-interactive)
Setups are demonstrating usage in the 1 meter to 100 kilometers size range, combining various volume types and exploring multilayer volumes.
Complete Volumetrics V2 Documentation: LINK
New Content \& Levels:
Showreel Videos:
/Content/FluidNinjaLive/Volumetrics_v2 LINK1, LINK2
\section*{2. Surface alignment v2}
The update also employs a new technique to align volumes with surfaces.
We are sampling landscape height using RVT volumes and forwarding the height data to the volume material. The technique could potentially replace "floor snapper",
a previously introduced surface-aligning technique (See Chapter 31.2).
Related tutorial, Landscape aligned volumes: LINK
\section*{3. LWC support (1.9.53.3}
LWC (Large World Coordinates) is an Unreal Engine method that allows users to extend scenes beyond the original (UE4) 10 kilometers radius. Using LWC, ninja could drive surfaces, particle systems and volumes thousands of kilometers from the world origin
UE uses double precision (64 bit) data types (floats, vectors) in large worlds. Starting with version 1.9.53.3, ninja also supports LWC, by introducing the
"TraceMeshPosDouble" variable through all systems: blueprints, materials and niagara.
Updated systems are by default LWC compatible. The new feature could be turned off, see "LWC Support" param (TRUE/FALSE) in NinjaLiveComponent Blueprint and in al Output Material Instances.
33. Unreal 5.4 specific fixes: Live 1.9.54
Unreal Engine 5.4 came with breaking changes. In order to counter these, a new NinjaLive version is being released: 1.9.54.4 - dedicatedly for UE 5.4
Change log, text file: LINK