r/GraphicsProgramming • • Mar 19 '23

I added some simple physics in OpenGL, and this happened

194 Upvotes

r/GraphicsProgramming • • Jun 07 '25

Got the Vulkan/Assembly Triangle

Post image
193 Upvotes

r/GraphicsProgramming • • Sep 21 '25

Realtime Raytracing Engine with BVH Tree and Multithreading Optimizations

192 Upvotes

For the past bit I’ve been working on a realtime ray tracing engine on the CPU. So far I’ve implemented a variety of materials (Lambertian, metal, emissive, glass) and have optimized my engine by implementing a BVH tree to reduce hit detection from O(n) to O(logn) complexity. I’ve also implemented multithreading by delegating rows of pixels to various threads, netting a ~3x speedup on my laptop.

To reduce noise when the camera stays still I accumulate results to a buffer and then average the buffer with the number of samples to converge to a smooth final result. I also use SDL to display the rendered image to a window.

I highly encourage anyone reading this to look at the code if they’re interested, and provide me feedback and advice: https://github.com/MankyDanky/ray-tracing-engine

I still need to do a few things:

  • Scene switching and loading from JSON or another human readable format

  • A UI to control parameters such as tracing depth, samples per pixel, resolution (thinking of using IMGUI)

  • Building to web


r/GraphicsProgramming • • Mar 31 '25

Just added Compute Shader support to my engine!

Post image
192 Upvotes

r/GraphicsProgramming • • Aug 17 '26

Video WildFlow — Adventures in Real-Time Water Simulation

191 Upvotes

This project started because I wanted large waterfalls in a real-time forest. I could already simulate half million particles at 30 FPS, but scaling to a large domain required rethinking both rendering and simulation. I replaced mesh extraction with density raymarching + hardware ray tracing, then moved to active cells, making the cost depend mostly on the amount of water rather than the size of the world. Large mountain streams finally became practical.
But a waterfall isn’t only water. Rapids required air entrainment, while waterfalls also needed airborne droplets interacting with the surrounding airflow. I ended up writing a different solver for air, coupled to the water: the cascade pushes air downward, the flow curls at its base, and carries droplets with it. This gets closer to a dual phase simulation of water and air, with an engineering approach.

A simple drop experiment then taught me how different physical effects have very different visual weight. More resolution didn’t produce the classic crown splash. Surface tension made droplets beautifully spherical, but the crown required incompressibility. Real-time water is usually somewhat compressible — and therefore slightly rubbery — because disturbances remain local and cheap. I added an iterative projection that lets me increase incompressibility only where it matters.

This became the real subject of WildFlow: understanding physics is one thing; understanding which physics matters for a phenomenon is another. In real time we can’t simulate everything, so the challenge is finding the smallest set of fundamental rules that produces the behavior we care about. And the realtime limitation sometimes helps in focusing on what truly matters and helps understanding phenomena better.

I don’t want to tell water how to look realistic. I’d rather give it simple enough rules and let realism emerge: foam from entrained air, mist from airflow, a crown from pressure propagation. When the result looks unexpectedly right, perhaps we’ve captured something about why nature looks the way it does. That’s the goal: not more physics, but the right physics — enough to make nature emerge.


r/GraphicsProgramming • • Jun 19 '26

First Triangle in DirectX 12. No DXTK just rawdogging the API

Post image
191 Upvotes

r/GraphicsProgramming • • Feb 22 '26

Video My first OpenGL program after a month of reading: Sierpinski Triangle!

191 Upvotes

Hello there! It's been a little over a month now since I got the Learn OpenGL book written by Joey de Vries, and today I finally finished the first section of getting started with OpenGL.

With that, I present a little program that renders Sierpinski triangle in 3D in OpenGL. This is mostly inspired by the comments under the website's chapter for transformations, where a lot of people implemented the same triangle but in 2D. I decided to take it a little further with a 3D version in SDL3 and C, supporting a camera and my Xbox game controller, which was quite fun to program and mess around with.

Here's a link to my source code as well: https://github.com/BrickSigma/Sierpinski-Triangle-OpenGL.

Thanks for reading and have a great day ahead!


r/GraphicsProgramming • • Dec 22 '22

Hi! This is my Vulkan renderer called Croissant. I decided to learn Vulkan and graphics techniques by creating a renderer. Although it is still a work in progress and lacks several features, I hope that sharing my project may be helpful to others who are also learning!

Post image
191 Upvotes

r/GraphicsProgramming • • Aug 27 '22

3D software renderer running on 68000 and written in archaic C

191 Upvotes

r/GraphicsProgramming • • Oct 09 '26

Spreading fire over any mesh without a mask texture: each shader recomputes when a point ignites

190 Upvotes

I got asked whether this is a mask written into a texture or a separate ember mesh driven by a shader. Nothing gets written anywhere. ignite() appends (position in the mesh's local space, start time) to a vec4 ign[8] uniform, and every shader involved recomputes when each point catches fire:

float burn_arrival(vec3 p) {
    float best = 1.0e9;
    for (int i = 0; i < ign_count; i++) {
        float d = length(p - ign[i].xyz);
        float n = vnoise(p * 1.7 + float(i) * 3.1); // value noise, 0..1
        best = min(best, ign[i].w + d * (1.0 + (n - 0.5) * 2.0 * irregularity) / spread_speed);
    }
    return best;
}

The noise scales the distance, which is what makes the front ragged.

Flames, smoke and embers are quads on random surface points (area-weighted, picked once). Every spawn cycle a quad checks whether its spawn time is between arrival and arrival + burn_duration. If it isn't, its four corners collapse to one point.

The char is a copy of the mesh pushed 0.004 along the normal and drawn with premultiplied alpha, so the original material isn't touched. Per fragment, s = time - arrival (plus fbm) drives smoothstep(0, char_time, s) toward near-black, and exp(-3 * (s / front_width - 0.3)2) gives the glowing front.

Burn-away swaps the material and discards a fragment once (s - 0.7 * burn_duration) / 2.5 + noise passes 1, with a hot rim just before.

Known limit: d is straight-line distance, not along the surface, so the fire can jump thin gaps.


r/GraphicsProgramming • • May 05 '25

Raymarched Monolith at Sunset

Post image
190 Upvotes

I recently got into game and graphics programming and found raymarching fascinating. I then came across some excellent work/article by iquilezles showcasing just what amazing things one can create. This is my attempt at an 'artistic' raymarched scene of a sunset over an abstract landscape.

The code is available on Shadertoy: https://www.shadertoy.com/view/3X2Szt


r/GraphicsProgramming • • Aug 15 '26

SIGGRAPH 2026 - Advances in Real-Time Rendering in Games - all talks are now available online

Thumbnail advances.realtimerendering.com
189 Upvotes

r/GraphicsProgramming • • Jan 16 '26

Progress on Character Rendering in OpenGL

Post image
189 Upvotes

Using the screen-space subsurface skin shader from GPU Gems 2 (curvature mapped baked out from Blender) and implementation of Mikktspace normal mapping to support high-poly mesh bake. Hair done with Morgan McGuire's WBOIT.


r/GraphicsProgramming • • Nov 20 '24

Article AAA - Analytical Anti-Aliasing

Thumbnail
blog.frost.kiwi
189 Upvotes

r/GraphicsProgramming • • Jul 22 '26

I’ve Been Working on Mesh-Based Grass and a Shared Wind Field for My Voxel Engine

188 Upvotes

The engine is developed entirely in Rust and uses Vulkan, with shaders written in Slang. The goal is to link the grass (modeled as meshes) to the underlying voxel terrain, while making the wind system fully configurable and reusable by other parts of the engine (via ECS). Here is how it currently works:

  • A compute shader iterates through each column of every terrain chunk from top to bottom. It generates a blade of grass only if the surface voxel uses the "grass" material and the voxel directly above it is empty (It's for world-building, the engine handles grass density and height, which will enable a natural grass growth system).

  • The blades aren’t stored as voxels. They’re generated as GPU instances containing their position, type and height.

  • When the terrain is destroyed or repainted, the chunk’s grass instances are rebuilt from the voxel data. This keeps the grass in sync with the actual terrain edits.

  • Before rendering, the GPU culls unnecessary blades and lowers their geometric detail with distance. The remaining blades are drawn as curved ribbons in a raster pass that uses the depth from the ray-marched voxel world.

  • The ambient wind has its own direction, speed and moving gust fronts. It remains anchored in world space, even when the floating origin moves.

  • ECS components can add radial pushes or directional gusts. The player already uses this system to part the grass. A vehicle, a thruster, a dragon’s wings or anything else could use the same components to affect nearby vegetation.

Grass is currently the first system wired into the full wind field. A matching CPU implementation is already in place, but physics and other vegetation systems haven’t been connected to it yet.

YouTube version with slightly less compression :
https://youtu.be/Zgy-PeqG2Ak


r/GraphicsProgramming • • Jul 22 '25

I took my first step into graphics programming with a Minecraft shader

Thumbnail
youtu.be
188 Upvotes

r/GraphicsProgramming • • Mar 16 '25

Update on my Game Engine and GUI library

188 Upvotes

r/GraphicsProgramming • • Mar 25 '24

How to sculpture a skeleton with realtime animation with just code (sdf & raymarching in glsl)

188 Upvotes

r/GraphicsProgramming • • Oct 23 '26

Video Some scenes with my Vulkan rendering framework

187 Upvotes

Some scenes using my custom Vulkan graphics, with procedurally generated plants.

I use non-triangle geometric primitives with billboard rendering. In these scenes, there are mainly a lot of cylinders for tree branches. Thanks to this, I can use quite few vertices compared to a similar thing built only with triangles. This makes the GPU-computed wind perturbations much cheaper, for example.

Water effects include reflections, refraction, and caustic effects, rendered with multiple passes from different "camera" perspectives, plus screen marching.

The framework uses deferred rendering and does not have any image assets. Surfaces/textures are generated at runtime by combining noise fields.

Runs comfortably at 60 FPS on my non-gaming laptop.

What do you think about the visuals?


r/GraphicsProgramming • • May 30 '26

FPT Renders!

Thumbnail gallery
187 Upvotes

r/GraphicsProgramming • • Oct 12 '25

4 months of my work :>

187 Upvotes

r/GraphicsProgramming • • Jul 16 '25

Pathtracing is nice

Thumbnail
gallery
187 Upvotes

r/GraphicsProgramming • • Apr 11 '25

Question How is this effect best achieved?

Post image
187 Upvotes

I don't play Subnautica but from what I've seen the water inside a flooded vessel is rendered very well, with the water surface perfectly taking up the volume without clipping outside the ship, and even working with windows and glass on the ship.

So far I've tried a 3d texture mask that the water surface fragment reads to see if it's inside or outside, as well as a raymarched solution against the depth buffer, but none of them work great and have artefacts on the edges, how would you guys go about creating this kind of interior water effect?


r/GraphicsProgramming • • Jan 31 '24

Video My Vulkan rendering engine now has clustered forward shading

187 Upvotes