I'm trying to create an Easter egg for a 3D game in Unity3D. I want to render my game momentarily in ASCII art.
My first idea is to create a shader to do that, but I'm not sure if it's the right way.
I'm trying to create an Easter egg for a 3D game in Unity3D. I want to render my game momentarily in ASCII art.
My first idea is to create a shader to do that, but I'm not sure if it's the right way.
I don't know of any plug and play solutions for it, but here is an algorithm that works in the pixel shader with just a texture as extra assets.
The asset required is a small texture with a single row of some number of tiles, where the left most is the darkest and the right most the lightest.
What happens then is (per frame):
(col.r+col.g+col.b) / 3.0
is probably sufficient, even though that isn't quite how eyes work)floor(grayscale * TILE_COUNT)
)vec2( whichTile * TILE_WIDTH + tileX, tileY ) / vec2( TILE_WIDTH * TILE_COUNT, TILE_HEIGHT )
The linked page has several images of examples, one thing I'd consider adding would be a slight bit of noise to the calculated grayscale value so it's not one big block of MMMMMMMMMMMMMMMM
s
Updated: @Lokkij in the gamedev chatroom posted a more complete tutorial for Unity: http://pentahelix.github.io/ASCII-Tutorial-Revisited/