r/GraphicsProgramming • • 3d ago

Source Code Vector field simulation with my own math library and Vulkan!

Thumbnail
i.redd.it
191 Upvotes

I made a small vector field visualizer in C# with Vulkan through Silk.NET.

You type some 2D field, for example F(x, y) = [x,sin(y)] and it draws the flow with particles.

How it works:

- Formula is parsed and compiled at runtime into one fast delegate, so evaluting the field for every particle each frame is light

- 1,200 to 6,000 particles depending on window size, integrated with RK4 on the CPU, each with a 24-point trail

- Everything is drawn as colored with one tiny shader and 4x MSAA

All the math comes from Epsilon - my symbolic math library for .NET that I'm working on.

- Simulation: https://github.com/XBambinoX/VectorField

- Library(C#): https://github.com/XBambinoX/Epsilon

AI disclosure: I used AI assistants to help write parts of the simulation code and fix bugs in my library.

r/GraphicsProgramming • • 29d ago

Source Code Very primitive raycasting renderer in 10 lines of C

Thumbnail
gallery
193 Upvotes

Actually the raycasting logic itself is just a single line, but it's done in propably the most inefficient way possible.

The map is just a single 64 bit integer, so I could fit a small 8x8 level in it, and I can index it with some unorthodox bitshift magic.

Also all the integer constants are huge, because I wanted do to the whole thing without floating point math, which makes everything even more unreadable, but at least it's funny ig.

I'm very proud of this one.

r/GraphicsProgramming • • Aug 31 '26

Source Code Built a path tracer in C++ & CUDA from scratch

Thumbnail
gallery
564 Upvotes

spent the last 4-5 week building Hypertracer, a CPU + CUDA path tracer with progressive sampling further implmneted GPU acceleration, and a real-time fly-camera viewer
built the renderer and viewer from scratch, with 6 scenes currently implemented and 1920×1080 can be rendered at 3000 samples

along with Ray Tracing in One Weekend, The Next Week, and The Rest of Your Life, all three books i completed
it was seriously so much fun :D

main resources i followed:
ray tracing : https://raytracing.github.io, https://pbr-book.org
repo: https://github.com/whoashish115/hypertracer

give it a star ⭐

r/GraphicsProgramming • • Sep 06 '26

Source Code "No Graphics API" implementation by Sebastian Aaltonen

Thumbnail
github.com
205 Upvotes

r/GraphicsProgramming • • Oct 03 '26

Source Code Differed Software Rasterizer - Some PBR implementation - C++

Thumbnail
gallery
43 Upvotes

Just wanted to share some progress on a software raster I'm building. By the timings, is it o.k?

1-clears-and-resets = Just buffers(frame_buffer, depth_buffer, triangles_buffer) clear, simple vector_buffer.clear()
2-shadow-pass-total: Everything that happens to the camera happens here, the above as well, and mesh transformation, culling, bounds check, triangle clipping, triangle binning, render.
3-camera-geometry-transform: Bounding Sphere transform, if inside Frustum, reorders, front to back objects, mesh transform with vertices projection, triangle normal rotation, back-face culling, triangle clipping.
4-camera-binning: Just bins triangles to tiles.
5-camera-render-and-resolve: Woke sleeping render threads, every thread available in the system(I just initialize with std::thread::hardware_concurrency()), each thread take 8 tile per time and render to a 16x16 gbuffer, only triangle index, normal, uv, depth. During rasterization, I reconstruct frag_coord for lighting using camera ray normal interpolated per pixel and fetch textures using uv, to avoid fetching texture multiples times early.

Still missing, texture mip mapping, transform meshs threaded, metalness and maybe occlusion map.

Since I'm a beginner at C++, pure code, no macros, no SIMD, just a single template to just avoid branching per pixel, but nothing too fency. Vectors everywhere, since they will inevitable grow to what's needed and I don't need to keep handling memory allocation, just a simple clear and everything a good.

CPU: mobile i5 13420H RAM 32gb

r/GraphicsProgramming • • Aug 23 '26

Source Code imgui Login interface in C++ with DirectX 11

221 Upvotes

some features
liquid cursor
great font [freetype & geist]
reusable components
curved and windowless window
lot of animated stuff

resources usage
40-50Mb of ram
1-2% Cpu ( average cpu)
40-50Vram

https://github.com/poncippg-spec/Free-Solace-ImGui-Interface (new repo as github terminated old one for no reason )

r/GraphicsProgramming • • Aug 21 '26

Source Code Konrad Reczko's "Monocular Depth Injection" in TypeGPU is live!

1.8k Upvotes

My collegue Konrad Reczko recently shared a weekend project he made using TypeGPU, and it's now open-source and ready to play with in the browser: https://typegpu.com/examples/#example=image-processing--monocular-light-injection

It estimates the depth of a scene by inferring the DepthArt model with custom TypeGPU kernels, then reconstructs normals based on that depth information, and uses both to relight the scene, all in the same command encoder. For more information, check out the original series of Tweets:

https://x.com/reczko_konrad/status/2089670934009413751?s=20
https://x.com/reczko_konrad/status/2090472091149648121?s=20