Skip to content

Conversation

maiconpintoabreu
Copy link
Contributor

@maiconpintoabreu maiconpintoabreu commented Sep 29, 2025

Adding an example shader using character bitmask by color to draw using ascii symbols.

Added for: #5209

Tested on Desktop:

image

Tested on Web:

image

@raysan5 raysan5 merged commit 317c1ea into raysan5:master Sep 29, 2025
17 checks passed
@raysan5
Copy link
Owner

raysan5 commented Sep 29, 2025

@maiconpintoabreu thanks for the new example! 😄

@maiconpintoabreu maiconpintoabreu deleted the add_ascii_effect_example branch September 29, 2025 15:48
@raysan5
Copy link
Owner

raysan5 commented Sep 29, 2025

@maiconpintoabreu I'm checking the example and I don't understand how it works, where is the font used? how it is selected? It would be nice, considering it is a learning example, to have more details explained in the shader and not just a copy from somewhere else.

Note the ASCII rendering looks a bit off, characters are not clear...

@maiconpintoabreu maiconpintoabreu restored the add_ascii_effect_example branch September 29, 2025 16:05
@maiconpintoabreu
Copy link
Contributor Author

Hi @raysan5 I will add more comments so, the bitmaps I got from https://www.shadertoy.com/view/lssGDj, he developed a bitmap maker: https://thrill-project.com/archiv/coding/bitmap/, about how it work is simple, based on the gray level it will select one of the characters and the color is based on the cell size and the color of the cell.

    vec2 cellUV = floor(fragTexCoord / uvCellSize) * uvCellSize;

    vec3 cellColor = texture2D(texture0, cellUV).rgb;

About the ASCII a big off is because I set the fontsize too low, it should be a min of 5, I was testing with different numbers and I forgot to set it back.

@raysan5
Copy link
Owner

raysan5 commented Sep 29, 2025

@maiconpintoabreu that's the kind of information that should be explained in the shader (also reviewed shader formatting for glsl330 version), you can also include the links, so other users trying to learn how it works will have that info available. raylib examples are intended to be educational, for users without much experience on the graphics/shader fields.

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

Successfully merging this pull request may close these issues.

2 participants