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

Ability to change color and opacity in MSDF/SDF shader? #23

Open
iangilman opened this issue Dec 12, 2017 · 1 comment
Open

Ability to change color and opacity in MSDF/SDF shader? #23

iangilman opened this issue Dec 12, 2017 · 1 comment

Comments

@iangilman
Copy link

If i want to update the color or opacity of my text, it looks like what I need to do is generate a fresh material each time, like so:

mesh.material = new RawShaderMaterial(MsdfShader(materialConfig));

I'm wondering how efficient that is for, say, a fading animation. Would it be possible to somehow expose the necessary uniforms, assuming that would be more efficient?

@iangilman
Copy link
Author

Oh I see... I have to modify the uniforms, like so:

mesh.material.uniforms.opacity.value = 0.5;

I'm still learning Three.js, so this wasn't obvious at first. Perhaps it's worth mentioning in https://github.com/Jam3/three-bmfont-text/blob/master/docs/sdf.md ?

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

No branches or pull requests

1 participant