godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Particle improvements and Scenes as Particles #626

Closed 2plus2makes5 closed 2 years ago

2plus2makes5 commented 4 years ago

Describe the project you are working on: 2.5d beat'em up

Describe the problem or limitation you are having in your project: the particle system is really confusing and limited

Describe the feature / enhancement and how it helps to overcome the problem or limitation: I have already said this in a (very messy lol) comment here: https://github.com/godotengine/godot-proposals/issues/516 but i post here too just to be sure, feel free to close if redundant.

My idea is to have simple and complex particles, or to be more precise improve particle node and material and add the ability to use scenes as particles.

Actually there are the particle node and the particle material and both are really confusing and limited, in my opinion in order to make things simple and clear we should clearly define the roles of each entity.

The particle node should be a simple emitter(even better if renamed particle emitter), think of a gun or cannon, it simply shoots things in a direction without really caring about the bullet, and then there's the particle itself with all the info about its lifetime, movement, look and so on. Instead of making the current particles more complex i would suggest to keep them limited and introducing a new kind of particle, a scene particle, a particle that's literally a scene, it would be heavy obviously, but think about the flexibility and all the mindblowing things it could do, and it would be better to have the choice of a limited but performant particle material or a heavy but flexible scene particle instead of just making the particle material more complex and heavy.

Here some ideas to make the particle node and material better:

1)the particle node/emitter should be simplified, it shoud only have infos about where and when shooting particles, here the parameters: -emitting true/false -min and max number of particles emitted at the same time -min and max time between an emission and the other, 0 and 0 would mean constant emission -number of emissions, 0 would mean unlimited -minimum and maximum y and z shooting angles, min=(0,0) and max=(0,0) would shoot straight like a gun, min=(-20,-20) and max=(20,20) would act like a shotgun, while min=(0,0) and max=(359,359) would mean shoot all around like an explosion -minimum and maximum emission distance from the emission center

2)the particle material should be simplified too, since the particle node/emitter takes care of the initial direction that info is no more necessary. About its movement, think of a cartesian grid, the particle emitter without rotation and with a shooting angle of (0,0) shots the particle in the +x direction, we could use curves to determine how it moves along the local y and z axis during its lifetime. If you want particles all around the emitter you just make the particle emitter rotate and give the particle a very curved y and z curves. Here's what particle material should have: -min and max lifetime -mesh -color ramp(but maybe it would be better to let the mesh material handle the color?) -min and max acceleration and speed(along the local "x axis" trajectory) -y and z curves to determine how the particle moves along the local "x axis" trajectory -min and max initial value, acceleration and speed for rotation and scale(for the look only, they don't affect the movement)

3)in addition to shader and particle materials give us the ability to use scenes as particles, this way we could have all the collision, light and complex behaviour that we want(we could make particles that create other particles like fireworks, or particles that follow the player, others that have complex movements or why not spawning enemies, bonues etc), at the cost of efficiency, in addition to the limited but more efficient particles we already have.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: In the editor it needs to change the particle node and material settings and add the option to use scenes as particles in addition to shader and particle material.

If this enhancement will not be used often, can it be worked around with a few lines of script?: The scene emitter could be easily made by code, but the improvements at the current particle node and material would be harder i think.

Is there a reason why this should be core and not an add-on in the asset library?: Well the particle system is a core feature so it should remain core.

Calinou commented 2 years ago

Closing, as the particle system has been rewritten in the master branch. For performance reasons, it's not possible to use actual instanced scenes as particles – it'd require way too much memory and CPU housekeeping for the engine to do, on top of not being doable on the GPU. The new particle system still supports attractors, collision and manual emission, making it much more powerful than the one in 3.x.

I recommend looking at other particle proposals before opening another proposal, as the other suggestions have already been made in other proposals.