
WebGL Performance: Rendering Millions of Polygons at 60fps
Building a photorealistic 3D experience in the browser is one thing. Making it run smoothly at 60fps on a mid-range smartphone is another challenge entirely. At b/ackcode, performance optimization is not an afterthought — it's a core part of our development process from day one.
The first principle is to minimize draw calls. Every time the GPU switches between materials or geometries, there's a performance cost. By batching similar objects, using texture atlases, and implementing GPU instancing for repeated geometries, we've reduced draw calls by up to 80% in production configurators.
Texture management is equally critical. A single uncompressed 4K PBR material set (albedo, normal, roughness, metalness) can consume 64MB of VRAM. We use Basis Universal compression to reduce this to under 4MB while maintaining visual quality. Combined with progressive loading and mipmapping, textures load instantly and render efficiently at any distance.
Level of detail (LOD) management ensures that the GPU spends its resources where they matter. A watch case viewed up close needs every polygon. The same case in a thumbnail view can use a simplified mesh with 90% fewer triangles. Our automatic LOD system transitions seamlessly between detail levels based on camera distance.
Shadow rendering is often the biggest performance bottleneck. We use cascaded shadow maps for large scenes and contact-hardening soft shadows for close-up product views. For configurators where lighting is controlled, we pre-bake ambient occlusion and use screen-space reflections instead of ray-traced alternatives.
The result: our configurators consistently hit 60fps on Chrome, Safari, and Firefox — even on 3-year-old smartphones. Performance isn't about having the latest hardware; it's about making smart engineering decisions that respect every user's device.