DEV Community

Anna Villarreal
Anna Villarreal Subscriber Community Curator

Posted on

Catbot Skin Update and Performance Optimization 🪞

Dropping draw calls from 347 to 47 for 220 FPS

I had previously written a post about an attempt to create Catbot's fur by hand, and I was making progress. However today it occurred to me that this was going to be a complete performance destroyer, and I can't allow that. I re-thought his appearance by attempting to describe the aesthetic with more solid shapes - such as the bulking of his skin - and adding a few wild hairs. I wanted Catbot to be able to run under less than ideal conditions, or on lesser hardware.

I had to add rear knees to Catbot so that he would stop sitting awkwardly.

before knees

Before knees were added - awkward

after knees added to catbot

After knees are added, he sits more regularly

Catbot is now more detailed, and the new skin now allows for adjusting settings on the fly. Optimizing the drawing of Catbot and reduces pieces was the key. Here is the breakdown:

What Before (v6) After (v7)
Draw calls per frame 347 47 (−86%)
Separate mesh pieces 339 14
Materials 242 35
Image data 12.9 MB 0.7 MB
File size 20.7 MB 9.0 MB, and 6.9 MB for the app version
Triangles 147k 130k

Cutting the draw calls allows him to run at 220 FPS in chrome - leaving headroom for fancy ideas like voice engines and future additions. I also had Claude check for unused garbage code and deleted things that were no longer being used. Catbot has undergone many transformations. 😹

I can pull up Catbot in my browser and sit him next to desktop Catbot. 😂 Hmm. Perhaps I see if they can have a conversation?

two catbots

Catbot web and Catbot desktop

I think I'll take a break from working on his appearance for now, although he probably could use a snack and a solid brushing. 😹 At least he looks relatively happy.


I am thinking of sharing a discord server where we can chat about personal desktop pets. Would anyone take an interest in that?

Top comments (10)

Collapse
 
sinarezaei profile image
Sina Rezaei •

The draw-call reduction is impressive, but there's another performance detail I'd be curious about: how stable is that 220 FPS under different rendering conditions? I've seen Three.js scenes where batching dramatically reduces CPU overhead, but GPU time barely changes because texture sampling, transparency, or shadow passes become the next bottleneck.

For example, in a scene with thousands of repeated objects, InstancedMesh can cut thousands of individual submissions down to a handful, but it doesn't automatically solve overdraw or fragment-shader costs.

I'd be interested to see the frame-time p95 alongside the FPS, especially on integrated GPUs. That would give a much clearer picture of how well Catbot performs beyond the development machine.

Collapse
 
annavi11arrea1 profile image
Anna Villarreal •

Thanks for your comment, @sinarezaei ! Im gonna have to get back to you on that. Interesting idea!

Collapse
 
visionwei profile image
Wei Bin •

The draw calls dropping from 347 to 47 is the number that made me stop scrolling, Anna. That is optimization a user feels, because 220 FPS in Chrome leaves headroom for fun ideas instead of rendering. The rear knees are my favorite detail: a small fix that makes him sit properly. Would you open that Discord server for desktop pets?

Collapse
 
annavi11arrea1 profile image
Anna Villarreal •

thats kinda what i was aiming for - ai pet server basically. i was getting everything set up for that :) thought it would be fun to share ideas and maybe even have the bots talk amongst themselves haha

Collapse
 
visionwei profile image
Wei Bin •

An AI pet server is a great target for that kind of optimization — if the idea is a bunch of pets sharing one space, then the per-pet cost is everything, and 347 down to 47 is the difference between "ten pets and the frame rate dies" and "a whole room of them". So the draw call number isn't just a nice stat, it's what makes the server idea actually workable.

And "have the bots talk amongst themselves" is the part I'd want to see most. Is that idle chatter for charm, or would they actually have something to say to each other — like one pet reacting to what another one just did? The second version is much harder, but it's also the one that would make someone stay and watch.

What stage is the server at — are the pets living server-side with real state, or is it mostly the rendering side so far? Either way, fun idea, and I'd love to see where the bots-talking-to-bots part goes.

Picked as gem Thread Thread
 
annavi11arrea1 profile image
Anna Villarreal •

Me too! I think I'll work on this more soon. Thanks for the inspiration. Have you built a pet bot?

Collapse
 
yingtse profile image
printfapps •

I did not see how you create the 3d model in the 8 articles in this series..

is it totally generated by AI, or generated by AI and then edit it in some software, I'm interested in what edit software you are using

Collapse
 
alexcodebytes profile image
Oleksandr •

347 to 47 draw calls is a pretty impressive improvement. I especially like that you didn't just keep adding detail and hope the hardware could handle it — you reconsidered how the character was built instead. That's a much more sustainable approach than optimizing after performance becomes a problem.

There's also something interesting about the 220 FPS result: you've created room for the features that could make Catbot feel more alive, rather than spending all the available performance on appearance. I'd definitely be interested in seeing two Catbots interact. A conversation between the desktop and browser versions sounds like a fun next experiment! 😄

Collapse
 
gautamtalksdev profile image
Gautam K •

The performance work is the part I always find most satisfying. Nice to see the before and after. Did you measure frame time on lower-end devices too?

Collapse
 
annavi11arrea1 profile image
Anna Villarreal •

man, everyone on here is so thorough with there questions! I have several devices I could test on. Maybe I will do that when I find some time in the near future! Thanks for the encouragement, @gautamtalksdev !