From 845365ee277d864b960abfc43de3f664bfdfb180 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Sat, 18 Jun 2022 10:19:16 +0900 Subject: [PATCH] docs: update readme --- README.md | 74 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index bf109e0..b9c7217 100644 --- a/README.md +++ b/README.md @@ -53,24 +53,29 @@ Compares this "Baking mesh" approach with the conventional approach: * Support overlay, camera space and world space * Support changing material property with AnimationClip (AnimatableProperty) ![](https://user-images.githubusercontent.com/12690315/53286323-2d94a980-37b0-11e9-8afb-c4a207805ff2.gif) - +* [4.0.0+] Support 8+ materials +* [4.0.0+] Correct world space particle position when changing window size for standalone platforms (Windows, MacOSX and Linux) +* [4.0.0+] Adaptive scaling for UI +* [4.0.0+] Mesh sharing group to improve performance +![](https://user-images.githubusercontent.com/12690315/174311048-c882df81-6c34-4eba-b0aa-5645457692f1.gif) +* [4.0.0+] particle attractor component +![](https://user-images.githubusercontent.com/12690315/174311027-462929a4-13f0-4ec4-86ea-9c832f2eecf1.gif)



## Demo -* [WebGL Demo](https://mob-sakai.github.io/Demos/ParticleEffectForUGUI) +* [WebGL Demo](https://mob-sakai.github.io/demos/UIParticle_Demo/index.html) +> ![](https://user-images.githubusercontent.com/12690315/174311768-1843a5f2-f776-491b-aaa8-2a131a8b6a16.gif) * [WebGL Demo (Cartoon FX & War FX)](https://mob-sakai.github.io/Demos/ParticleEffectForUGUI_CFX) * [Cartoon FX Free][CFX] & [War FX][WFX] (by [Jean Moreno (JMO)][JMO]) with UIParticle +> ![](https://user-images.githubusercontent.com/12690315/91664766-3e07ac00-eb2c-11ea-978b-ef723be80619.gif) [CFX]: https://assetstore.unity.com/packages/vfx/particles/cartoon-fx-free-109565 [WFX]: https://assetstore.unity.com/packages/vfx/particles/war-fx-5669 [JMO]: https://assetstore.unity.com/publishers/1669 -![](https://user-images.githubusercontent.com/12690315/91664766-3e07ac00-eb2c-11ea-978b-ef723be80619.gif) - -



@@ -99,7 +104,7 @@ Find the manifest.json file in the Packages folder of your project and add a lin To update the package, change suffix `#{version}` to the target version. -* `"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git#3.3.0",` +* `"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.0.0",` Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension) to install and update the package. @@ -147,7 +152,7 @@ Unity 2018.2 supports embedded packages. `UIParticle` controls the ParticleSystems that is attached to its own game objects and child game objects. -![](https://user-images.githubusercontent.com/12690315/99765566-af129a80-2b42-11eb-88f6-661182d0b619.png) +![](https://user-images.githubusercontent.com/12690315/174413976-691eb38e-7f92-4fbe-9790-8771b9dc70b2.png) | Properties | Description | | -- | -- | @@ -155,7 +160,7 @@ Unity 2018.2 supports embedded packages. | Ignore Canvas Scale | Ignore the scale of the root canvas.
This prevents it from displaying small even in hierarchy scaling mode of `ParticleSystem`. | | Scale | Scale the rendering.
When the `3D` toggle is enabled, 3D scale (x,y,z) is supported. | | Animatable Properties | If you want update material properties (e.g. `_MainTex_ST`, `_Color`) in AnimationClip, use this to mark the changes. | -| Shrink By Material | Shrink rendering by material.
Performance will be improved, but in some cases the rendering is not correct. | +| Mesh Sharing | Particle simulation results are shared within the same group.
A large number of the same effects can be displayed with a small load.
When the `Random` toggle is enabled, it will be grouped randomaly. | | Rendering Order | The ParticleSystems to be rendered.
You can change the rendering order and the materials. | NOTE: Press `Refresh` button to reconstruct rendering order based on children ParticleSystem's sorting order and z position. @@ -171,7 +176,7 @@ NOTE: Press `Refresh` button to reconstruct rendering order based on children Pa

-### With your ParticleSystem prefab +### With your existing ParticleSystem prefab 1. Select `Game Object/UI/ParticleSystem (Empty)` to create UIParticle. ![empty](https://user-images.githubusercontent.com/12690315/95007362-cb697f00-0649-11eb-8a09-29b0a13791e4.png) @@ -196,30 +201,57 @@ If you want to mask particles, set a stencil supported shader (such as `UI/UIAdd var go = GameObject.Instantiate(prefab); var uiParticle = go.AddComponent(); -// Play/Stop the controled ParticleSystems. +// Control by ParticleSystem. +particleSystem.Play(); +particleSystem.Emit(10); + +// Control by UIParticle. uiParticle.Play(); uiParticle.Stop(); ``` +

+ +### UIParticleAttractor component + +`UIParticleAttractor` attracts particles generated by the specified ParticleSystem. + +![](https://user-images.githubusercontent.com/12690315/174413982-b31c358a-8e1d-4b3e-a6d8-18b050b25d6f.png) +![](https://user-images.githubusercontent.com/12690315/174311027-462929a4-13f0-4ec4-86ea-9c832f2eecf1.gif) + +| Properties | Description | +| -- | -- | +| Particle System | Attracts particles generated by the specified particle system. | +| Distination Radius | Once the particle is within the radius, the particle lifetime will become 0 and `OnAttracted` will be called. | +| Delay Rate | Delay to start attracting.
It is a percentage of the particle's start lifetime. | +| Max Speed | Maximum speed of attracting.
If this value is too small, attracting may not be completed by the end of the lifetime and `OnAttracted` may not be called. | +| Movement | Attracting movement type. (Linear, Smooth, Sphere) | +| OnAttracted | An event called when attracting is complete (per particle). | +



## Development Note -### Animatable material property +### Shader Limitation -![](https://user-images.githubusercontent.com/12690315/53286323-2d94a980-37b0-11e9-8afb-c4a207805ff2.gif) +UIParticles are based on UIVertex. +Therefore, only xy components is available for each UV in the shader. (zw components will be ignored). +So unfortunately UIParticles will not work well with some shaders. +When using custom vertex streams, you can fill zw components with "unnecessary" data. +https://github.com/mob-sakai/ParticleEffectForUGUI/issues/191 -Animation clips can change the material properties of the Renderer, such as ParticleSystemRenderer. -It uses MaterialPropertyBlock so it does not create new material instances. -Using material properties, you can change UV animation, scale and color etc. +- If you need a simple Additive shader, use the `UI/Additive` shader instead. +- If you need a simple alpha-blend shader, use the `UI/Default` shader instead. -Well, there is a component called CanvasRenderer. -It is used by all Graphic components for UI (Text, Image, Raw Image, etc.) including UIParticle. -However, It is **NOT** a Renderer. -Therefore, in UIParticle, changing ParticleSystemRenderer's MaterialPropertyBlock by animation clip is ignored. +### Overheads -To prevent this, Use "Animatable Material Property". -"Animatable Material Property" gets the necessary properties from ParticleSystemRenderer's MaterialPropertyBlock and sets them to the CanvasRenderer's material. +UIParticle has some overheads and the batching depends on uGUI. +When improving performance, keep the following in mind: +- If you are displaying a large number of the same effect, consider `Mesh Sharing` feature in [UIParticle Component](#uiparticle-component). + - If you don't like the uniform output, consider `Random Group` feature. +![](https://user-images.githubusercontent.com/12690315/174311048-c882df81-6c34-4eba-b0aa-5645457692f1.gif) +- If you are using multiple materials, you will have more draw calls. + - Consider single material, atlasing the sprites, and using `Sprite` mode in the `Texture Sheet Animation` module in ParticleSystem.