<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amirhossein Dehghanazar</title>
    <description>The latest articles on DEV Community by Amirhossein Dehghanazar (@amirhosseindehghanazar).</description>
    <link>https://dev.to/amirhosseindehghanazar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4069283%2F0d533f6f-c25b-417a-8371-3bc05155a132.jpg</url>
      <title>DEV Community: Amirhossein Dehghanazar</title>
      <link>https://dev.to/amirhosseindehghanazar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amirhosseindehghanazar"/>
    <language>en</language>
    <item>
      <title>How I Built a 60 FPS 404 Page With Live Video Background Removal</title>
      <dc:creator>Amirhossein Dehghanazar</dc:creator>
      <pubDate>Sat, 08 Aug 2026 21:31:24 +0000</pubDate>
      <link>https://dev.to/amirhosseindehghanazar/how-i-built-a-60-fps-404-page-with-live-video-background-removal-25bb</link>
      <guid>https://dev.to/amirhosseindehghanazar/how-i-built-a-60-fps-404-page-with-live-video-background-removal-25bb</guid>
      <description>&lt;p&gt;Most 404 pages are boring.&lt;/p&gt;

&lt;p&gt;You spend hours designing the actual website, animations, interactions, and visual identity — and then when someone visits a URL that doesn't exist, they get:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;404 — Page Not Found&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I wanted to see if I could make that experience feel like an actual part of the website instead.&lt;/p&gt;

&lt;p&gt;So I built a 404 page with &lt;strong&gt;four animated 3D characters&lt;/strong&gt;: a shark, cactus, raccoon, and a completely unhinged duck.&lt;/p&gt;

&lt;p&gt;The visual part was fun.&lt;/p&gt;

&lt;p&gt;The difficult part was making it run smoothly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea
&lt;/h2&gt;

&lt;p&gt;Instead of rendering the characters as heavy real-time 3D scenes, I experimented with using &lt;strong&gt;video&lt;/strong&gt; and processing it directly in the browser.&lt;/p&gt;

&lt;p&gt;The goal was simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Animated 3D characters&lt;/li&gt;
&lt;li&gt;Transparent-looking backgrounds&lt;/li&gt;
&lt;li&gt;Smooth rendering&lt;/li&gt;
&lt;li&gt;Around 60 FPS&lt;/li&gt;
&lt;li&gt;Minimal CPU/GPU usage&lt;/li&gt;
&lt;li&gt;No huge assets being downloaded&lt;/li&gt;
&lt;li&gt;Good performance on different devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The problem was that the videos naturally had backgrounds.&lt;/p&gt;

&lt;p&gt;So I needed to remove those backgrounds &lt;strong&gt;at runtime&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: live background removal
&lt;/h2&gt;

&lt;p&gt;The first obvious solution was to process the video at its original resolution.&lt;/p&gt;

&lt;p&gt;That worked visually, but it wasn't something I wanted to ship.&lt;/p&gt;

&lt;p&gt;Processing every frame at a high resolution means the browser has to do a lot more work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Video
  ↓
Frame processing
  ↓
Background detection/removal
  ↓
Rendering
  ↓
Next frame
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this happens continuously.&lt;/p&gt;

&lt;p&gt;At 60 FPS, you have roughly &lt;strong&gt;16.7ms per frame&lt;/strong&gt; if you want to maintain that target.&lt;/p&gt;

&lt;p&gt;Anything unnecessarily expensive quickly becomes noticeable.&lt;/p&gt;

&lt;p&gt;Especially on mobile devices.&lt;/p&gt;

&lt;h2&gt;
  
  
  The optimization
&lt;/h2&gt;

&lt;p&gt;The biggest improvement came from separating the &lt;strong&gt;processing resolution&lt;/strong&gt; from the &lt;strong&gt;display resolution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of processing the entire video at a large resolution, I reduced the resolution used for the expensive processing step.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;High-resolution video
        ↓
Lower-resolution processing
        ↓
Background removal
        ↓
Optimized result
        ↓
Scaled/rendered output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The processing step became considerably lighter while the final result could still be displayed at a much higher visual size.&lt;/p&gt;

&lt;p&gt;This was one of those cases where &lt;strong&gt;you don't necessarily need to process everything at the resolution the user sees&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You need enough information to produce a visually convincing result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I didn't just render everything in 3D
&lt;/h2&gt;

&lt;p&gt;I considered going down the full WebGL/3D rendering route.&lt;/p&gt;

&lt;p&gt;But for this particular experiment, that would introduce another set of problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More complex assets&lt;/li&gt;
&lt;li&gt;More runtime rendering&lt;/li&gt;
&lt;li&gt;More memory usage&lt;/li&gt;
&lt;li&gt;More implementation complexity&lt;/li&gt;
&lt;li&gt;Potentially heavier mobile performance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The characters were already animated, so video gave me a much simpler way to reproduce the final visual.&lt;/p&gt;

&lt;p&gt;The challenge was making the video behave like it had transparency.&lt;/p&gt;

&lt;h2&gt;
  
  
  The final result
&lt;/h2&gt;

&lt;p&gt;The final 404 page contains four characters that appear directly inside the page:&lt;/p&gt;

&lt;p&gt;🦈 Shark&lt;br&gt;
🌵 Cactus&lt;br&gt;
🦝 Raccoon&lt;br&gt;
🦆 Questionable duck&lt;/p&gt;

&lt;p&gt;And the result feels much more like an actual designed experience than a traditional error page.&lt;/p&gt;

&lt;p&gt;The goal wasn't to build a production-ready rendering engine.&lt;/p&gt;

&lt;p&gt;It was to see how far I could push a small frontend experiment while keeping the experience smooth.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;The biggest lesson was that &lt;strong&gt;performance optimization isn't always about making the final output smaller&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Sometimes the better approach is to make the expensive intermediate steps cheaper.&lt;/p&gt;

&lt;p&gt;In this case, reducing the processing resolution made a surprisingly large difference while having a relatively small impact on the perceived visual quality.&lt;/p&gt;

&lt;p&gt;It also reminded me that browser performance is often about finding the right balance between:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;quality × computation × memory × frame time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You don't necessarily need the most technically complicated solution.&lt;/p&gt;

&lt;p&gt;You need the solution that produces the result you want within the constraints of the device.&lt;/p&gt;

&lt;h2&gt;
  
  
  Open source
&lt;/h2&gt;

&lt;p&gt;This started as a random experiment I built for fun.&lt;/p&gt;

&lt;p&gt;Once I saw how it behaved in the browser, I decided it would be more useful if other developers could play with it too.&lt;/p&gt;

&lt;p&gt;So I open-sourced the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/AmirhosseinDehghanazar/3d-404-page" rel="noopener noreferrer"&gt;https://github.com/AmirhosseinDehghanazar/3d-404-page&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The repository is definitely not perfect.&lt;/p&gt;

&lt;p&gt;It started as a fun experiment rather than a production project, so there are probably plenty of things that could be improved.&lt;/p&gt;

&lt;p&gt;I'd especially love feedback on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Browser performance&lt;/li&gt;
&lt;li&gt;Mobile optimization&lt;/li&gt;
&lt;li&gt;Rendering architecture&lt;/li&gt;
&lt;li&gt;Video processing&lt;/li&gt;
&lt;li&gt;Memory usage&lt;/li&gt;
&lt;li&gt;Better approaches to background removal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you find something that could be improved, feel free to open an issue or contribute.&lt;/p&gt;

&lt;p&gt;Sometimes the most interesting projects start as something you build just because you wondered:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"What if I tried this?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And that's exactly how this one started.&lt;/p&gt;

</description>
      <category>animation</category>
      <category>frontend</category>
      <category>javascript</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
