r/GraphicsProgramming • • Jan 09 '26

I'm open-sourcing my audio-visual software after 3-years

Post image
214 Upvotes

For the past 3 years, I’ve been building some audio visual software.

It allows you to create visuals using web technologies like WebGL, Three.js, p5, and pretty much anything that runs in the browser.

The software tackles a complex problem by offering a user friendly middleware for composing scenes across JavaScript files and reacting to incoming signals from MIDI, OSC, or similar sources. My hope is that it helps people explore code first visuals without running into unnecessary complexity.

For more technical users, the software bundles single file modules into a folder of your choice. The only dependency is an SDK import that points to precompiled dependencies and assets included with the software. This lets people use their preferred libraries without needing Webpack, npm, or other setup steps. It is designed to be very plug and play.

Up until now, this is what I’ve been using to perform at exhibitions and live events. This year, I’m open sourcing the entire repository so anyone can use it or contribute.

I’ve shared clips of my modules here over the years, and the most common request has been for more information and access to the code. So here we are.

If you’d like to check it out or contribute, you’re more than welcome.


r/GraphicsProgramming • • Jun 14 '25

Source Code I made a Triangle in Vulkan!

Post image
214 Upvotes

Decided to jump into the deep-end with Vulkan. It's been a blast!


r/GraphicsProgramming • • Feb 02 '25

r/GraphicsProgramming Wiki started.

214 Upvotes

Link: https://cody-duncan.github.io/r-graphicsprogramming-wiki/

Contribute Here: https://github.com/Cody-Duncan/r-graphicsprogramming-wiki

I would love a contribution for "Best Tutorials for Each Graphics API". I think Want to get started in Graphics Programming? Start Here! is fantastic for someone who's already an experienced engineer, but it's too much choice for a newbie. I want something that's more like "Here's the one thing you should use to get started, and here's the minimum prerequisites before you can understand it." to cut down the number of choices to a minimum.


r/GraphicsProgramming • • Sep 19 '24

Article DirectX is Adopting SPIR-V as the 'Interchange Format of the Future"

Thumbnail
devblogs.microsoft.com
214 Upvotes

r/GraphicsProgramming • • Oct 15 '26

Video After many days of learning, finally.

212 Upvotes

After many days of learning and scratching my head around, I was finally able to render a triangle on a screen. I am using Vulkan 1.4 for this. Although I learned this from a youtube channel called constref, but this is a very valuable lesson for me, even if it is a first step to Vulkan.


r/GraphicsProgramming • • Sep 11 '26

it's more than i expected

Thumbnail
gallery
212 Upvotes

everyone recommended the raytracing in 1 weekend and i spent several weekends studying it and i made this. i played around with the 2 balls and surprisingly discovered it's very easy to generate fractal patterns if you let the 2 balls intersect

i need help so let me explain what i did and what problems i'm facing

it's just a very basic raytracing program for studying purpose (i'm not a student and this is not my homework. i study raytracing for fun). the "world" consists of 2 balls and they don't have any colors or textures info in themselves. they only have positions, sizes and refractive indices. i intentionally setup as few parameters as possible to avoid complications

the background is located at infinity. it's the only light source / color source of the scene. if you look around 360° horizontally you'd see red then green then blue then back to red. if you look up you see light. if you look down you see darkness

if 2 balls intersect, the refractive index of the intersecting region is simply the arithmetic mean of the 2 balls. it's not a precise thing as i googled it and there're tons of different calculations for different scenarios (e.g. mix gases, mix liquids, melt 2 solids and pour them into a cast, etc). taking average looked like a reasonable and quick approximation

the program starts at very low resolution and only literates 8 recursive calls for each ray. it looks ugly i know. it's a software raytracer and i'm still using an ancient programming language so i had to sacrifice quality for speed. i couldn't make the raytracing pipelines run parallelly as it's not supported by the language

for each ray, it ends if either of the following conditions holds

  1. it reaches the background (and get the color from the background)

  2. it reaches the recursion limit (and return a random grey scale noise)

it gives you a rough idea what the scene would look like. once you're done with the arrangement you can press the [c] key to make it generate a full screen image with 16 recursive calls per ray. all the attached images were generated with the program

i need help in this way: i want someone to do the same thing with modern languages which support parallel calculations and / or make use of the gpu rather than the cpu so that we can see "deeper" into the fractal emerging cases. they're beautiful and have a lot of details that i just can't explore due to limitation of programming skill

it feels like exploring the mandelbrot set. the more you dive in and the more you iterate, the more you discover and observe

thanks


r/GraphicsProgramming • • May 09 '25

My First RayTracer(It's really bad, would like some feedback)!

Thumbnail
gallery
212 Upvotes

r/GraphicsProgramming • • Nov 16 '25

Ambient Occlusion with Ray marching - Sponza Atrium 0.65ms 1440p 5070ti

Thumbnail
gallery
211 Upvotes

Beta shader files hosted on discord over at: https://discord.gg/deXJrW2dx6
give me more feedback plsss


r/GraphicsProgramming • • Oct 14 '24

Question atm bugged animation, why?

211 Upvotes

Hey beloved Reddit users, what could be the problem that causes something like this to happen to this little old ATM machine?

3d engine bug? stuck animation loop?


r/GraphicsProgramming • • Sep 30 '24

a simple raycaster game in C

211 Upvotes

r/GraphicsProgramming • • Feb 23 '25

Things I wish I knew regarding PBR when I started

210 Upvotes

I'm the creator of Cave Engine and back then when I was still learning the basics, for many time I struggled to make a decent PBR rendering (and the rendering in general). So I decided to write this small post to hopefully help other beginners.

Those tips may be "obvious" to you if you're already past this stage, but they are very easy to "ignore" or overlook when you're starting, because I did ignored them myself when I started and I was remembering this today.

So this is a compilation of everything that came into my mind that I wish I knew back then. Some of the advice can be a bit biased to my implementations, but I think think they're solid. Feel free to add more to this list with your own experience.

  • Learn about gamma correction, what it is, why you need it and WHEN to use.

  • Your textures (probably) needs to be in Gamma Space, except the Normal Map, that is linear. Learn the difference between RGB and sRGB and submit textures to the GPU accordingly.

  • Normal Maps can be flipped: There are 2 standards: OpenGL and DirectX. They work the same, except that the Green channel is inverted. You need to pay attention to that.

  • For PBR to look decent/correct, you need AT LEAST a texture/cubemap/hdr to simulate reflections (for metallic surfaces) and also to do IBL lighting (ambient light based on this said image). You can create more advanced techniques, but from my experience, this is the least you need to do.

  • You need to render everything first in HDR (High Dynamic Range) and not LDR (Low Dynamic Range). This means that in the shader, your final color can have values greater than 1.0 without getting clamped. If you don't, you will have to be forever fine tuning the light intensities to a very low (and UNREALISTIC) values to not clip the 1.0 threshold and ending up with a bright (all white) area. It will look terrible.

  • After HDR, you need a proper Tone Map to bring the values down to 1.0, LDR (since not every monitor supports HDR). Reinhard is the simplest one, but it does not look very good. I recommend Agx (the one I currently use for Cave), but there are many other good ones.

  • Before Tone Mapping, consider implementing an automatic Exposure system (eye adaptation). It's not mandatory, but will improve your rendering a lot.


r/GraphicsProgramming • • Oct 15 '24

Video The Nostalgia Cube - the idea that came to my mind for Stencil buffering

210 Upvotes

r/GraphicsProgramming • • Sep 23 '24

The trifecta of useful books.

Post image
210 Upvotes

r/GraphicsProgramming • • May 14 '26

A simple additive gradient is so beautiful to me

Post image
209 Upvotes

r/GraphicsProgramming • • Dec 31 '24 Take My Energy

Video Showcase of the clearcoat layer features in my Principled BSDF

209 Upvotes

r/GraphicsProgramming • • Oct 11 '24

Fully raytraced shadows in my D3D12 engine

Post image
209 Upvotes

r/GraphicsProgramming • • Oct 17 '26

Video Complete beginner here! I made a very basic 3D viewer from scratch with C and using terminal as output

208 Upvotes

Hello! I started to learn coding about 2 and a half months ago, and I recently ran into computer graphics, which seemed really damn interesting... so I thought of making a basic program related to it based on things I've learnt so far. I built it completely from scratch in C starting from bressenham's line drawing algorithm. It can print any polyhedron you input

In terms of actual graphics programming, I really know nothing, but I wanna learn. If anyone has suggestions on what I can try out or learn after this, I'd really appreciate it


r/GraphicsProgramming • • Jun 07 '24

Show & tell: Spectral ray tracer made for gemstone cutters and designers to preview designs.

Thumbnail
gallery
208 Upvotes

r/GraphicsProgramming • • Oct 23 '25

Ray Tracing in One Weekend, but 17x faster!

Thumbnail
gallery
207 Upvotes

I've been reading about SIMD and multithreading recently and tried to make a multithreaded version of the Ray Tracing in One Weekend book. It has a reasonable performance (it takes 4.6s to render the first image at 500 spp on my M1 Pro). Here is the source code if anyone is interested :)


r/GraphicsProgramming • • Jan 10 '26

Video A triangle but when I move the window it looks glitched

206 Upvotes

This is a basic interpolated triangle but on wayland I can allow pre multiplied Alpha values in the swapchain making it look "glitched" when I move it.


r/GraphicsProgramming • • Mar 31 '20

Just got dispersion working in our path-tracer

Post image
206 Upvotes

r/GraphicsProgramming • • Sep 06 '26

Source Code "No Graphics API" implementation by Sebastian Aaltonen

Thumbnail
github.com
205 Upvotes

r/GraphicsProgramming • • May 12 '26

Article Vulkan engine in one year

Thumbnail
gallery
205 Upvotes

A year ago, I began working through the Vulkan tutorial with the intention of building a graphics engine for my solo MMO project. I knew that building a graphics engine could be a slippery slope and that I might never start working on the actual game, so I set myself a deadline: one year. This post describes the tech I have built over this year.

The renderer was implemented in C++ using Vulkan 1.3. I used Vulkan-HPP bindings (to make the code idiomatic C++) and Vulkan VMA (to simplify GPU memory management). For input and output, I used SDL3. Procedural mesh and scene generation were implemented in Go.

My build system of choice is Bazel. I repackaged all the Vulkan libraries and SDL3 itself for Bazel, which allowed me to build single-binary, statically linked executables with all unused functions tree-shaken out. I do my development on Linux and occasionally test on Windows. In theory, macOS is also possible, but I have left it out for now. I have a working Bazel build of SDL for macOS, so bolting on MoltenVK should not be a problem in the future. Perhaps macOS will support Vulkan natively before I even get to that.

To generate meshes, I built a DSL that allowed me, as a programmer, to model 3D objects through code. It is similar to OpenSCAD but operates in more artistic terms than in points and vectors. I can express a 3D model as a sequence of commands: create a cube, select the right face, extrude it, rotate, subdivide, attach sub-objects, etc. The parser creates an AST in the form of a Protobuf message that I can serialize and tweak procedurally before passing it to the modeler. The modeler outputs a number of meshes per shader and a recipe on how to assemble the final object from smaller sub-objects and transformations. Some transformations are static, while others are tied to named parameters and enable object animation. All metadata is stored in two formats: one for the server (to understand the semantics of each transformation, for example) and one for the renderer (to upload to the GPU).

The generated meshes then go through the baker. I used the open-source GPU baker "Fornos," but I had to strip out all Windows-specific code, convert it to Vulkan, and make it headless to run on my server. With the help of the baker, I generate base color, normal maps, metalness, roughness, and ambient occlusion textures.

Once models are generated, they are serialized and stored on disk as Protobuf messages.

The scene generator creates the environment as multiple voxel grids. At the highest level, it generates large voxels, each corresponding to a whole room, a tunnel, huge pillars under the building, etc. In principle, I could use wave-function collapse at this level, but it was left out of the prototype. Level generation will be handled separately during actual game development.

Once the coarse grid is ready, a second generation pass kicks in. It creates a fine-grained voxel grid describing where the scene will have concrete, air, windows, etc. The core algorithm is straightforward: if a voxel has contact with both the interior and exterior simultaneously, it becomes a structure. The floor/ceiling boundary checks the "room index" stored in the coarse grid alongside the voxel type. If the voxel below belongs to room X and the voxel above to room Y, the current voxel is turned into a structure as well.

The third pass “cuts out” windows. It looks at large vertical slabs of concrete, decides how many windows to make, and replaces structural voxels with window voxels where necessary.

Next, the generator iterates over all voxels to recognize small patterns (e.g., if there is concrete on the left and a window on the right, it adds a window frame object at that position oriented accordingly). In some places, it creates corner meshes for window frames. In others, it adds exterior decorations to the building. The pattern-matching engine is very generic; a predicate describes what to check around the current position, and an action performs the task, such as adding an object.

The final stage identifies all continuous planes of concrete and, depending on their orientation and the surrounding voxels, creates scene-level geometry such as walls and floors. The exported scene contains meshes ready to be uploaded to the GPU with minimal preprocessing.

The scene is serialized and stored on disk as a Protobuf message again. A lot of things are stored as protobufs. It’s a pretty compact binary format that is easily accessible from C++ and Go.

Finally, we come to the Vulkan renderer. I use Vulkan 1.3 with dynamic rendering and bindless textures.

I experimented with deferred rendering, but the lack of MSAA was a significant downside. I tried implementing anti-aliasing with TAA but couldn't achieve decent results; it was either too blurry or ghosty. Ultimately, I settled on Forward+ rendering and 8x MSAA. The screen is split into small 3D boxes in (x, y, depth) space. For each box, a light clustering shader computes which lights and reflection probes affect it, storing this information in a buffer.

A depth pre-pass fills the depth buffer to reduce the number of fragment shader calls later. The main rendering pass samples the light clustering buffer and applies the lights and reflection probes from the generated lists. Window glass is rendered using weight-based order-independent transparency. It’s very cheap and produces decent results. The shader for large flat surfaces, such as walls and roofs, uses the Hextile algorithm to eliminate repetitive tiling patterns.

Global illumination uses a hierarchy of 3D voxel buffers of increasing size, similar to the technique used in Enlisted. Simplified scene geometry is rasterized to a 3D scene buffer, then a compute shader traces rays from each non-empty voxel to each light to compute voxel illuminance. Finally, another compute shader handles the most expensive part: tracing rays in all directions for each voxel in the scene to update six-sided irradiance. I have not yet implemented a 3D ring buffer to update GI incrementally as the camera moves; this will be done when converting this prototype into a real game client. It should be straightforward.

When sampling reflection probes and GI voxels, I had to fight light leaks through thin walls. If an irradiance voxel ends up right on the wall, it will sense light from both sides, so sampling it will produce incorrect results - light from the left will be visible on the right and vice versa. I found a pretty simple solution. At the scene generation time, I insert “sampler repellents” into each large wall. Each repellent is a thin rectangle that repeats the shape of the wall. Before sampling the voxel grid, I look up those repellents in the vicinity of the point and if it’s too close, then I shift the sampling along the normal. To make it efficient, I use a similar approach to clustered lighting: for each (x, y, depth) box I precompute a list of sampling repellents that can affect that box. However I think in the production version of the engine, I’ll probably scrap this clustered thing and implement a simple global BVH lookup.

For the UI, I used RmlUi and implemented a custom rendering interface interfacing with my engine. My original implementation suffered from multi-millisecond latencies for complex UIs because every rectangle and line of text was rendered with a separate draw call. I couldn't batch them together because those calls were a) order-dependent and b) each used a different texture. Eventually, I discovered bindless textures in Vulkan and fell in love with them. Instead of separate draw calls, I now bind all textures as a large array, add texture index as an instance attribute, and add draw commands to the single draw command buffer. Now, the entire UI is rendered with a single draw call without any texture rebinding between draws, and it takes 0.1ms latency, regardless of the UI complexity.

The final step does tonemapping, color grading, and compositing. I used a piecewise filmic curve and exposed all settings in a custom debug panel. The LUT table is precomputed on the CPU side and sampled in the single compositing shader.

I attached a bunch of screenshots from the last version of the engine to the post.


r/GraphicsProgramming • • Feb 11 '26

Video Real-time 3D CT volume visualization in the browser

205 Upvotes