-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add color animation support #12202
Comments
Note that As an example, a bezier or quadratic curve in color space would be a well-defined operation, where each color is a control point along the curve. |
I would like to organize the discussions in #12460, #12534 and #12553 a bit more. We have got two basic ideas for how to handle color addition, subtraction, etc.:
If you have another solution in mind, or some more pros/cons please feel free to add them here. Let's try to reach a consensus on how to do this here. If you want to discuss any specific attempt, please do so in the relevant PRs. |
I'll second that approach: it avoids complexity, implements the common traits for the spaces they make sense on, and pushes users to interpolating in the spaces that they should be using. Classifying our existing color spaces:
|
Ultimately, I think we need to take an artist-centric approach to this issue. Artists won't be calling APIs or manually coding control points for spline curves - they will be working in some kind of content creation tool, and generally in the context of some larger entity such as a 3d model. Animating colors directly is in itself already an outlier: yes, you can attach an animation track to a material color property in Blender, but this is rare. I can imagine something like a pulsing traffic light, but even in this case it's only changing brightness, which means that it doesn't much matter which color space you pick. |
Another point to bear in mind, from the standpoint of an artist working in Blender, "opacity" is a separate property unrelated to color. The combination of color + alpha is a historical accident related to compositing of 2d images. |
# Objective - Fixes #12202 ## Solution - This PR implements componentwise (including alpha) addition, subtraction and scalar multiplication/division for some color types. - The mentioned color types are `Laba`, `Oklaba`, `LinearRgba` and `Xyza` as all of them are either physically or perceptually linear as mentioned by @alice-i-cecile in the issue. --- ## Changelog - Scalar mul/div for `LinearRgba` may modify alpha now. ## Migration Guide - Users of scalar mul/div for `LinearRgba` need to be aware of the change and maybe use the `.clamp()` methods or manually set the `alpha` channel.
Not quite done yet: we need examples and the |
Oooh, I completely forgot about that 😅 I would like to give this a try |
Should probably be built with/along side the |
Yep, I think we should just call the |
I am not quite sure about that. Edit: the types implementing the operators could actually just use them inside |
# Objective - Fixes #12202 ## Solution - Implements `Animatable` for all color types implementing arithmetic operations. - the colors returned by `Animatable`s methods are already clamped. - Adds a `color_animation.rs` example. - Implements the `*Assign` operators for color types that already had the corresponding operators. This is just a 'nice to have' and I am happy to remove this if it's not wanted. --- ## Changelog - `bevy_animation` now depends on `bevy_color`. - `LinearRgba`, `Laba`, `Oklaba` and `Xyza` implement `Animatable`. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Zachary Harrold <zac@harrold.com.au>
There are four sections to this issue:
Animatable
for all of our color types.Point
(in the sense ofbevy_math
for all of our color types.Our options for handling alpha during color addition and subtraction from #12163 (comment):
The text was updated successfully, but these errors were encountered: