godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add an option to randomly flip particle UVs #10338

Open HappyHeads opened 3 months ago

HappyHeads commented 3 months ago

Describe the project you are working on

3D game.

Describe the problem or limitation you are having in your project

I am making an explosion particle effect with GPUParticles3D node and having problems where the effect looks repetitive because it spawns multiple flipbook animations with the same texture.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

An option that randomly mirror particles horizontal or vertical UV orientation. it will help with quickly breaking up repetition with billboarded sprites that spawn next to each other.

In the example below I showcase a kind of "worst case scenario" where this feature would be useful.

https://github.com/user-attachments/assets/0efec4b8-2382-4ff3-8ade-780b92f017b3

Here I emulate the proposed feature by using two GPUParticle3Ds with one of them using a flipped animation.

https://github.com/user-attachments/assets/e4fa22b0-fda7-44ae-bbfa-3c68dd7654da

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Something like a Randomly Flip H and Randomly Flip V toggle in ParticleProcessMaterial.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I believe it is possible to add this behaviour in custom shaders.

Is there a reason why this should be core and not an add-on in the asset library?

I think such a basic feature that exists in other engines should be part of base Godot.

Calinou commented 3 months ago

Random animation frame offset (or random animation playback speed) also helps with this. It's already available as an option:

image

For example, this will start each particle between 0% and 20% into its animation. To support the use case where particle animation only plays a certain time after the particle has been emitted, we could allow using negative offsets here (it'll work as long as the particle animation in the material has looping disabled).

Coupled with randomizing playback speed (e.g. a range of 0.8-1.2 should work well), this should already help a lot. You can also randomize the rotation/scale of each explosion sprite slightly and so on.