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

Generalize curve support. #119

Open
brandon-reinhart opened this issue Jan 11, 2023 · 3 comments
Open

Generalize curve support. #119

brandon-reinhart opened this issue Jan 11, 2023 · 3 comments
Labels
C - enhancement New feature or request

Comments

@brandon-reinhart
Copy link

brandon-reinhart commented Jan 11, 2023

Instead of a custom gradient, systems should accept some kind of generalized curve. This is also a bevy issue, in that some bevy modules will want to be able to be parameterized over generalized curves and there needs to be agreement across crates about what curves to use.

Why is this useful?

  1. writing a bunch of your own curve types will mean fewer supported types
  2. also its annoying to do!
  3. if we're going to write curves, we should all share the results
  4. you'll often want more curves than just linear interp between keyframes. ex: non-linear ramping over a color space
@djeedai
Copy link
Owner

djeedai commented Jan 11, 2023

I'm considering adding general texture-based gradient but that'd be after the #109 refactor.

@djeedai djeedai added the C - enhancement New feature or request label Jan 11, 2023
@brandon-reinhart
Copy link
Author

I'm considering adding general texture-based gradient but that'd be after the #109 refactor.

Yeah that would solve it and basically outsource the problem to whatever texture gen process people wanted. Nice!

@djeedai
Copy link
Owner

djeedai commented Mar 17, 2023

The outsourcing to drawing softwares is not really the main reason; it's true if we don't provide any conversion from analytical gradient to texture, but false otherwise. The real reason is that the more complex the gradient, the less attractive the analytical solution is compared to the texture sampling one. With a few key points and linear interpolation, that's just a few instructions in the shader, but as things are getting more complex with more key points and nonlinear interpolation, the cost of sampling an analytical gradient increases, and outweighs a single texture sampling. Storage is also of concern, although texture-based gradients are going to use more GPU memory most of the time unless the gradient is incredibly complex. But even then, those textures are small by today's GPU standards, so the performance benefit is the core reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants