godotengine / godotengine/godot-docs
Add Text Shader Documentation
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Describe the project you are working on:**
https://twitter.com/ZeroPointGame
**Describe the problem or limitation you are having in your project:**
There's no documentation for canvas item shaders applied to texts.
**Describe the feature / enhancement and how it helps to overcome the problem or limitation:**
Documentation about text shaders allows people add nice effects in dynamic fonts.
**Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:**
By what i found back engendering it, texts are rendered as planes and applied characters as textures. All colors like shadow are applied as Vertex Colors. So this should be a minimum canvas item for texts:
```
shader_type canvas_item;
void fragment(){
COLOR = texture(TEXTURE,UV) * COLOR;
}
```
An this is using gradient textures in text. There's not consistence in the plane's uv since it's mapped on a atlas of characters (i think) but you can use the screen UV
```
shader_type canvas_item;
uniform sampler2D gradient;
void fragment(){
vec4 col = texture(gradient,SCREEN_UV.yx);
COLOR = texture(TEXTURE,UV) * COLOR * col;
}
```

**If this enhancement will not be used often, can it be worked around with a few lines of script?:**
It's a few lines of scripts.
**Is there a reason why this should be core and not an add-on in the asset library?:**
No aplied
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.