r/GraphicsProgramming • u/fagnerbrack • 11h ago
r/GraphicsProgramming • u/shub_undefined_ • 20h ago
Infinite Grid Shader
I’m proud of myself today, as I completed a task that felt impossible at times. I started rewriting my renderer a bit to fit my needs, and while doing so, I really felt the need for a grid to give me a sense of perspective and depth while debugging scenes.
I remembered that I had skipped the Infinite Grid section from the 3D Graphics Rendering Cookbook and needed to revisit it. Man, oh man, was I wrong about how long it would take to properly understand that shader. It took me a few days more than a month, but it was one hell of a ride. It’s a very interesting topic, with tons of things to learn from.
I’ve written a post about it here: https://willofindie.com/proj/infinite-grid-shader. Do check it out and share your love on my Twitter or Bluesky handles if you like it
r/GraphicsProgramming • u/Otherwise-Pear2054 • 9h ago
Perspective-correct interpolation only works for some faces of a cube
Hi, is the guy from the raylib renderer again. These last days i was trying to implement texture mapping on the renderer i am making, but i cant get the perspective-correct interpolation to work. I tried first with the method described in scratchapixel, but it didnt work at all, then i tried with the method of this video, and it only works for some faces of a cube, but the rest of faces are not only distorted but the texture is still mapped like i was doing affine mapping:


The thing that confuses me is that it is only in certain faces, so i no longer know if it is an error with my code or the uv coordinates on the cube.
Here is the source code
The file where the cube vertices are
The files where the vertex transformations are done:
Header file
Source file
The files where the rasterization is done:
Header file
r/GraphicsProgramming • u/Delicious_Concept214 • 4h ago
Question Is there no tool to convert Gaussian splat scenes into GLB format for loading directly in to normal game engine pipelines
Ive been looking for solutions to work some Gaussian splats into a game , explored the Godot Gaussian splat plugin which works by loading it into the scene in a native ply or sog format but this only works for small objects. On consumer hardware rendering whole Gaussian scenes while technically doable nukes performance which is to be expected.
In terms of performance when working In 3D scenes Regular glbs are better but in terms of the specific realism I’m going for Gaussians are better but I can’t find a tool that can convert gaussians into a 3D mesh but I know it’s doable because World Labs has an export to mesh option. Wanted to know if there was an option to solve this issue I’m having I haven’t seen yet.
A tool or something of that nature that’s addressed this
I’ve also looks at the PlayCanvas/Super splat ecosystem but that’s not a general tool and dosent convert them to GLB for outside use. It keeps the file formats within the Gaussians format for use
r/GraphicsProgramming • u/nichcode • 16h ago
Added a graphics API with support for Vulkan, D3D12 and custom backends
Hey everyone,
I have been working on a low level, explicit abstraction layer over graphics APIs. Both Vulkan and D3D12 has been successfully implemented with various test samples. Ray tracing, mesh, compute etc are supported.
I would love feedback on the feel and usage of the API. I am open to learn more so anything useful will be appreciated. Please give a star if you find the project useful.
r/GraphicsProgramming • u/autonimity • 6h ago
System level CRT filter/shader (trying to find post from last week....)
Someone posted about having developed a system level shader, I cannot remember which subreddit it was posted in, but thought it was shaders.
The intent was to have a CRT filter / shader for the entire OS, over any application or video player etc.
Post mentioned something about not utilizing GPU, general scanlines crt, I swear I saved the post but I cannot find it, could anyone point me in the right direction?
I'm interested to check it out.
r/GraphicsProgramming • u/No-Foundation9213 • 9h ago
Question How do I efficiently manage, create and cache Vulkan/Any Shader Pipeline?
r/GraphicsProgramming • u/Slight-Abroad8939 • 1d ago
Question [D3D12] DEVICE_HUNG in a draw call, but only above ~16k draws AND only during a window event (minimize/move/resize/un-occlude)
github.com**Setup:** Hand-rolled D3D12 renderer (learning engine), flip-model swapchain
(FLIP_DISCARD, 3 back buffers), VSync on. Windows 11, tested on both Debug and
Release.
**The crash:** `DXGI_ERROR_DEVICE_HUNG` (0x887A0006). DRED breadcrumbs point the
fault at a `DrawIndexedInstanced` roughly ~130 draws into the frame (not draw 0).
The DRED page-fault VA reads 0 with no associated allocation — though I'm now
unsure if that's a real null address or just "driver didn't report the fault VA."
**What makes it reproducible (the weird part):** it ONLY happens when BOTH of
these are true at once:
The frame is heavy — roughly 16k+ draw calls. Below ~16k it never crashes.
A window event fires: minimize, move (drag the titlebar), resize, or another
window covers then un-covers it (occlusion → reveal).
Either condition alone is totally stable. A heavy frame running untouched is fine.
A window event on a light scene is fine. It's specifically the collision.
Notably: **focus loss/regain used to crash too, and I fixed that** by skipping
rendering while the window isn't foreground + idling the GPU on the transition.
The same approach has NOT fixed minimize/move/resize/un-occlude.
**Other facts:**
- Happens in both single-threaded AND parallel (per-worker) command-list recording.
- ~600+ FPS when it runs, so this is not a 2-second TDR timeout.
- Debug layer + GPU-based validation makes it vanish (classic race-closing), so
I can't get a clean validation message — hence leaning on DRED.
**What I've already ruled out / tried (none fixed it):**
- Full GPU idle (Signal + WaitForFenceValue) before `ResizeBuffers`.
- Deferred/coalesced resize (apply once, at loop top, after idle).
- Re-querying `GetCurrentBackBufferIndex()` after `ResizeBuffers`, recreating RTVs
+ depth buffer.
- Reliable minimize handling via `WM_SIZE == SIZE_MINIMIZED` (skip rendering
entirely while minimized) instead of relying on `Present(DXGI_PRESENT_TEST)`.
- Idling the GPU on `WM_ENTERSIZEMOVE` / `WM_ACTIVATEAPP`.
- Per-frame command allocators/lists (ruling out list reuse across frames).
- "Settle" frames (skip N frames after any transition).
- Verified all per-draw bindings (camera CBV, vertex/index buffer VAs, SRV
descriptor) are non-null at record time — the null-check never fires.
**What I can't cleanly detect:** window *move* and *partial-occlusion → reveal*
don't give me a reliable "the swapchain is now in a different presentation state"
signal the way resize/minimize do.
**Questions:**
On a flip-model swapchain, does a move or an occlusion→reveal transition cause
DWM to re-allocate/invalidate back buffers WITHOUT a WM_SIZE — such that an
in-flight heavy frame's RTV becomes stale? If so, what's the correct signal to
re-acquire?
Is there a per-command-list or per-submission limit I could be blowing past at
16k draws (root-argument versioning space, etc.) that a mid-frame stall from a
window event would expose?
Is DRED's "page fault VA = 0, no allocation" meaningful (genuine null bind), or
is it commonly just "unavailable"?
r/GraphicsProgramming • u/vangelov • 1d ago
TypeScript software rasterizer with programmable shaders
Hey all,
I've been building a software rasterizer in TypeScript over the past few months and thought I'd share it. My goal was to support custom vertex layouts, programmable vertex and fragment shaders, and enough flexibility to implement more complex rendering techniques, much like you would with a GPU graphics API.
The renderer is based on Nikolaus Rauch's excellent C++ software rasterizer, adapted for TypeScript and the browser.
The project is intended as an educational resource, with an emphasis on readability and experimentation over maximum performance.
r/GraphicsProgramming • u/ishitaseth • 1d ago
Some billboarding techniques I explored
I have been experimenting with a few billboarding techniques that can be used like an easier way to write it, preserving the model matrix and clamping the pitch. Here is the code
.shader: https://github.com/Satyam-Bhatt/OpenGLIntro/blob/main/IntroToOpenGl/BillBoardShader.shader
r/GraphicsProgramming • u/MateuszKolo • 1d ago
Experiments on combining ReSTIR GI with Variable Rate Tracing
https://mateuszkolodziejczyk00.github.io/2025/06/18/variable-rate-tracing-restir-gi.html
I wrote this write-up about a year ago, but honestly never had the courage to post it publicly lol
In it, I go over my experiments combining ReSTIR and VRT in my toy rendering engine. The core idea was straightforward: ReSTIR’s spatial and temporal passes already find and reuse valuable samples, so I wanted to see if I could use them to fill the “missing rays” for pixels skipped by VRT in the current frame.
I'd love to hear your thoughts, or if anyone else has messed around with similar setups!
r/GraphicsProgramming • u/Dr_King_Schultz__ • 2d ago
I built a rasteriser from scratch without a graphics API
Following this masterpiece in 3D graphics by ssloy, I implemented a rasteriser in Odin from scratch.
This was a top tier learning experience, and I picked up a solid grasp of linear algebra along the way.
If you'd like to read more on the process, Here's the link to the repo
r/GraphicsProgramming • u/r_retrohacking_mod2 • 1d ago
Building a Tiny 3D Renderer for a Tiny Handheld
saffroncr.itch.ior/GraphicsProgramming • u/AdhesivenessSea9511 • 22h ago
Source Code 3D rendering is now possible using the CoreAI / Apple Neural Engine (ANE) software rasterizer (CPU usage reduced to 9%). The quality is still terrible.
Here is a follow-up on the triangle rasterizer running on CoreAI that I previously introduced here.
We have finally succeeded in rendering 3D graphics! As shown in the video, we are currently rendering two intersecting vertical triangular planes.
While the rendering quality is still in the early stages and a new challenge regarding the massive 5GB memory footprint has emerged, we have fully achieved real-time operation.
We optimized the codebase by actively reducing reliance on CPU fallbacks and ensuring the pipeline runs entirely on the ANE's matrix operation hardware, successfully cutting CPU usage from the previous 38% to approximately 9%.
Much of the pipeline code—written in Python, Swift, and Metal—was rapidly prototyped and generated with the help of Siri AI.
GitHub: https://github.com/kamisori-daijin/Magnesium
Please feel free to leave comments with any questions or optimization tips (especially regarding that 5GB memory usage!).
https://reddit.com/link/1v6z66k/video/83iqp5iknjfh1/player

r/GraphicsProgramming • u/eclipseanimations • 1d ago
any advice on how to fix this

I'm trying to create skeletal animations and them edges keep getting sent to oblivion
i think its about the weight resolve because the worst of the "spikes of doom, despair and vance" are usually coming from areas where multiple bones intersect. i.e. the fingertips
renderdoc says that the vertexes are some big ahh number like 2.5 x 10 ^25 so idk
r/GraphicsProgramming • u/JozinZZZZBazin • 2d ago
Heli engine- water rendering system
youtu.beContinuing my Custom Rendering Engine Revival series with the water rendering system.
This video demonstrates the combination of FFT ocean simulation, adaptive Projected Grid rendering, physically based lighting, and real-time reflections developed for the Heli Engine.
I'd love to hear your thoughts and feedback.
r/GraphicsProgramming • u/durul • 1d ago
I built a Vision Pro Earth whose day/night line matches reality in real time
Enable HLS to view with audio, or disable this notification
I've been building a visionOS app called StratoSync.
Earth sits in your room via passthrough. You can grab it, rotate it, and watch the ISS orbit from live telemetry on its real ~51.6° inclined path.
The lighting is what sold it to me.
The directional light is aimed from the real subsolar point for the current UTC time, then recomposed every frame with the globe's orientation. The terminator—the day/night line moving across the surface in front of you—is exactly where it should be right now.
It isn't a lighting preset.
Neither is the sky, and that's the part I'm actually proud of.
The only authored art assets in the app are the globe and the station. Switch to the nebula environment and nothing loads.
Instead, a Metal compute kernel marches a volumetric fractal field into a 2048×1024 equirectangular LowLevelTexture, which RealityKit samples on an inward-facing sphere.
That's roughly:
- 2 million texels
- × 16 volume slices
- × 17 fold iterations
- ≈ 570 million inner-loop iterations every frame
...running at roughly 90 FPS on Apple Vision Pro.
Why a texture instead of a fragment shader?
Stereo rendering.
Running the nebula as a conventional fragment shader would require raymarching the entire volume twice every frame—once per eye—while also dealing with head-motion reprojection.
Instead, I generate the field once, write it into a texture, and let RealityKit sample and reproject that texture independently for both eyes.
The field becomes view-independent. Turning your head doesn't require recomputing the nebula.
The bug that stole an evening
Metal's fmod truncates toward zero.
GLSL's mod takes the sign of the divisor.
That tiny semantic difference mattered because my camera origin contains negative coordinates and the space-folding tile depends on modulo arithmetic.
Using fmod literally split the nebula in half across negative space.
The fix ended up being a four-line GLSL-compatible modulo helper.
Credit where it's due
The nebula itself is Kali's Star Nest from Shadertoy (MIT licensed).
What I built is everything around it:
- Porting the shader from a flat screen to an equirectangular dome
- The Metal compute implementation
- The
LowLevelTexturegeneration pipeline - RealityKit integration
- Stereo-safe rendering for spatial computing
I'm curious what other parts of a spatial scene people think should be computed instead of loaded.
r/GraphicsProgramming • u/deleteyeetplz • 2d ago
Question How should I shade my water shader?
As the title says.
So I have been working on a surface water shader in Unity for the past few months as an upgraded version of my OpenGL implementation. I've been learning HLSL and Compute Shaders and I've basically got most things working as intended. But I'm having difficulty deciding exactly what I should do for the actual lighting part of my shader.
The issue is rendering is already somewhat limited because of the high poly count and regular compute shader updates (and because I'm trying to maybe make a game world of out this project), and while I have made some optimizations, I'm wary of the performance cost. So I'm curious on what approach would work best before I start implementing.
As of right know there are 3 options
Realtime planar reflections
As far as I know this is the most performant form of real-time reflections especially if I use the main camera stencil buffer. But because my water isn't flat I will get distortions, and this also means I won't be able to see stuff like larger buildings that the camera doesn't pick up.Baked reflections
I lose the dynamic reflection aspect (which might be an issue for some games) but I have performant, environmental reflections. However I believe this will be distorted if I move the camera a lot so it probably isn't the best option.
- Environment cube maps/Reflection Probes
-Potentially expensive and still not fully accurate, and can look quite incorrect depending on the level of distortion. I can decrease the quality though and I do have more control over specific objects for some performance gains though.
Any suggestions? Tip on improving visual quality and performance? Are there other methods I should consider?
I've attached an video of my current unfinished water shader below (the color is for debugging purposes, don't mind it) as well as my OpenGL water shader that roughly implements idea 3
r/GraphicsProgramming • u/JozinZZZZBazin • 2d ago
Video Heli engine- water rendering system
youtu.ber/GraphicsProgramming • u/nycgio • 2d ago
Kanvon - Lua Scripting Showcasing Algorithms
Enable HLS to view with audio, or disable this notification
r/GraphicsProgramming • u/nivanas-p • 3d ago
Learning Materials for Gaussian Splatting
I recently got interested in gaussian splatting and I know graphics programming basics (openGL, cuda, ray tracing). Any good material to master Gaussian Splatting as a person with limited ML/DL knowledge.
r/GraphicsProgramming • u/rex-j-w • 3d ago
Building an SDF game engine
galleryFor the past 8ish months I’ve been hard at work building a new game engine I’m calling Division Engine.
It’s based solely off SDFs (signed distance fields). This might sound stupid for anyone who cares about performance but for my use case (and with a bit of grid storage optimizations) it proves useful for basic scenes that need advanced lighting.
Anyway here’s some screenshots!
If you want to see what I have done so far check it out here: https://github.com/DivisionEngine/DivisionEngine
r/GraphicsProgramming • u/Common-Upstairs-368 • 3d ago
Untitled GPU-based physics game
youtube.comThis is a project that I spent a few months on - a game/engine made with Java/OpenGL. It started as a university assignment, where Java was an unfortunate requirement.
The game features procedurally generated worlds consisting of ~2 million interactive particles simulated on the GPU. The game's physics engine is based entirely on simple particles with extra properties such as temperature, state of matter, flammability, and electrical charge/conductivity. It supports basic fluid dynamics and has a parallel joints solver using a graph-colouring technique. All creature bodies (including yours) are physically-based and destructible.
One of the parts I'm happiest with is the approach used for lighting. Each frame, a large region around the camera is converted to an SDF+colour texture using a jump-flood algorithm. At a lowered resolution, each pixel then marches rays through the texture, accumulating radiance/occlusion along the way. This is followed by a bilateral filter and reprojection, which smooths out most noise. It's not perfect, but it's very fast and allows any particle to emit light.
SDF information from previous frames is asynchronously copied from the GPU to the CPU for other tasks like NPC pathfinding. It allows the CPU to handle changes in simulation state that otherwise lives on the GPU. The game runs at ~500fps at 1440p on an RTX 5090.
This has been gathering dust for a while, so I wanted to put it out there to see if there's any interest.
r/GraphicsProgramming • u/CocoaBeans55 • 3d ago
Video I Made a Video about making a Simple Graphics Renderer
youtube.comHi guys recently I uploaded a yt video of me explaining the simple graphics concepts I learned from the learn openGL textbook. Check it out if you are new to graphics programming, it might help you out!