Skip to content

Add ColorByVelocityModifier#492

Open
rydrman wants to merge 1 commit into
djeedai:mainfrom
rydrman:color-by-velocity
Open

Add ColorByVelocityModifier#492
rydrman wants to merge 1 commit into
djeedai:mainfrom
rydrman:color-by-velocity

Conversation

@rydrman

@rydrman rydrman commented Aug 8, 2025

Copy link
Copy Markdown

This modifier sets the color of a particle on a gradient based on its linear velocity at any point in time. Great for having particles disappear as they slow down, for example.

The implementation is largely a copy from the ColorOverLifetimeModifier but calculates the position in the gradient based on a clamped particle velocity

@rydrman rydrman force-pushed the color-by-velocity branch from efe917e to 540a3dd Compare August 9, 2025 02:16
This modifier sets the color of a particle on a gradient based on its
linear velocity at any point in time. Great for having particles
disappear as they slow down, for example.

Signed-off-by: Ryan Bottriell <ryan@bottriell.ca>
@djeedai

djeedai commented Oct 11, 2025

Copy link
Copy Markdown
Owner

Hi @rydrman,

Thanks for this change. I had a look, and I think you can achieve this with the current API, by using expressions, can't you? I see we're missing clamp() but I can quickly add that. I'd prefer not to have to support a new modifier if it can be built by users already; the entire point of the Expression API is to have a customizable system so that we don't need built-in features (aside from the intrinsics of WGSL of course). I appreciate that in some cases a helper is useful for common use cases, to help users where for example the math is not trivial. But in this case I don't feel it's clearing that bar. Let me know if you feel otherwise @rydrman (and sorry for letting that PR dangle for so long, I should have replied as such much earlier). Thanks!

@rydrman

rydrman commented Oct 14, 2025

Copy link
Copy Markdown
Author

Hmmm, ya I looked at the expression API and couldn't see a path to what I wanted. That being said, I had limited time to get something going. If you feel like it's possible with the expressions then definitely feel free to close - I appreciate you laying out the intention wrt/ the api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants