pixelscommander / pixi-sdf-text Goto Github PK
View Code? Open in Web Editor NEWSigned distance field text implementation for PixiJS
Signed distance field text implementation for PixiJS
Right now this won't support PixiV5, no? What would be needed to make it work? I need v5 for other functionality...
I was looking through the code in this repo and noticed https://github.com/PixelsCommander/pixi-sdf-text/blob/master/src/sdf.frag#L23
gl_FragColor = vec4(color, alpha) * u_alpha;
This causes the RGB channels to also be multiplied by the alpha value, darkening the color as it becomes less opaque.
What was almost certainly the intended behavior would be better represented as:
gl_FragColor = vec4(color, alpha * u_alpha);
Just playing with you demo tried to change fonts in it. Did it in this way:
var style = {
fontSize: 12,
fontWeight: 'bold',
fill: 0x39FF14,
align: 'left',
wordWrapWidth: 400,
lineHeight: 64,
fontURL: 'assets/Roboto-msdf.json',
imageURL: 'assets/Roboto-msdf.png'
};
window.text = new PIXI.sdf.Text('This is a multiline SDF text', style);
Multichannel SDF provides better quality for text rendering. Better explained here
https://github.com/Jam3/three-bmfont-text/blob/master/docs/sdf.md
In order to use MSDF we should modify fragment shader (src/fragment) and have a corresponding demo based on font generated with: https://github.com/Jam3/msdf-bmfont
Here is a one we may use https://github.com/Jam3/three-bmfont-text/blob/master/shaders/msdf.js
Does the demo use the single or multi-channel signed distance field atlas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.