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

Request: Custom Strings #6

Open
halcyonforever opened this issue Dec 6, 2021 · 5 comments
Open

Request: Custom Strings #6

halcyonforever opened this issue Dec 6, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@halcyonforever
Copy link

I have been tinkering with something similar but wondered if instead of all random glyphs it could pull strings from an array? That way we could incorporate live (or static) information into the falling code to make it a useful information display.

@Rezmason
Copy link
Owner

Rezmason commented Dec 8, 2021

You know what? There are enough people who'd like this, that it's worth taking into serious consideration. Just gonna blue-sky brainstorm it.

So, first, there's some setup work to draw a texture containing an arbitrary string:

  1. extract the array of strings from the URL
  2. load Chicago.woff
  3. Wait till the font is loaded (FontFaceSet.check())
  4. Create a 2D canvas, style it with the loaded font and fallbacks, and render each unique character in the strings.
  5. Spoof an SDF by blurring them or something, this could look awful to be honest
  6. Assemble the texture

Then, the strings would need to be drawn in the grid somehow so that they're legible, but also look like they belong in the existing effect. The current rain pass uses mathematical functions to make waves of brightness roll down the cells in a column; the problem with this is, there is no actual relationship between any two cells, even if they're neighbors. They cycle their glyphs, but not in any way that guarantees any two characters appear next to one another, let alone for long enough and with other glyphs to be readable.

Maybe there could be a second compute shader that "overrides" the brightness and glyphs in a column, storing the result in a separate buffer of cells. This shader could basically scroll the strings down every column, either one after the other or on separate columns, with some gap between them. The open question would then be, what brightness would they be? Maybe they'd be the maximum of whatever brightness is specified in the rain pass, and some minimum brightness, to guarantee the whole thing is readable.

At the moment I'm tied up expanding the default glyph set to include the additions in The Matrix Resurrections, which adds about a hundred new symbols. So support for custom strings probably won't be possible until sometime in 2022. But as long as folks with strings that aren't in the Chicago typeface aren't bothered with some inconsistencies, and even though the existing project isn't optimized for displaying specific text, it's not an unreasonable request. Other projects might be able to more easily accommodate it in the meantime.

@halcyonforever
Copy link
Author

That was quite a write up.
Your code is much more complex than the ones I had tinkered with on this before. But none of them included the waves of lighting that would cause the rain to be altered. (or font atlases, learned all about them from reading your code)

@Rezmason
Copy link
Owner

Rezmason commented Dec 10, 2021

I think what we're seeing is a classic technical tradeoff. I set a goal to render the glyphs and their cycling as faithfully as I could to what I'd seen in the trilogy, and made a series of decisions in pursuit of that goal which made the project progressively less capable of displaying dynamic information.

Fortunately, while I'll take a while to get around to experimenting with this particular idea, there are plenty of other interpretations of the code rain on Github that may be better suited for the task!

@MWH-Rookie
Copy link

Still, this is a great idea!

@LEMONed
Copy link

LEMONed commented Aug 11, 2022

emojis would be great.

@Rezmason Rezmason added the enhancement New feature or request label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants