r/GraphicsProgramming • u/GreenScreen410 • Jul 18 '26
r/GraphicsProgramming • u/Important_Earth6615 • Jul 17 '26
Article How to render good looking UI elements
I spend last two months optimizing, enhancing the look of my UI library (Lumora) for my game engine. Last two days I have been writting my findings on how render good looking containers, what techniques did I use,...etc. https://alielmorsy.github.io/how-to-build-ui-elements/
r/GraphicsProgramming • u/Apprehensive_Gas308 • Jul 17 '26
From CPU-rendered paths to GPU shaders: rebuilding a smooth moving map renderer with DirectX
I wanted to share a rendering improvement I recently made for a real-world visualization problem.
This started as a feature inside my cycling video editor. The goal was to display a local moving map HUD synchronized with GoPro footage and GPS telemetry.
The first implementation used a traditional Direct2D rendering approach. It worked well for static rendering, but when the map started continuously rotating and following the moving position, I noticed some limitations:
- less consistent frame pacing during rotation
- increasing CPU workload as the track complexity grew
- harder to maintain smooth motion for long GPS trajectories
I decided to rebuild the renderer using DirectX and shaders.
The new pipeline:
GPS trajectory data
→ local coordinate transformation around current position
→ GPU vertex buffer
→ shader-based rendering
→ real-time camera rotation and movement
Instead of drawing the path as a series of CPU-generated lines, the track is represented as GPU-friendly geometry.
The renderer generates a ribbon mesh from the centerline:
center points
→ left/right offset vertices
→ triangle strip
→ vertex/pixel shader rendering
The biggest improvement was not only raw frame rate, but the overall feeling of motion.
The old renderer could display the path correctly, but during continuous camera rotation the movement felt less consistent.
The shader version provides much smoother camera-relative motion, similar to how a game minimap behaves.
For long GPS recordings, I also avoid keeping the entire route active in the rendering pipeline.
The renderer only keeps the visible area around the current position plus a buffer region, allowing very long activities without continuously processing the full trajectory.
The video compares the previous Direct2D implementation and the new DirectX shader renderer running on Windows.
I am interested in feedback from people working with:
- GPU path rendering
- real-time map visualization
- game minimap rendering
- trail/ribbon rendering
- large dynamic geometry
A few things I am still exploring:
- Would moving the ribbon expansion completely into compute shaders make sense for this type of workload?
- What are common approaches for very long dynamic GPS paths?
- Are there better techniques for smooth camera-relative map rendering?
Thanks for any feedback!
r/GraphicsProgramming • u/Trick-Pie727 • Jul 18 '26
Source Code Real-time WebGL VRAM purging & Garbage Collection: Running 60FPS Three.js inside a monolithic PHP architecture to bypass iOS Safari crashes.
Hey everyone,
I recently engineered a custom 3D WebGL portfolio and ran into aggressive Out-Of-Memory crashes on iOS Safari (TBDR architecture) due to the sheer volume of high-res textures.
Instead of using a Headless SPA (Next.js/React), I opted for a monolithic PHP architecture with full-page reloads. This offloaded 100% of the WebGL memory disposal risk directly to the browser's native garbage collector, instantly guaranteeing stability between route changes.
To maintain 60FPS during active rendering, I implemented two specific systems:
1. Custom FPS Governor: A dynamic performance engine that forcefully strips roughnessMap, metalnessMap, and normalMap properties on the fly if it detects thermal throttling or frame drops. 2. Absolute VRAM Purging: Intercepting the IntersectionObserver to physically strip the src attribute of off-screen elements and force a .load() cycle to aggressively flush VRAM buffers.
👉 Core FPS Governor Logic (Gist):https://gist.github.com/MedhatAlkadri/ea99a0f7aa47c69198f2d1ae84a20e53👉 Live Demo:https://www.awwwards.com/sites/medhat-alkadri-3d-portfolio
As a Full Stack Developer stepping deeper into graphics programming, I'd appreciate any architectural critiques on this render loop or alternative approaches to handling aggressive VRAM limits on mobile browsers.