CGGC and GIP lab project
CS faculty, Technion
The shader
The shader we used is based on the shader written by Bill Kirby (https://www.shadertoy.com/user/WillKirkby) and adapted by Shahriar Shahrabi (https://shahriyarshahrabi.medium.com/). The original shader on GLSL consists of two simple functions: rain, which provides us with rain dropping effect and text, which generates the random letters. The shader was later adapted to Unity’s HLSL/ShaderLab and GPU random numbers generation was added instead of pseudo-random numbers generated from a white-noise picture. We also introduced a few minor changes to adapt the shader for AR. Below is the general breakdown and purpose of those components.
1. The rain function
This function generates a matrix that is filled with either green or black pixels by blocks in our pre-defined columns. With each frame green blocks are being skewed down and new ones generated at the top. This is how we receive a raindrop effect. We can use this matrix as a mask to paint our pixel black or green accordingly. If the value is 0, multiplication will give us the black color, otherwise the pixel belongs to a block and will light up.
2. The text function
This function generates random numbers in our predefined block matrix. The output is essentially just a table of letters randomly changing each frame. First, for a given pixel, we identify the corresponding row and column. After the appropriate block id has been found, pixel receives color based on the letter generated in that block.
The letters themselves are being generated by a GPU command buffer that is being deployed at the start. Using simple white noise generation, we acquire new grid of letters each frame