-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ParticleSystem #415
ParticleSystem #415
Conversation
If you are ready to merge, please resolve conflicts and add some introduction to what particle system in this PR looks like because it is not a small feature which you can learn about it in 5 mins.
|
add Catmull-Rom Spline Util
You can also show some examples in this PR : |
////const cd::VertexFormat *requriredVertexFormat = emitter.GetVertexFormat(); | ||
////particleEmitterComponent.SetRequiredVertexFormat(requriredVertexFormat); | ||
////particleEmitterComponent.GetParticleSystem().Init(); | ||
if (nameof::nameof_enum(emitter.GetType()) == "Sprite") { particleEmitterComponent.SetEmitterParticleType(engine::ParticleType::Sprite); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use cd::ParticleType is better because they are all same:
particleEmitterComponent.SetEmitterParticleType(emitter.GetType());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's not.
cd::ParticleEmitterTypeTraits::Type not suit engine::particleType
Use MeshUtils.hpp functions to replace duplicated vertex/index buffer build logics. |
Workflow
If you want to use the particle system directly, including importing resources, you can add a particle emitter or a particle force field by clicking on the + in the EnitityList on the left.
Through the right side of the inspector panel to adjust the corresponding parameters, but at present our particleType only Sprite can be used, as well as the instance State at present because the uber shader has not yet been perfected the effect is not correct, these two points please note that!
Currently there is only one rotational force used in the force field, after checking the RotationForceValue box, a centripetal force will be generated inside the blue box.
If you need to import, please produce a .efkefc file (this file is generated by EffekSeer export) and export it to .cdbin file in AssetPipline, then directly drag it to the engine scene, we will access EffekSeer to make the process of importing less cumbersome!
These are two files you can check out https://github.com/CatDogEngine/TestAssets/tree/main/Particle
You can see the introduction of these two documents in
To generate a cdbin file first you need to compile the EffekSeer related .exe .dll in AssetPipline (please add the EffekSeer SDK to your OS environment variables, then use MakeThirdParty.bat to build AssetPipline).
Fill in the EffkseerToCD command parameters with the directory you want to output to and the filename.(the first parameter is empty fill in some random but can not not fill, the second parameter that is the output of the directory and file name)
In the Main.cpp file of EffkseerToCD you need to fill in the .efkefc file address
This will give you access to the generated .cdbin
Currently .cdbin import only supports properties that can be adjusted inside the engine, you can create a new particle emitter component to see which properties can be imported into the engine.
Functions completed so far and their drawbacks
Basic state update of particles (Particle.h/cpp, ParticleRenderer.h/cpp )
Particle pool maintenance (ParticlePool.h/cpp)
GPU particles (vs/fs_particle.sc)
Instantiating particles (ParticleRenderer.h/cpp, vs/fs_particle.sc)
ECS component for particles (ParticleComponent.h/.cpp)
Billboard View particles (ParticleRenderer.h/cpp, vs/fs_wo_billboardparticle.sc)
Particle shader variants (ParticleComponent.h/cpp, vs/fs_particle.sc)
Particle Force Field(ParticleForceField.h/cpp)
So far our particle base is relatively perfect, I mean the maintenance of particle pool and ECS management, but there are some features are not yet perfect, such as shader variants now do not support .vs caused by some of the functionality of the anomalies, we will follow up to fix these.
Secondly, there are some features that we will do in the future, for example, the current particle type only supports mesh but not Ribbon Track and model in the list, we will support these features in the future, the shape of the particle emitter is only a box at the moment, we will add hemisphere, sphere and so on after that, there is no depth sort at the moment, which causes the particles to block each other, we will add bipartite sort or subsumption sort in the future. Translucent and opaque rendering, particle self-illumination, multi-threading .... etc. etc.
There are still a lot of things that need to be done
Some Example
EffkSeer
OurEngine
Some performance
In the case of using instantiation the maximum number of particles that can be supported in the current engine is around 20,000 (maintained at 60fps VGA: 6600X).