Skip to content
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

Implement particle seek request, get rid, and seed normalization #92089

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

QbieShay
Copy link
Contributor

@QbieShay QbieShay commented May 18, 2024

2024-05-18.18-45-36.mp4

Works ONLY with GPUParticles3D for now.

Test project:
particles-skim-test.zip

This PR exposes the required API to then construct better particle timing tools on top of existing particles.
I implemented the seed control in this PR because otherwise any restart() would change the seed, which makes seeking impossible.

TODO

  • Implement request_process_time for CPUParticles
  • Implement rnadom seed for GPUParticles2D
  • Implement random seed for CPUParticles2D/3D

Closes godotengine/godot-proposals#6226
Simpler approach than godotengine/godot-proposals#7085 for editor purposes

@QbieShay QbieShay added this to the 4.4 milestone May 18, 2024
@AThousandShips AThousandShips changed the title Implemented particle seek request, get rid, and seed normalization Implement particle seek request, get rid, and seed normalization May 18, 2024
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected.

One strange thing I noticed though is that when you set particle seed mode to Random then restart particle emission, the seed is changed to a random value which you can see after changing it back to Custom. This makes sense, but this seed is always capped to 1 million due to the inspector hint:

image

See the second suggestion below which aims to address this.

PS: Are there any plans to expose a high-level GPUParticles3D property that allows for easy seeking, without needing a custom script? I assume this would need to force speed scale to be 0 though (like AnimationPlayer's Manual process mode).

if (fixed_fps > 0) {
frame_time = 1.0 / fixed_fps;
} else {
frame_time = 1.0 / 30.0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd document this 30 FPS fallback for particles with fixed FPS set to 0 in the class reference in the fixed_fps description, as well as RenderingServer.particles_set_request_process_time().

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
@QbieShay
Copy link
Contributor Author

@Calinou yeah definitely I would like to get to something that has a slider to seek. I don't know yet what should be the design because I have a couple of ideas I want to explore. Those being:

  • maybe a vfx node, that encapsulates things for all particles.
  • maybe a particles track that does special things (seek) in editor
  • maybe a mix of the two?

There's also the issue that CPUParticles are not managed by the rendering server so i question whether the rendering server API is the correct way to go, or if i should keep that internal and only expose it via the node with the same interface for cpu and gpuparticles.

For now I'm stuck there but I haven't really dedicated more time to this yet.

@QbieShay
Copy link
Contributor Author

Oh and thank you for testing even in the incomplete state!!

@QbieShay
Copy link
Contributor Author

QbieShay commented May 20, 2024

One strange thing I noticed though is that when you set particle seed mode to Random then restart particle emission, the seed is changed to a random value which you can see after changing it back to Custom. This makes sense, but this seed is always capped to 1 million due to the inspector hint:

I noticed that as well, and I am not sure why it resets even if the seed is set manually. For what i thought i wrote in the code, it should be possible to override the seed, but it doesn't seem to be working.

@QbieShay
Copy link
Contributor Author

add pre process on clear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Allow optional seed specifying for particles
2 participants