#ASCII Shader

1 messages · Page 1 of 1 (latest)

slim grove
#

What if I want to create an ASCII shader, and only want to convert certain pixels to ASCII (because replacing each pixel with a character would result in a huge mess). How would I pick them spaced out and input the text spaced out?

#

I tried doing it through a script and using the canvas, but it's absurdly inefficient

#

this is the type of effect I am going for

inner crane
#
  1. Round the UV to the center of its grid position, and sample at that position, so each fragment in the grid square has the same position.
  2. Remap the UV from the local grid position to the position in the text texture but offset by the (1.) position, then sample the the text.
slim grove
inner crane
#
┌───────────────────┐
│...................│
│...................│
│...................│
│.........x.........│
│...................│
│...................│
│...................│
└───────────────────┘

Every . should sample from the X so they all get the same value from the scene. You've got to divide the UV into the grid where the letters will be and area needs to sample its center

slim grove
#

so each pixel would be the same color

#

in that area

#

would it work for all the.to be filtered out and then only the X color remains. And then go through all of the pixels that have the color and then put an image of a character with its center over the X

inner crane
#

Shaders don't work that way

#

each fragment is unique and doesn't know about the things around it

slim grove
#

oh ok i see

inner crane
#

which is why each fragment has to look for the value it should represent so each grid shows the same letter

#

if they didn't all sample the center position then each pixel might show a different letter which would just come out as a garbled mess

slim grove
#

so every . pixel can see what the X pixel is

inner crane
#

it can only see what the input is, which is presumably the camera's color

slim grove
#

ohh wait so all the . look at the input from the X position, so all of them are the same color?

#

but once all the pixels are the same color in that area, how do you convert it into a letter?

#

i'm one step closer

inner crane
slim grove
#

omg for each pixel in the square do i check the corresponding pixel in the image of the character