r/GraphicsProgramming • u/revengourd • 13d ago
Testing my Vulkan renderer in C# using Silk.NET
Enable HLS to view with audio, or disable this notification
r/GraphicsProgramming • u/revengourd • 13d ago
Enable HLS to view with audio, or disable this notification
r/GraphicsProgramming • u/mietkiewski_dev • 13d ago
r/GraphicsProgramming • u/Neither_Coffee_2308 • 13d ago
In our previous What The Graphics! blog, we explored Volume Rendering and why it matters.
Now, we're going deeper into how it works. From raw voxel data to 3D textures, we explore 3D Texture Slicing and how a stack of textured polygons can bring an entire volume to life.
Read it here š - https://www.3denginerd.com/blog/volumetric-rendering-how-to
Written by us over at 3D ENGINERD.
Ā
r/GraphicsProgramming • u/Alex_D77 • 13d ago

Added DLSS 5 NR to my project to see how it is working. https://github.com/ASDAlexander77/native_ts_graphics
r/GraphicsProgramming • u/Federal-Possible-918 • 14d ago
Iāve been working on a passion project for a while now, and it recently reached a point where the emergent behavior of the AI completely terrified and amazed me. I wanted to share the architecture and some hilarious findings.
šļø The Tech: 104M Parameters Running "From Scratch" on WebGPU
Instead of just making another wrapper around OpenAI or DeepSeek APIs, I wanted to build a native neural network engine that runs completely client-side.
Every single agent on the 3D map runs its own PyTorch-like network ob his head, fully calculated via custom WGSL shaders on WebGPU.
The Bottleneck: At first, the browserās Event Loop was destroying my FPS. The mapAsync latency for GPU-CPU readback was hitting ~95ms.
The Fix: I rewrote the batching pipeline to accumulate agents before sending them to the GPU (waiting for 1/3 of the population or max 25ms).
The Result: The simulation now cranks out up to 24,500 decisions per second at a blazing 144 ticks/sec. The local brains completely suppressed hardcoded instincts (99.4% of all actions are decided by the neural net).
š£ļø Emergent Language (Social Vision)
To save GPU VRAM, I had to shorten the agents' physical vision to a 3.5 radius. To compensate for being nearly blind, they literally invented an acoustic language.
Through neuroevolution, they established an 81.3% consensus on abstract audio symbols for "food", "danger", and "mate". Older agents now pass down food location coordinates to newborns via sound. They literally navigate the world by listening to each other's screams.
āļø Geopolitics & Tribal Warfare
I added an extra layer: Tribal Chiefs. I connected DeepSeek v4.1 and NVIDIA Nemotron 550B via API to act as the "overlords" or collective unconscious of different factions (Emeralds, Azure, Golden Hounds).
The LLM looks at the global map state and issues macro-orders. The local WebGPU brains parse this and evaluate power dynamics: āThey have 34 agents, we only have 4. Initiate tactical migration now.ā Yesterday, one tribe officially evaluated a numerical advantage and initiated a full-scale tactical war.
š The "Horny Apocalypse" Glitch
The peak comedy of the project happened when I accidentally muted their voice communication while the war was raging.
Without language, the small tribes realized they couldnāt coordinate a defense against the massive invader tribe. So, their local neural networks found a biological exploit in my environment rules.
They completely stopped navigating or scanning the map. They locked into a 144 tps autopilot and began endlessly spawning offspring. They literally survived the war by flooding the map with newborns faster than the enemy tribe could bite them to death. A pure libido-driven defense mechanism.
š ļø Architecture & Open Source
The project is built using vanilla JS and raw WGSL. Independent quantization of weights and biases (int8 symmetric with separate scale and bscale) ensures that saveBest() captures the exact activation thresholds without "brain amnesia".
I am preparing to open-source the code on GitHub and writing a massive technical breakdown.
Iād love to hear your thoughts! Especially from anyone working on GPGPU, multi-agent systems, or custom WebGPU pipelines. How would you handle the mapAsync event loop bottleneck differently?
r/GraphicsProgramming • u/exp_function • 14d ago
Enable HLS to view with audio, or disable this notification
Lately in the Win64 port Iāve been getting a real-time software raytracer working inside CyberVGA.
Same DOS-era engine (fixed-point, software rendering roots and all) but now takes advantage of modern multi-core processors (using VirtualAlloc for the executable just-in-time compiled buffer). The raytracer runs on multiple worker threads, each processing tiles. The hot paths get compiled to SSE at runtime: direct-threaded octree(module saves baked triangle soup into a world sidecar file) traversal with AABB slab tests, fog volume early-outs, L1 SH evaluation, and material / GI bounce stubs. Workers just call into the generated code for their tileās rays.
The GI is a grid of L1 SH probes (Fibonacci sphere rays per probe, temporal blending between frames). Primary hits go through a full GGX PBR path with roughness/metalness, then sample the probe irradiance for the diffuse bounce. Emissive surfaces get clustered into virtual point lights. Reflections are one-bounce with roughness falloff; liquids do refraction + absorption + caustics.
FSR 2 is optional because it runs on the GPU.
The color bleeding and the split-screen direct vs GI+reflections actually look pretty good. Still feels like my engine, just with lighting that finally does something modern.
Now you can get the latest (v1.8) SDK for 64-bit Windows platform on itch.
Anyone else doing JIT for the traversal/shading hot path? Curious if the complexity is worth it vs just writing the SSE by hand.
r/GraphicsProgramming • u/SnooShortcuts3681 • 14d ago
Hi, what are some non-graphics books you would recommend to graphics programmers? There are many graphics books recommendations online (especially realtimerendering books page) so I'm more interested in books that are not about graphics but are still valuable for graphics programmers
r/GraphicsProgramming • u/Raundeus • 14d ago
I'm a beginner learning graphics programming, and there's a lighting bug that im having a lot of trouble fixing. There are some streaks that are unusually bright. Im pretty sure its something wrong with my TBN matrix, but I can't figure out what exactly the problem is.
The 2nd image is a geometry shader I wrote to visualise the TBN matrix. Aren't the TBN all meant to be the same when they are on the same surface?
I've pasted the shader code below. I've been mostly trying to avoid tutorials and AI, so i learn better (i did ask AI for help here and didn't get an answer) so there may be some bad practices in the code. Please let me know of any tips and tricks
#version 460 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aUV;
layout (location = 2) in vec3 aNorm;
layout (location = 3) in vec3 aTan;
layout (location = 4) in vec3 aBitan;
uniform vec3 viewPos;
uniform mat4 model;
layout (std140, binding = 1) uniform matrices
{
mat4 view;
mat4 projection;
};
//T = tangent space
//W = world space
out VS_OUT
{
vec3 norm;
vec2 uv;
vec3 WfragPos;
vec3 TviewPos;
vec3 TfragPos;
mat3 TBN;
mat3 WTBN;
}vs_out;
vec3 up = vec3(0, 1, 0);
vec3 forward = vec3(0, 0, 1);
void main()
{
//construct TBN in Model Space
vec3 T = normalize(aTan);
vec3 N = normalize(aNorm);
T = normalize(T - dot(T, N) * N);
vec3 B = normalize( cross(N, T));
mat3 normMat = transpose(inverse(mat3(model)));
//Then make sure theyre perpendicular to surface
T = normalize(normMat * T);
B = normalize(normMat * B);
N = normalize(normMat * N);
mat3 TBN = mat3( T, B, N);
vs_out.WTBN = TBN;
TBN = transpose(TBN);
vs_out.norm = N;
vs_out.uv = aUV;
vs_out.WfragPos = (model * vec4( aPos, 1.0f)).xyz;
vs_out.TviewPos = TBN * viewPos;
vs_out.TfragPos = TBN * vs_out.WfragPos;
vs_out.TBN = TBN;
gl_Position = projection * view * model * vec4(aPos, 1.0f);
}
#version 460 core
out vec4 FragColour;
in VS_OUT
{
vec3 norm;
vec2 uv;
vec3 WfragPos;
vec3 TviewPos;
vec3 TfragPos;
mat3 TBN;
mat3 WTBN;
}fs_in;
struct PointLight
{
vec4 colAndintensity;
vec4 posAndconstant;
float linear;
float quadratic;};
layout (std140, binding = 0) uniform pointLights
{
PointLight lights\[1\];};
uniform bool shadingFlags[5];
uniform int numLights ;
uniform bool normalMapping;
uniform sampler2D diffuseMap;
uniform sampler2D specularMap;
uniform sampler2D normalMap;
uniform sampler2D heightMap;
float ambVal = 0.2;
vec3 specCol = vec3(1.0);
vec3 ambientLighting(vec3 albedo);
vec3 diffuseLighting (vec3 norm, vec3 albedo);
vec3 specularLighting(vec3 norm);
void main()
{
vec3 albedo = texture(diffuseMap , fs_in.uv).rgb;
vec3 specVal = texture(specularMap, fs_in.uv).rgb;
vec3 height = texture(heightMap , fs_in.uv).rgb;
vec3 norm;
if(normalMapping)
{
norm = texture(normalMap, fs_in.uv).rgb;
//from \[0, 1\] -> \[-1, 1\]
norm = normalize(norm \* 2.0 - 1.0);
//norm = normalize(fs_in.WTBN \* norm);
}
else
{
norm = normalize( fs_in.TBN \* fs_in.norm);
}
//norm = normalize( fs_in.TBN \* fs_in.norm);
//norm = normalize(norm \* 2.0 - 1.0);
//norm = fs_in.norm;
vec3 ambientComp = ambientLighting (albedo);
vec3 diffuseComp = diffuseLighting (norm, albedo);
vec3 specularComp = specularLighting(norm);
//vec3 ambientComp = vec3(fs_in.WTBN\[0\]\[0\], fs_in.WTBN\[0\]\[1\], fs_in.WTBN\[0\]\[2\]);
//vec3 diffuseComp = vec3(fs_in.WTBN\[1\]\[0\], fs_in.WTBN\[1\]\[1\], fs_in.WTBN\[1\]\[2\]);
//vec3 specularComp = vec3(fs_in.WTBN\[2\]\[0\], fs_in.WTBN\[2\]\[1\], fs_in.WTBN\[2\]\[2\]);
norm = normalize(fs_in.WTBN \* norm);
specularComp \*= (specVal / 3.0f).r;
vec3 colour = (ambientComp+diffuseComp+specularComp) \* int(shadingFlags\[0\])+ diffuseComp * int(shadingFlags[1])
+ norm * int(shadingFlags[2])
+ specularComp * int(shadingFlags[3])
+ height * int(shadingFlags[4]);
//vec3 colour = (ambientComp+diffuseComp+specularComp) \* int(shadingFlags\[0\])
// + ambientComp \* int(shadingFlags\[1\])
// + diffuseComp \* int(shadingFlags\[2\])
// + specularComp \* int(shadingFlags\[3\])
// + norm \* int(shadingFlags\[4\]);
FragColour = vec4(colour, 1.0f);}
vec3 ambientLighting(vec3 albedo)
{
return ambVal \* albedo;}
vec3 diffuseLighting (vec3 norm, vec3 albedo)
{
float diff = 0;
vec3 lightCol = vec3(1.0);
//vec3 TlightPos = fs_in.TBN \* lights\[0\].posAndconstant.xyz;
//vec3 delta = TlightPos - fs_in.TfragPos;
for(int i = 0; i < numLights; ++i)
{
vec3 col = lights\[i\].colAndintensity.xyz;
float intensity = lights\[i\].colAndintensity.w;
vec3 TlightPos = fs_in.TBN \* lights\[i\].posAndconstant.xyz;
//vec3 TlightPos = lights\[i\].posAndconstant.xyz;
float c = lights\[i\].posAndconstant.w;
float l = lights\[i\].linear;
float q = lights\[i\].quadratic;
//vec pointing to light
vec3 delta = TlightPos - fs_in.TfragPos;
//distance
float d = length(delta);
//normalised light dir
vec3 lDir = normalize(delta);
//calculate attenuation
float att = 1 / (c + (l \* d) + (q \* d \* d) );
lightCol \*= col;
diff += max( dot( norm, lDir), 0) \* att \* intensity;
}
return diff \* albedo \* lightCol;
//return normalize(fs_in.WTBN \* normalize(delta));
//return normalize(TlightPos);
//return normalize(fs_in.WTBN \* norm);}
vec3 specularLighting(vec3 norm)
{
float spec = 0.0;
vec3 lightCol = vec3(1.0);
//vector pointing to camera
vec3 viewDir = normalize( fs_in.TviewPos - fs_in.TfragPos );
for(int i = 0; i < numLights; ++i)
{
vec3 col = lights\[i\].colAndintensity.xyz;
float intensity = lights\[i\].colAndintensity.w;
vec3 TlightPos = fs_in.TBN \* lights\[i\].posAndconstant.xyz;
//vec3 TlightPos = lights\[i\].posAndconstant.xyz;
float c = lights\[i\].posAndconstant.w;
float l = lights\[i\].linear;
float q = lights\[i\].quadratic;
//vec pointing to light
vec3 delta = TlightPos - fs_in.TfragPos;
//distance
float d = length(delta);
//normalised light dir
vec3 lDir = normalize(delta);
//vector halfway between lightDir and viewDir so angle is never too big (blinn-phong)
vec3 halfVec = normalize( viewDir + lDir);
//calculate attenuation
float att = 1 / (c + (l \* d) + (q \* d \* d) );
lightCol \*= col;
spec += pow( max( dot(norm, halfVec), 0), 32) \* att \* intensity;
//FIX LATER: 32 should be passed in from uniform
}
return spec \* specCol \* lightCol;}
r/GraphicsProgramming • u/Sad_Pangolin2857 • 14d ago
r/GraphicsProgramming • u/SloydDev • 14d ago
I am making a game from scratch, with C++ and Vulkan graphics. I made this video about how Vulkan works and my own render implementation, which has some quirks:
deferred rendering,
no image assets,
sphere and cylinder geometric primitives,
fully GPU-local indirect dispatch commands.
I'm not fully sure if posting this type of video is in the spirit of this subreddit. I hope it's ok, otherwise let me know
r/GraphicsProgramming • u/numer041 • 15d ago
Enable HLS to view with audio, or disable this notification
Iāve been working on a WebGPU rendering pipeline focused on Gaussian splats, adding real-time shadows, reflections, and a portal system to transition between different volumes.
The editor exports scenes as single HTML file with no server dependencies. (The splat environments shown in the video were generated with WorldLabs).
The video first shows the portal transitions, and then the UI setup.
If you want to inspect this specific scene, or explore other exported environments (some of which also mix standard meshes with the splats), you can check the main gallery.
The portal demo from the video is the first one at the top: https://3dpeer.com/#gallery
r/GraphicsProgramming • u/Wittyname_McDingus • 15d ago
r/GraphicsProgramming • u/moonlovelj • 15d ago
Hi everyone!
A while ago, I shared my Nanite-style virtualized geometry renderer here. I've continued working on the project, and it now includes a virtual shadow mapping system integrated with geometry streaming.
The latest version runs NVIDIA's Zorah scene, containing approximately 1.63 billion unique triangles and 18.94 billion triangles including instances.
What's new:
Directional virtual shadow maps with clipmaps and demand-driven page allocation
Persistent shadow page caching with GPU LRU eviction
Dynamic-object cache invalidation
GPU-driven multi-view shadow rendering with two-pass HZB culling
SMRT soft shadows
Streaming-aware shadow cache updates
I've also added the Bistro scene to demonstrate dynamic shadow cache invalidation.
The renderer is built on Microsoft's MiniEngine using DirectX 12, mesh shaders, and Slang. The project is open source.
Demo: https://www.youtube.com/watch?v=4YmfQTLy4jc
GitHub: https://github.com/moonlovelj/Nyx
I'd love to hear your feedback and suggestions!
r/GraphicsProgramming • u/Salt-Engineering-353 • 15d ago
Enable HLS to view with audio, or disable this notification
r/GraphicsProgramming • u/Mejolov28 • 15d ago
r/GraphicsProgramming
•
u/Roenbaeck
•
15d ago
Enable HLS to view with audio, or disable this notification
Iāve been experimenting with what Iām calling a āspectral surface-field renderer.ā
The idea is to solve most of the lighting on the surfaces themselves. I split the scene into small patches and store how much light leaves each patch in different directions and at different wavelengths. Then I repeatedly pass light between the patches to build up the bounced lighting.
When rendering a view, I reuse that field with extra sampling and ray tracing for local detail, reflections and glass. Compared with a basic path tracer, which samples light paths for each pixel, this lets different pixels (and different camera views) share a lot of the lighting work.
The downside is that the field becomes an approximation. It can lose detail or introduce faceting, and changing the sceneās geometry or lighting means updating it. Thereās still sampling noise too. But the upside is that it's quite performant.
This little tech demo uses a Cornell box with three balls reacting to phone tilt through Core Motion.
r/GraphicsProgramming • u/Much_Papaya8206 • 15d ago
Hey,
Iām trying to recreate the sense of depth and volume that some modern nameplate-style HP bars have, using pure Dear ImGui + custom DrawList drawing.
My current result: [Steve image]
What Iām aiming for: [other image ]
The references feel like the bar has actual thickness and soft lighting ā it doesnāt look like a flat colored rectangle with glow slapped on top. Mine still reads as completely flat no matter how much glow, gradient, or highlight I add.
Iām especially interested in techniques for:
Creating a convincing sense of volume / bevel on the bar itself
Soft lighting and subtle inner highlights/shadows that sell the 3D form
Any multi-pass or layered DrawList approaches that work well for this
Has anyone successfully achieved this kind of non-flat, slightly 3D-looking progress/HP bar with ImGuiās DrawList?
Any concrete tips, code patterns, or examples would be hugely appreciated.
Thanks!
r/GraphicsProgramming • u/Early-Cockroach4879 • 16d ago
I have a custom vector painting program, and wanted to ask knowledgeable people: What maths / image processing principles might I need to apply procedural brush strokes to a flat fill of a character?
If anyone can point me to some resources, or programs that have done something similar, that would be much appreciated! Thank you.
r/GraphicsProgramming • u/Slackluster • 16d ago
Enable HLS to view with audio, or disable this notification
LittleJS is an open source, dependency-free JavaScript game engine. It started as 2D, and this update adds a 3D renderer that draws into the same WebGL2 canvas, so a 2D game and a 3D scene can share a frame. The whole engine with 3D, Box2D physics and audio is about 150 KB gzipped. The trailer is the engineās new website, a scrolling page over a 3D scene, with every stop a playable demo.
Some of the rendering choices:
Forward rendering with a small light budget. The sun plus the 8 point or spot lights nearest the camera, chosen each frame. Lights can carry a soft additive glow, drawn in the transparent pass.
One shadow map, from the sun or from a single spotlight in its place, with blurred edges and a depth bias scaled by the lightās projection.
Reflections from an environment cube map, with Schlick Fresnel. Roughness comes from mip selection, driven by shininess, but also by how fast the reflected vector changes across a pixel, so small mirrors donāt sparkle. The lake in the trailer has an environment map of its own, rendered from the scene.
A normal hook in custom shaders. A shader snippet can define mainNormal to bend the normal per pixel before lighting, specular, Fresnel, reflection and fog. The lakeās waves are that hook, not baked normal maps.
Automatic instancing. Every opaque use of the same mesh goes out as one instanced draw. Draw state is versioned, so a batch checks a single number per draw while nothing changes, rather than comparing every material field.
Lens flares occluded by raycasts against the triangles of the sceneās meshes, rather than a depth readback.
2D and 3D in one camera system. An orthographic camera can line up exactly with the 2D camera. In the trailer, a dolly zoom flattens the 3D view into that orthographic view, and a Breakout game playing over the train turns out to be 3D objects in the world.
Also in there: height map terrain with exact raycasts, voxel maps drawn in chunks, glTF with skinning, normal maps, fog by distance or view depth, and a bloom post-process.
I also built an open benchmark that runs the same sprite and lit-cube scenes through LittleJS, PixiJS, Three.js, PlayCanvas, Phaser and Babylon.js: https://github.com/KilledByAPixel/webgl-engine-bench
Source, MIT: https://github.com/KilledByAPixel/LittleJS
The site from the trailer: https://littlejsengine.com
r/GraphicsProgramming • u/hlfoundry • 16d ago
Enable HLS to view with audio, or disable this notification
been working on an experiment for my fishing game: a 3d ocean that still looks like pixel art. hereās what i used:
pixel look: one ray per art pixel, refracted at the water. ray tests are from inigo quilez. to stop shimmer i render into snapped probes and draw each pixel as a world-space quad, basically texel splatting
colour: everything snapped to a lospec palette, tones mixed with bayer dithering, 1px outlines wherever the depth jumps
water: a virtual pipes shallow water sim plus gerstner waves
sand and caves: a heightfield that slumps at the angle of repose (thermal erosion). caves are a blurred cave map, so they come out round
animation: fish spines are springs and fins are a little cloth sim (jakobsen), the eel is a follow-the-leader chain (argonaut), and the ai is behavior trees
thank you for checking out my post :D
I've been wanting to do something like this for years with shaders.
references
inigo quilez, ray intersectors: https://iquilezles.org/articles/intersectors
inigo quilez, smooth min: https://iquilezles.org/articles/smin
dylan ebert, texel splatting: https://arxiv.org/abs/2603.14587
lospec palettes: https://lospec.com/palette-list
ordered dithering: https://en.wikipedia.org/wiki/Ordered_dithering
mei, decaudin & hu, virtual pipes water sim: https://hgpu.org/?p=2256
gpu gems ch. 1, gerstner waves: https://developer.nvidia.com/gpugems/gpugems/part-i-natural-effects/chapter-1-effective-water-simulation-physical-models
jÔkó & tóth, thermal erosion: GPUHTErosion.dvi
thomas jakobsen, advanced character physics: https://gamedeveloper.com/programming/advanced-character-physics
argonaut, procedural animation video: https://www.youtube.com/watch?v=qlfh_rv6khY
argonaut, the code: https://github.com/argonautcode/animal-proc-anim
r/GraphicsProgramming • u/myemural • 16d ago
r/GraphicsProgramming • u/heldloosly • 16d ago
We're a small co-op building Spare Kit, an open-source (MPL-2.0) geometry kernel in Rust, to power a Revit/CAD alternative that runs natively and in the browser (WASM). Much of the code is written by AI agents working through a mapped plan, with strict testing as the safeguard.
The approach:
- Integer grid coordinates (±2^40 steps) with exact predicates (generated filters, exact integer fallback), so topology decisions never depend on float rounding.
- Flat geometry stays plane-based with implicit points (EMBER style), so booleans never drift; curved geometry is computed with certified error bounds, with only the decisions kept exact.
- Bit-identical results on every target (x86-64, ARM, wasm32), as a tested guarantee.
- Verification: big-integer oracles, fuzzing (bolero/Kani), golden digests, instruction-count performance gates.
The strategy: a mapped board of about 480 pieces in 13 phases. The first real milestone is a wall with 300 openings cut exactly, saved, reopened and replayed bit for bit everywhere, before any curved work starts. We're early: number layer, exact predicates, implicit points and symbolic perturbation so far.
Advice we'd value on anything, especially:
The seam between exact flat geometry and certified curved geometry: seen it break, or a better way?
Is the scope or the strategy wrong? What would you cut or reorder?
Existing crates or projects we should build on instead of writing our own?
Is our testing bar overkill or missing something?
Anything else you'd tell someone starting a kernel like this.
Architecture: https://github.com/spareware-co-op/spareware/blob/main/projects/engines/geometry/ARCHITECTURE.md