8000 Fix particle `ForceOverLifetime` bug when render mode is `stretched` by Sway007 · Pull Request #2599 · galacean/engine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix particle ForceOverLifetime bug when render mode is stretched #2599

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

Merged
merged 5 commits into from
Apr 9, 2025

Conversation

Sway007
Copy link
Member
@Sway007 Sway007 commented Mar 28, 2025

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Comparison with streched billboard render mode

  • Unity
    unity p

  • Galacean before
    galacean b

  • Galacean current
    editor p

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

Summary by CodeRabbit

  • New Features

    • Introduced dual-scene rendering capabilities, enhancing visual output with separate camera views.
    • Updated particle creation functions to allow for additional rendering options, improving flexibility in effects.
  • Bug Fixes

    • Adjusted threshold values for various particle properties to improve evaluation criteria and functionality.

@Sway007 Sway007 requested review from GuoLei1990 and zhuxudong March 28, 2025 10:01
@Sway007 Sway007 self-assigned this Mar 28, 2025
Copy link
coderabbitai bot commented Mar 28, 2025

Walkthrough

The changes introduce a dual-scene architecture in the particleRenderer-force.ts file, enabling rendering in two separate scenes with individual camera configurations. Particle creation functions are updated to accept additional parameters for flexibility. In e2e/config.ts, the threshold values for various particle properties are uniformly lowered from 0.3 to 0.1, including adjustments to the ProjectLoader threshold from 0.4 to 0.1.

Changes

File(s) Change Summary
e2e/case/particleRenderer-force.ts Enhanced rendering functionality to support two scenes; updated particle creation functions to accept stretch and lengthScale parameters.
e2e/config.ts Lowered threshold values for particleDream, forceOverLifetime, textureSheetAnimation, and particleShapeMesh from 0.3 to 0.1; updated ProjectLoader threshold from 0.4 to 0.1.

Suggested reviewers

  • GuoLei1990

Possibly related PRs

  • Particle system add ForceOverLifetime module #2584: The changes in the main PR, specifically the modifications to the particle creation functions in particleRenderer-force.ts, are related to the new ForceOverLifetime module introduced in the retrieved PR, as both involve enhancements to particle behavior and rendering capabilities.

Poem

I'm a coding rabbit, hopping in the code,
With two scenes now, watch the magic explode!
Particles stretch and dance with delight,
Lowered thresholds make everything bright.
Hopping through changes, what a joyful sight! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Sway007 Sway007 added bug Something isn't working medium priority Medium priority issue particle labels Mar 28, 2025
Copy link
codecov bot commented Mar 28, 2025

Codecov Report

Attention: Patch coverage is 0% with 69 lines in your changes missing coverage. Please review.

Project coverage is 68.63%. Comparing base (6bc9fcc) to head (5ed31f9).
Report is 2 commits behind head on dev/1.5.

Files with missing lines Patch % Lines
e2e/case/particleRenderer-force.ts 0.00% 64 Missing ⚠️
e2e/config.ts 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           dev/1.5    #2599      +/-   ##
===========================================
- Coverage    68.65%   68.63%   -0.02%     
===========================================
  Files          964      964              
  Lines       101036   101076      +40     
  Branches      8679     8681       +2     
===========================================
+ Hits         69367    69376       +9     
- Misses       31407    31438      +31     
  Partials       262      262              
Flag Coverage Δ
unittests 68.63% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
e2e/case/particleRenderer-force.ts (1)

181-181: Force constants updated to 2.
Raising the maximum force on each axis may significantly affect particle behavior; tests should verify the new forces meet your intended velocity offset corrections.

You could parameterize these force values to avoid hardcoding and facilitate future tuning.

Also applies to: 185-185, 189-189

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 181-181: e2e/case/particleRenderer-force.ts#L181
Added line #L181 was not covered by tests

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3329dfc and 5ed31f9.

⛔ Files ignored due to path filters (2)
  • e2e/fixtures/originImage/Particle_particleRenderer-dream.jpg is excluded by !**/*.jpg
  • e2e/fixtures/originImage/Particle_particleRenderer-force.jpg is excluded by !**/*.jpg
📒 Files selected for processing (2)
  • e2e/case/particleRenderer-force.ts (7 hunks)
  • e2e/config.ts (2 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
e2e/case/particleRenderer-force.ts (4)
packages/math/src/Color.ts (1)
  • Color (8-359)
packages/math/src/Vector3.ts (1)
  • Vector3 (11-612)
packages/core/src/particle/ParticleRenderer.ts (1)
  • ParticleRenderer (19-288)
packages/core/src/particle/modules/ForceOverLifetimeModule.ts (6)
  • forceX (53-55)
  • forceX (57-63)
  • forceY (68-70)
  • forceY (72-78)
  • forceZ (83-85)
  • forceZ (87-93)
🪛 GitHub Check: codecov/patch
e2e/case/particleRenderer-force.ts

[warning] 37-39: e2e/case/particleRenderer-force.ts#L37-L39
Added lines #L37 - L39 were not covered by tests


[warning] 41-44: e2e/case/particleRenderer-force.ts#L41-L44
Added lines #L41 - L44 were not covered by tests


[warning] 47-51: e2e/case/particleRenderer-force.ts#L47-L51
Added lines #L47 - L51 were not covered by tests


[warning] 53-58: e2e/case/particleRenderer-force.ts#L53-L58
Added lines #L53 - L58 were not covered by tests


[warning] 82-86: e2e/case/particleRenderer-force.ts#L82-L86
Added lines #L82 - L86 were not covered by tests


[warning] 88-92: e2e/case/particleRenderer-force.ts#L88-L92
Added lines #L88 - L92 were not covered by tests


[warning] 95-95: e2e/case/particleRenderer-force.ts#L95
Added line #L95 was not covered by tests


[warning] 99-104: e2e/case/particleRenderer-force.ts#L99-L104
Added lines #L99 - L104 were not covered by tests


[warning] 109-112: e2e/case/particleRenderer-force.ts#L109-L112
Added lines #L109 - L112 were not covered by tests


[warning] 181-181: e2e/case/particleRenderer-force.ts#L181
Added line #L181 was not covered by tests


[warning] 185-185: e2e/case/particleRenderer-force.ts#L185
Added line #L185 was not covered by tests


[warning] 189-189: e2e/case/particleRenderer-force.ts#L189
Added line #L189 was not covered by tests


[warning] 195-200: e2e/case/particleRenderer-force.ts#L195-L200
Added lines #L195 - L200 were not covered by tests


[warning] 205-208: e2e/case/particleRenderer-force.ts#L205-L208
Added lines #L205 - L208 were not covered by tests


[warning] 218-218: e2e/case/particleRenderer-force.ts#L218
Added line #L218 was not covered by tests


[warning] 280-280: e2e/case/particleRenderer-force.ts#L280
Added line #L280 was not covered by tests


[warning] 285-288: e2e/case/particleRenderer-force.ts#L285-L288
Added lines #L285 - L288 were not covered by tests


[warning] 355-355: e2e/case/particleRenderer-force.ts#L355
Added line #L355 was not covered by tests


[warning] 360-363: e2e/case/particleRenderer-force.ts#L360-L363
Added lines #L360 - L363 were not covered by tests


[warning] 370-370: e2e/case/particleRenderer-force.ts#L370
Added line #L370 was not covered by tests

e2e/config.ts

[war 8000 ning] 206-206: e2e/config.ts#L206
Added line #L206 was not covered by tests


[warning] 211-211: e2e/config.ts#L211
Added line #L211 was not covered by tests


[warning] 216-216: e2e/config.ts#L216
Added line #L216 was not covered by tests


[warning] 221-221: e2e/config.ts#L221
Added line #L221 was not covered by tests


[warning] 264-264: e2e/config.ts#L264
Added line #L264 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e (22.x)
🔇 Additional comments (10)
e2e/config.ts (1)

206-206: Lowered thresholds require proper coverage.
These threshold adjustments (from 0.3/0.4 down to 0.1) can significantly increase the sensitivity of end-to-end comparisons. Consider adding or updating relevant tests to ensure these changes are validated and won't introduce false positives or regressions, especially since codecov indicates these lines lack coverage.

Would you like assistance drafting the corresponding tests?

Also applies to: 211-211, 216-216, 221-221, 264-264

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 206-206: e2e/config.ts#L206
Added line #L206 was not covered by tests

e2e/case/particleRenderer-force.ts (9)

37-39: Consider testing multi-scene setup.
You’ve introduced a dual-scene architecture with separate cameras. This is a valuable feature, but codecov reports these lines are not covered by tests. Updating or adding tests to confirm correct scene management, background colors, and camera viewports will help catch potential regressions in multi-scene scenarios.

Also applies to: 41-44, 47-51, 53-58

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 37-39: e2e/case/particleRenderer-force.ts#L37-L39
Added lines #L37 - L39 were not covered by tests


82-86: Validate particle initialization in both scenes.
Creating distinct particle entities (“fireEntity”) for left and right scenes with varying parameters is a sensible approach. However, the new lines remain untested per codecov. Tests ensuring both scenes render the intended particle effects would increase confidence in these changes.

Also applies to: 88-92

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 82-86: e2e/case/particleRenderer-force.ts#L82-L86
Added lines #L82 - L86 were not covered by tests


95-95: No concerns - screenshot initialization.
Initializing screenshots for both cameras seems straightforward.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 95-95: e2e/case/particleRenderer-force.ts#L95
Added line #L95 was not covered by tests


99-112: Optional parameters for debris particles.
You’ve added stretch and lengthScale to support stretched billboards. This design looks fine, but consider unit or integration tests confirming that enabling stretch toggles the expected mode and scale. Coverage is lacking per codecov.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 99-104: e2e/case/particleRenderer-force.ts#L99-L104
Added lines #L99 - L104 were not covered by tests


[warning] 109-112: e2e/case/particleRenderer-force.ts#L109-L112
Added lines #L109 - L112 were not covered by tests


195-208: Highlight untested glow-particle parameters.
Similar to debris particles, adding stretch and lengthScale broadens usage. Ensure you have robust coverage verifying these new variations.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 195-200: e2e/case/particleRenderer-force.ts#L195-L200
Added lines #L195 - L200 were not covered by tests


[warning] 205-208: e2e/case/particleRenderer-force.ts#L205-L208
Added lines #L205 - L208 were not covered by tests


218-218: Random seed usage changed.
useAutoRandomSeed = false is beneficial for deterministic testing. Verify that existing tests or new tests confirm expected seeding behavior.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 218-218: e2e/case/particleRenderer-force.ts#L218
Added line #L218 was not covered by tests


280-289: Sparks particle stretch parameters.
Again, you’ve introduced optional parameters for stretch mode. Be sure to add or update tests to confirm correct rendering and coverage.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 280-280: e2e/case/particleRenderer-force.ts#L280
Added line #L280 was not covered by tests


[warning] 285-288: e2e/case/particleRenderer-force.ts#L285-L288
Added lines #L285 - L288 were not covered by tests


355-363: Highlights particle stretch parameters.
As with the other particle-creation functions, confirm coverage for stretched billboard logic.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 355-355: e2e/case/particleRenderer-force.ts#L355
Added line #L355 was not covered by tests


[warning] 360-363: e2e/case/particleRenderer-force.ts#L360-L363
Added lines #L360 - L363 were not covered by tests


370-370: Random seed usage for highlights.
Turning off auto-seed is consistent. However, codecov indicates no direct coverage. Consider a test case verifying reproducible results for highlights.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 370-370: e2e/case/particleRenderer-force.ts#L370
Added line #L370 was not covered by tests

@GuoLei1990 GuoLei1990 changed the title Replenish the velocity offset caused by force Fix Particle ForceOverLifetime bug when render mode is stretched Apr 9, 2025
@GuoLei1990 GuoLei1990 changed the title Fix Particle ForceOverLifetime bug when render mode is stretched Fix particle ForceOverLifetime bug when render mode is stretched Apr 9, 2025
@GuoLei1990 GuoLei1990 merged commit 46aa3e9 into galacean:dev/1.5 Apr 9, 2025
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working medium priority Medium priority issue particle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0