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

Render graph for image filter effects #784

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

DJMcNab
Copy link
Member

@DJMcNab DJMcNab commented Jan 8, 2025

image

This is a design for how image filters could be added. This is currently built entirely1 on top of the existing API, and so can theoretically land with minimal risk of breaking existing consumers (maybe after 0.4).

The core concept is that a Gallery (~one per thread) stores the operations which will create a Painting (semantically similar to a texture). All galleries can then be combined together in a rendering operation, which will return the texture of a specific Painting, which can be used as you like.
This allows scenes to have a dependency on other paintings, which will be rendered before the scene is rendered. The above image was generated with a "main" scene, which is then blurred. The top part of the image is an inclusion of the rendering, and the bottom part is an inclusion of the blurred version.

Things needing to happen in this PR:

  • Docs
  • Tests
  • Design review

Follow-up work needed (after this PR):

  • More filters (grayscale, hue shift, etc.)
  • Proper blur filters (y-axis-box-blur, gaussian, etc.)
  • Custom operations?
  • Greater cleverness around texture atlases
  • Batching pre-fine rendering stages

Footnotes

  1. We peek into the internals of override_image slightly.

@nicoburns
Copy link
Contributor

One filter which I don't see listed above is opacity. I'm thinking (but I don't know what I'm talking about) that this might make a for a good first "real world" use case given as I'm assuming that correct opacity blending is easier to implement than a high-quality blur filter, and I suspect it's a more commonly used than something like greyscale.

@DJMcNab
Copy link
Member Author

DJMcNab commented Jan 9, 2025

Maybe? It seems more likely that you'd want to use the alpha property on the resulting Image (once #766 lands) in most cases, and so such an opacity filter would be more likely to be an attractive nuisance.

@DJMcNab DJMcNab linked an issue Jan 9, 2025 that may be closed by this pull request
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