I made a thing that can draw images

I made a Canvas class that takes in a 2-dimensional array with Color3 values and creates frames accordingly, with a greedy meshing algorithm to reduce the frame count. This will be used in tandem with another project I’m doing, but I’ll make another post on that soon :slight_smile:

It takes ~5s to draw the below 1920x1080 image with only 2 colors using 19282 frames, compared to the theoretical 2073600 if it used a frame per pixel.

However, this is a very niche dataset, and performs terribly on random pixels because it can’t group them together. I chose perlin noise because it comprises of contiguous spaces and is therefore easier to group. I will need to do more to make it faster and more efficient with frames. I plan on using the UIGradient technique shown in this post to further reduce frame counts.

If you have any feedback on how I could further reduce frame counts, do let me know :slight_smile:

21 Likes

Now does this algorithm strictly create patterns only?

1 Like

No, it reads Color3 values from a 2-dimensional array and displays them. Here is it generating a random color image (192x108)


The total pixels in the array are the same as the frames created, so this is the worst-case scenario. It takes 6 seconds and 20736 frames, which is already worse than the above example.

1 Like

I overall think its pretty amazing.

1 Like

That is illegal please stop breaking roblox :frowning:

Very neat indeed!
Thanks for the link, I’ve never heard of greedy meshing, do you think it could increase performance in my application as well?

Also, I have to ask how in the world are you creating so many frames? In my testing, and on the account of others tests, it’s found that at a certain point gui objects will stop rendering to save on memory.

Any idea’s on why your scene specifically defies those previous tests?

1 Like

I thought it might’ve been because I was using a SurfaceGui, so I painstakingly rendered 62500 (250x250) pixels to a ScreenGui and found that no, it still works.

I also did a test on the client with only ~26k frames (I got bored and left) and while it was hideously slow it still rendered every object.

However, with paxels (6250 frames):

It doesn’t render all of the frames.