aiekick / SdfFontDesigner

Offline font tuning/bitmap generation via shaders
MIT License
77 stars 6 forks source link

shader sources and loading of shaders #3

Closed teetteet closed 5 years ago

teetteet commented 5 years ago

What kind of shader sources will SdfFontDesigner support in the future? http://shadertoy.com/ https://www.interactiveshaderformat.com/ http://glslsandbox.com/

I would love to point to an url, to import them. E.g. like pointing to an url: http://glslsandbox.com/e#53736.1 https://www.shadertoy.com/view/3dSXzm

A Menu UI for shader folder would be useful. A the moment i must input a folder name. Maybe save that folder name in the config.

aiekick commented 5 years ago

i can import shadertoy and glslsandbox in NoodlesPlate (because its just shader import).

you want this feture in the case of SdfFontDesigner ? his goal is to create font bitmap, not shaders direclty. for that, NoodlesPlate is a better choice

For SdfFontDesigner, its complicated, because, you need to know how you want to modify glyph. SdfFontDesigner expose a glyph sdf with a rect in a font map.

How i can automatically know how interpret a shadertoy shader for that ? On ShaderToy you have many different things. i dont know if you have opened a shader in SdfFontDesigner, but you have a mainGlyph function who cis a easy way for tune a glyph

for the ui i can have a libray like i have in NoodlesPlate

teetteet commented 5 years ago

I thought about to import shaders from shadertoy and glslsandbox with e.g. geometric styles, that can be transformed onto the font via cut out or append etc. Like cutting edges into fonts or destort them. For that it would be nice to scale down or up the output size of the shader. That would be a unique feature. "The UI for shaders" i only want to have a menu item in options for instance where i can put in a directoy for the place of my shaders.

aiekick commented 5 years ago

for the ui, when you first open a shader, you have a combobox who appear in the main menu bar, where you have the list of all your shader with extention .glsl contain in the directory of the current shader. like that you can easily switch shaders.

for the import can you give me a url by example and the result you hope you will have ? i dont understand precisely your idea :)

SdFontDesigner_MSVC_x64_Release_2019-04-02_20-03-47

aiekick commented 5 years ago

maybe you mean : use the shader imported as a texture to apply a shader by cutting font or other operation.

the basic way is to import the shader and create a new shader linked to the imported shader by creating the good texture uniforms. this is easy, but for the rest, the coder must assemble himself and create the effect himself. SdfFontDesigner have that but not used by the UI, he used the same lib (SoGLSL used by NoodlesPlate)

you can od it a this moment :

you can add buffer control param, like :

uniform sampler2D(buffer:file=imported_shader_without_extention:flip=false:mipmap=true:wrap=clamp:filter=linear) name;

theses are the defaults params if not specified . see doc here

teetteet commented 5 years ago

Yes, cutting and deforming forms from a shader. I hope to see some short snippets how to handle it via youtube in a near future. This sounds all so cool! Any roadmap for your tools?

aiekick commented 5 years ago

i have a private roadmap yes, but i can also open the roadmap feature of this repo :)

the import feature is easy he will available in the next release.

i have imported the shader url : https://www.shadertoy.com/view/ld3fzf

chrome_2019-04-02_20-22-33

in Noodlesplate :

NoodlesPlate_MSVC_x64_Release_2019-04-02_20-22-46

ah this moment, i have two files :

explorer_2019-04-02_20-23-01

and i have linked this with the uniform :

uniform sampler2D(buffer:file=Rainbow_Things_Image) import;

and use it with this simple code :

vec4 imp = texture(import, uv);

vec4 col = vec4(
    mix(colorStart, imp.rgb, border),
    alpha);

i have obtained this :

2019-04-02_20-53-03

and i have discovered a super bug, the location of include file or child buffer, are not resolved according to the current call location script...

so for the moment when you call a file in the buffer uniform who is located in another directory you need to do it relative to the path app/scripts directory.. :(

aiekick commented 5 years ago

its work like a charm . the next release is for this sunday :)

ex, of file obtained in few clicks with the shader 2D Rad Rep : Particles 2 (196c) Import

process : 2019-04-03_03-05-38