Raywenderlich: 用 VFX 制作蝴蝶飞起的效果 |
您所在的位置:网站首页 › 3d蝴蝶飞舞路径动画 › Raywenderlich: 用 VFX 制作蝴蝶飞起的效果 |
文章目录
unity版本将要学习到知识下载创建项目创建目录导入精灵观察蝴蝶自带的 Bufferflies 资源打开 Butterflies VFX Graph复杂的动画的组成拷贝 ButterFlies粒子的设置Update Particle BlockOutput Particle Block创建 Scene调整摄像机设置设置 Sky and Fog Volume场景的灯光设置VFX 物体修改蝴蝶的翅膀设置 Output BlockUpdate Block设置 Initialize Block
设置 Output Block设置 Visual Effect Properties脚本控制创建控制脚本
编辑 HeartOfHearts自定义形状
unity版本
Unity 2020.3 (LTS) 将要学习到知识 创建 VFX 效果。设计背景视觉效果。按需生成背景视觉效果。在运行时,修改背景视觉效果的属性。编写和使用点缓存。原料 创建项目![]() ![]() ![]() ![]() Assets/Art/Textures/VFX/ButterFlies_8x1 , 这是系统自带的蝴蝶的翅膀资源。 ![]() 只要制作蝴蝶的一只翅膀的动画,其他的就用 copy-paste 吧。 ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((我)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((看)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((起)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((来))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((是)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((不)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((是)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((很)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((复)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((杂)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) 拷贝 ButterFlies 拷贝(window 命令:ctrl + d , mac 命令:Command + D) Assets/Art/Particles/ButterFlies , 重名名为 ButterFlieNotes, 移动到 RW/VFX 目录。 粒子的设置双击 ButterFlieNotes , 观察下面: 要拖动,可以全选,然后用鼠标拖动。 在 Initialize Particle Block 中 Capacity : 控制粒子的容量。Tex Index: 控制蝴蝶的风格。… Update Particle Block ForceTurbulenceVelocityScalePivot.X Output Particle Block UV Mode 、Flipbook 、 Flip Book Size 、 Base Color Map.OrientationPositionAngle.Y 、 Angle.X 创建 Scene File - New Scene , 命名为 MakingHeartsFly,保存到 RW/Scenes。![]() ![]() 选择摄像机: Position:X = 0,Y = 1, Z = -6.5。Rotation:X = -30,Y = 0,Z = 0。Background Type : Color。Background Color: R = 200,G = 50,A = 255, Intensity = 0。![]() 选择 Sky and Fog Volume,在 Volume 组件中: 在 Visual Environment ,设置 Type 为 None、 Ambient Mode 为 Static。在 Exposure 中,设置 Mode 为 Fixed、Fixed Exposure = -1。移除 Fog。在 Vignette 中,设置 Mode 为 Procedural ,Intensite = 0.4。![]() ![]() 打开 VFX ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 反选 Wing Color 前面的打勾,会使当前颜色的设置失效。 设置颜色的时候,点击矩形下面的底加箭头, Location 旁边才会是显示 Color; 点击上面, Location 旁白显示的 Alpha。 勾选两次下面的眼睛,使当前设置的 Visual Effect 生效:![]() ![]() ![]() 在 RW / Scripts 新建脚本 HeartManager.cs ,挂载到 HeartOfHearts 上。 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.VFX; public class HeartOfHearts : MonoBehaviour { private VisualEffect _visualEffect; private VFXEventAttribute _eventAttribute; private bool _heartsAreFlying; private int _flyingBoolID; private void Awake() { _visualEffect = GetComponent(); _eventAttribute = _visualEffect.CreateVFXEventAttribute(); _flyingBoolID = Shader.PropertyToID("Flying"); _heartsAreFlying = false; _visualEffect.SetBool(_flyingBoolID, false); _visualEffect.Stop(); } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { SpawnHearts(); } if (Input.GetKeyDown(KeyCode.F)) { ToggleHeartFlight(); } } private void SpawnHearts() { _visualEffect.Play(); } private void ToggleHeartFlight() { _heartsAreFlying = !_heartsAreFlying; _visualEffect.SetBool(_flyingBoolID, _heartsAreFlying); } } 编辑 HeartOfHearts打开 HeartOfHearts 的 Asset Template: 在 Initialize Particle Block ,设置 Capacity 为 10000。增加 Set Lifetime Random Block , 设置 A=3, B=10。在 Output Particle Lit Quad ,新增 Set Alpha over Life,根据自己的需要设置曲线。修改 Wing Animation Speed 的连接:![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 回到游戏运行, 按空格键: [1] Making Hearts Fly With Unity VFX Graph |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |