-
-
Notifications
You must be signed in to change notification settings - Fork 36k
AsciiEffect: new features #31641
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
base: dev
Are you sure you want to change the base?
AsciiEffect: new features #31641
Conversation
… as input, and minor restructure
Do I need to take care of Definitely Typed/three? Is it automatic? Will another contributor take care of it? |
DefinitelyTyped should inherit the JSDoc types. There's typically no need to make a separate PR for DefinitelyTyped/three unless it's a special case or you encounter type errors after your code has been implemented. |
In general, it's not recommended to add too many features at once to an addon. This makes it less likely the PR is merged since the review process tends to be long and sometimes the PR just gets lost. How about focusing on a single feature for now? |
@Mugen87 understood and agreed. Would love to know what you think should be prioritized? |
How about this one? Using custom font settings sounds interesting. |
First commit of these two is to simplify the commit back to only font-features. Second is to address the XSS concern that DeepScan had, with minimal performance impact. I don't know much about cross-site scripting but the solution, pretty simple, was partially made by Claude Sonnet 4. |
This commits adds two things:
The propositions I'm making to the font customisation seem to have broken the Live example at https://raw.githack.com/Glypse/three.js/moreAsciiEffectFeatures/examples/webgl_effects_ascii.html |
Converting this to draft because the current system is too unstable and I spotted quite a few bugs. Will work on an auto-detection function for letter spacing, instead of having to deal with letter spacing manually. |
This commit:
|
I guess maybe I should add an optional parameter to output 2 characters per horizontal pixel, like the effect previously did? Currently, the computed render has a 2* higher pixel density than the ascii output, but each character occupies a perfect square, whereas they previously occupied a 1:2 rectangle. Would love to have your thoughts. |
Just noticed this only behaves correctly on desktop Firefox. Switching to draft again until I figure this out. |
This is in a state that I believe has good performance, useful options, and fully working. Would love your input. As usual, find it at https://raw.githack.com/Glypse/three.js/moreAsciiEffectFeatures/examples/webgl_effects_ascii.html |
Safari does render the line-height weirdly, but I'll blame that on them, except if anyone has a potential fix. |
This is my first PR to three.js.
When using the Ascii Effect, I thought it'd be nice to be able to use a user-specified font and to pass in a post-processed render as input (instead of the bare render only). This PR is mainly focused on achieving those two things.
Exhaustive changelog
(at time of first commit):charSet
inside the constructor options.fontFamily
,fontWeight
,fontSize
andletterSpacing
options.fontFamily
andfontWeight
are because they're the main goal of this PR, but it turns out that monospace fonts' characters are rarely fitting in a perfect square: if the user adds a customfontFamily
, they'll want to customizeletterSpacing
, otherwise the output might be squished/stretched.Addedcomposer
as an option, allowing to pass a post-processed render as input of the Ascii Effect, instead of the bare render only.Updated the example page withUnrealBloomPass
to show the newly added option.Possible mistakes to look out for (my first three.js PR)
strFontSize
defaults to'Dynamically computed according to resolution'
. This allows for logic check later, but might be misinterpreted by users/LLMs trying to use the effect.charSet
inside the constructor options.