Advanced effects demos #112
Replies: 3 comments 8 replies
-
Hi @swingingtom !
Personally I think a demo (or several) like this would be a very nice addition ! Those GIFs above look really good.
Why not, although for some use-cases such as this one, the impact on performance would be important.
Do you mean this ? :
I don't get what you mean, what do you call segments ? All glyph are quads currently.. I wonder If we should make a |
Beta Was this translation helpful? Give feedback.
-
Of course we could start with it, but Im not sure this will allow enough flexibilty in the long term, especially if Uniforms|Attribute|Varying are involved in the required effect. |
Beta Was this translation helpful? Give feedback.
-
I didn't produce the best example, but we can notice differences according the number of segments.
mapUVs( font, char ) {
const charOBJ = font.chars.find( charOBJ => charOBJ.char === char );
const common = font.common;
const xMin = charOBJ.x / common.scaleW;
const xMax = (charOBJ.x + charOBJ.width ) / common.scaleW;
const yMin = 1 -((charOBJ.y + charOBJ.height ) / common.scaleH);
const yMax = 1 - (charOBJ.y / common.scaleH);
// added new vars
const width = xMax - xMin;
const height = yMax - yMin;
const uvAttribute = this.attributes.uv;
for ( let i = 0; i < uvAttribute.count; i ++ ) {
let u = uvAttribute.getX( i );
let v = uvAttribute.getY( i );
[ u, v ] = (()=> {
// same logic for any uv (seems ok)
return [xMin + u*width, yMin+v*height];
// Per uv logic
// switch ( i ) {
// case 0 : return [ xMin, yMax ]
// case 1 : return [ xMax, yMax ]
// case 2 : return [ xMin, yMin ]
// case 3 : return [ xMax, yMin ]
// }
})();
uvAttribute.setXY( i, u, v );
}
} For segment counts, instead of static values, something "per size" might be better to offer a uniformity. |
Beta Was this translation helpful? Give feedback.
-
Hey ThreeMeshUI community !
For the current project I work on (on hold during holidays) after requiring letterSpacing and kerning, it also requires (lets called these) "advanced effects".
Those requirements weren't there at project kick-off, but they've been added during production.
I probably wouldn't have choose three-mesh-ui if I would have known the whole bundle of current requirements.
But now, this project is mainly built on three-mesh-ui, and I have to implements more advanced effects :
Second Set of UV, textures, FragmentShaders
Animating characters
As we can see, those effects are not that hard to make with Three-Mesh-UI. And I would like to produce some codesandbox demos. But It might be great to first ask how thoses effects should be handle in your opinions.
Core vs Fork ( Main question )
I currently forked the project to make some changes, but thoses changes are not mandatory, and they could be rolled back and placed in onAfterUpdate instead.
The real question here is, are those kind of features/effects rising some interest in the users/maintainers/contributors of three-mesh--ui ? Because I would rather bent my project code to use the official three-mesh-ui than easing my project code and use a forked/umaintened version of three-mesh-ui.
Optional core change to ease these kind of effects
#include <chunks>;
in shaders. Place three-mesh-ui shaders chunks in Three.shaderChunks easing onBeforeCompile and reducing code duplication.Fun fact
While working on those demos, my SO walked in and thought I was working for a food chain called "3 méchouis" Méchoui on wikipedia
Beta Was this translation helpful? Give feedback.
All reactions