<?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: Ismoiljon Umarov</title>
    <description>The latest articles on DEV Community by Ismoiljon Umarov (@umaarov).</description>
    <link>https://dev.to/umaarov</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2624962%2F0c9f08bd-ee10-44c7-aa6f-bd761d93c811.png</url>
      <title>DEV Community: Ismoiljon Umarov</title>
      <link>https://dev.to/umaarov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/umaarov"/>
    <language>en</language>
    <item>
      <title>I put a real-time 3D Engine in my PHP app.</title>
      <dc:creator>Ismoiljon Umarov</dc:creator>
      <pubDate>Sat, 09 Aug 2025 19:13:20 +0000</pubDate>
      <link>https://dev.to/umaarov/i-put-a-real-time-3d-engine-in-my-php-app-35jo</link>
      <guid>https://dev.to/umaarov/i-put-a-real-time-3d-engine-in-my-php-app-35jo</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4mqtv6nlh953fz2onllq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4mqtv6nlh953fz2onllq.png" alt="3d achievement badges on user profile" width="800" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hey everyone,&lt;/p&gt;

&lt;p&gt;What if a simple social media site felt more like a game? What if user achievements weren't just static icons, but interactive 3D objects you could actually play with?&lt;/p&gt;

&lt;p&gt;I had this crazy idea while working on my latest project, GOAT – an open-source social debate platform. I wanted to reward users in a way that felt substantial and cool, not just another boring badge.&lt;/p&gt;

&lt;p&gt;So, I decided to build a real-time 3D rendering engine right inside my Laravel application.&lt;/p&gt;

&lt;p&gt;Live Demo: &lt;a href="https://goat.uz/@goat" rel="noopener noreferrer"&gt;https://goat.uz/@goat&lt;/a&gt;&lt;br&gt;
GitHub Repo: &lt;a href="https://github.com/umaarov/goat-dev" rel="noopener noreferrer"&gt;https://github.com/umaarov/goat-dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It sounds a bit nuts, I know. Here’s a breakdown of how I made it work without melting the user's browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Stack for a Crazy Idea&lt;/strong&gt;&lt;br&gt;
The core of the app is pretty standard: a solid Laravel 12 backend serving a Vite-powered frontend. The magic happens with a few extra ingredients:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Three.js / WebGL / GLSL: The workhorse for all things 3D in the browser.&lt;/li&gt;
&lt;li&gt;Web Workers: The key to not freezing the UI.&lt;/li&gt;
&lt;li&gt;C++ &amp;amp; WebAssembly (WASM): For when JavaScript just isn't fast enough.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The How-To: 3D in a PHP World&lt;/strong&gt;&lt;br&gt;
The main challenge wasn't just displaying a 3D model. It was doing it in a way that didn't destroy the app's performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The Performance Problem&lt;/strong&gt;&lt;br&gt;
My first attempt was simple: load a model with Three.js on the profile page. It worked, but it was janky. Complex models with nice lighting and effects caused noticeable lag on the main thread, making the whole site feel slow. That was a deal-breaker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Solution: Offload Everything to a Web Worker&lt;/strong&gt;&lt;br&gt;
The fix was to move the entire 3D rendering logic into a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API" rel="noopener noreferrer"&gt;Web Worker&lt;/a&gt;. This means all the heavy calculations—the scene setup, the lighting, the render loop—happen on a completely separate CPU thread.&lt;br&gt;
The main page just creates the worker and gives it a canvas to draw on. The worker does all the hard work and posts the rendered image back. The result? The main UI stays buttery smooth, no matter how complex the 3D scene is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Extra Power: C++ and WebAssembly (WASM)&lt;/strong&gt;&lt;br&gt;
For some really intense geometry calculations (like custom modifiers or physics), even JavaScript inside the worker was hitting its limits.&lt;br&gt;
So, I identified the most performance-critical functions and rewrote them in C++. I then used the Emscripten toolchain to compile the C++ code into a highly-optimized WebAssembly (WASM) module.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It's Not Just 3D&lt;/strong&gt;&lt;br&gt;
On top of the rendering engine, I also integrated Google's Gemini Pro API for content moderation and used the Stable Diffusion AI (via Cloudflare) to let users generate their own unique profile pictures from a text prompt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Result&lt;/strong&gt;&lt;br&gt;
After months of work, it's finally live! I'm super proud of how it turned out. It’s proof that you can build really rich, interactive experiences with a "traditional" backend like Laravel if you're willing to get creative on the frontend.&lt;/p&gt;

&lt;p&gt;This is an open-source project, so I'd love to hear what you think. Any feedback is welcome, and if you like the project, a star on GitHub would absolutely make my weekend!&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
