Real-time version of the YouTube upload.

During the whole spinning rat meme era, Imade a video where each pixel of a 4K video was a rat video, together creating a giant spinning rat. It got some good attention, I must say. One comment, however, has been living rent-free in my head for over a year, which said:

 "Meh, there is nothing in the video showcasing the rats properly, the zoom out is so abrupt and instant that it might as well just have been a cut with zero visual proof of what is going on. I am disappointed."

And you know what fair enough!

Funny how the human mind works though, singling out one slightly negative(with a big grain of salt) comment out of thousands positive ones, laying dormant for a year in the backrooms of your mind, and then one sleepless night one year later, poof, the brain pulls it out lol.

Original video, and why the comment was right:
The original video was made with After Effects, which limited how well the small sizes could be visualized. The problem was that with the render technique used in After Effects, even though each pixel contained a video, they could not be shown as After Effects throws away that information. So a replacement video was used to show what was in each pixel. And as mentioned before, even though it was real, it might as well been fake. To abrupt and instant!

This time, I put my 10 years of game dev and teaching experience to work and wrote an actual shader to draw my own custom-made rat created with Blender and Substance Painter.

Now for the numbers: (Keep in mind that each rat's square is 512x512 pixels, so they also stack in the formula below in order to get the total texel count in world space).

The formula to calculate the theoretical maximum possible rat count is:

((1024x1024) x (1024x1024)) x world.z (99999.99**) x world.y (99999.99**). This gives us 1,099511407873685e+22 possible rats to be drawn. The number is too big for most calculators, so it is written in scientific notation where e+22 is 10 to the power of 22. Basically, add 22 zeros behind the 5, and we get 1,0995114078736850.000.000.000.000.000.000.000.

If we visualize this through a single planar slice, as done in this application, with a slice size of 100x100x1, we have 1,099,511,627,776 rats visible in this application (and YouTube video).

Dumbed down explanation of how it works: Each rat is a texture array of 512x512x256 frames cached in the GPU texture buffer, playing the animation, acting as pixels for the larger rat animations, and so on. Because each rat pixel (ratxel hehe) uses exactly the same texture data, we can simply re-use this memory with the world position offsets for each pixel. This makes this whole thing possible in the first place. A naive tri-planar mapping approach is used to create the world space projection. Meaning any object placed in the world with this shader samples a rat from their surface position in world space.

The whole WebGL build fits snugly in 68MB with the runtime included.

**-: world.z and world.y represent every single floating point number starting from 0 until the memory limit for each of their axes. Which in Unity is 99999.99 for each axis until it loses visible unusable stability artifacts in its rendering.

Finally:
I had so much fun creating this that I got inspired and started a side project with my new little rat friend and started working on an actual little game. Will it ever be released? Probably not; such is the fate of most side projects.

So to the user that placed the comment, thank you! I had a lot of fun because of your comment. Plus, it is finally out of my system. Win-win.

P.S. The reason the first rats are so pixelated is that there are literally not enough floating point values to properly render them at such a small size.

Published 23 days ago
StatusPrototype
PlatformsHTML5
AuthorMark
Tagsartgame, Low-poly, Relaxing, Surreal
LinksYouTube

Leave a comment

Log in with itch.io to leave a comment.