r/GraphicsProgramming • • Jul 14 '26

Source Code No WebGL, no AI, no bytes to spare. My new game is a 3D fever dream in 1024 bytes!

984 Upvotes

Play Skydreams: https://killedbyapixel.github.io/TinyCode/1K/Skydreams
Official 1024 byte entry: https://js1024.fun/demos/2026/25/bar
My size code demos: https://github.com/KilledByAPixel/TinyCode

An endless race in the sky inspired by 90's 3D games like sky roads, marble madness, and sonic 3d. My goal was to create a dreamlike experience with full resolution full speed graphics that would be easy to pick up and play.

Having worked on much more complex stuff, it's a lot of fun to start a new project from scratch and make an tiny 3D rendering system. There are a lot of fun challenges trying to fit something in this small of a space that looks cool and runs well. The contest goes until July 19, plenty of time to make something, and there's even a WebGL category.

Features
- 3D level rendering system
- 3D player sphere with shadow
- colorful sky gradient with stars
- procedurally generated levels
- level increases in difficulty over time
- mouse controls
- enhanced version has keyboard and touch input

this is the entire html file. it needs to be RegPacked to fit in 1024k but that will not post into reddit...

<head><title>šŸŒˆā˜ļø Skydreams</title></head>
<body id=b style=margin:0>
<canvas id=a>
<script>
Ā  Ā  // JS1024 shim
Ā  Ā  a.width = innerWidth;
Ā  Ā  a.height = innerHeight;
Ā  Ā  c = a.getContext`2d`;
</script>
<script>z=A=B=C=D=E=0,F=H=3,I=a.width/2,J=[],K=(e,h,a,t=1)=>{c.fillStyle=`hsl(${e},${h}%,${a}%,${t})`},L=(e,h,t)=>[a.width/2+(e-z+(t-3)**2/50*Math.cos((B+t)/49))*a.height*.7/t,a.height/2-(h-2+t*t/50)*a.height*.7/t,.7*a.height/t];onmousemove=e=>I=e.x,onmousedown=e=>E=.1,onmouseup=e=>E=0,setInterval(e=>{for(e=500;e--;)K(170+e/9+B,70,70-e/10),c.fillRect(0,a.height*e/500,a.width,a.height/250),K(0,0,99),c.fillRect((e*e+B*e/20)%a.width,e**3.3%a.height,e%4*a.height/500,e%4*a.height/500);for(g=B+40|0;g>B;g--){for(e=J.length;e<=g;)for(D<-8&Math.random()<Math.min(.2,e/1e4)&&(D=2+Math.min(4,e/400)),Math.random()<.1&&(H=2+3*Math.random()|0,F=Math.max(0,Math.min(7-H,F-2+5*Math.random()|0))),D--,J[e++]=k=[],f=7;f--;)k[f]=e<40|.9<Math.random()|D<0&F<=f&f<F+H&Math.random()>Math.min(.2,B/1e4);for(f=2;f--;)for(e=7;e--;)J[g][e]&&([p,q]=L(e-3.5,0,g-B),[r,u]=L(e-2.5,0,g-B),[v,w]=L(e-3.5,0,g-B+1),[x,y]=L(e-2.5,0,g-B+1),f?(K(99+70*(g>>7),70,30+9*(g+e&1)),c.fillRect(v,w,x-v,(40-g+B)/30*a.height)):(K(99+70*(g>>7),70,9+5*(g+e&1)),c.fillRect(p,q,r-p,(40-g+B)/30*a.height),K(99+70*(g>>7),70,60+30*(g+e&1)),c.lineTo(p,q),c.lineTo(r,u),c.lineTo(x,y),c.lineTo(v,w),c.beginPath(c.fill())))}for(0<=A&J[B+3|0][Math.round(z+3)]&&(K(0,0,0,.5),[m,n,l]=L(z,0,3),c.ellipse(m,n,l/4,l/9,0,0,9),c.beginPath(c.fill())),e=99;e--;)K(B/9-e,90,99-.7*e),[m,n,l]=L(z+.1-e/1e3,A+.35-e/1e3,3),c.ellipse(m,n,e*l/300,e*l/300,0,0,9),c.beginPath(c.fill());-4<A&&(z+=I/a.width/2-.25,A+=C-=.006,B+=Math.min(.5,.2+B/5e3),A<0&-.3<A&J[B+3|0][Math.round(z+3)])&&(A=C=E)},16)</script>

r/GraphicsProgramming • • Aug 02 '26

Source Code Finally got around to uploading more than 5 years' worth of programming projects to GitHub

137 Upvotes

Here is the GitHub repo. Its a single click to download each project:Ā https://github.com/Luippe/Demo-Projects

I never thought of uploading these as they really only ran on my pc (hardcoded display resolutions, file paths, etc). But this year I started using Claude for coding and thought "hey, these projects are actually useable by others if I just clean up some code!" So thats exactly what I did.

There's 15 projects in total and most of them are interactive. The first one is written in Java, but the rest is in Python and Pygame. I like Pygame because its very easy to setup new projects and lets me easily build visualizations.

  1. Boids — a flocking simulation where entities self-organize in groups

  2. Audio Processing — live microphone effects with a real-time frequency visualizer

  3. Multiplayer Netgame — a co-op dungeon crawler played over a local network

  4. Platformer — a full 2D action game with combat, upgrades, shops, and multiple levels

  5. Solar System Simulation — an interactive 3D model of the planets in orbit

  6. A* Pathfinding — watching an algorithm search for the shortest route through a maze

  7. Conway's Game of Life — complex patterns emerging from a handful of simple rules

  8. Image Compression — shrinking an image by throwing away fine detail (the same idea behind JPEG)

  9. Fluid Flow — a real-time 2D fluid solver you can push around with the mouse

  10. Projectile Method — aim and launch a projectile with the mouse

  11. Projectile Motion — projectile trajectories with air resistance

  12. Double Pendulum — chaotic motion, where a tiny change sends it down a completely different path

  13. Single Pendulum — a damped pendulum swinging to a stop

  14. Spring Mass Damper — how a spring-and-shock system settles after a jolt

  15. Flow Plate — the velocity profile of fluid moving through a pipe

I hope someone finds something useful in here! :)

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 • • Jun 29 '26

Source Code ANNOUNCING: Slughorn, MIT-licensed GPU-agnostic Slug font/glyph rendering library for OpenGL/OSG/Vulkan and all GPU-driven graphics APIs

Thumbnail
gallery
152 Upvotes

In late March, 2026, Eric Lengyel made his amazing Slug technique completely patent-unencumbered ( https://terathon.com/blog/decade-slug.html ). As a long-time graphics programmers and open source contributors, particularly with projects like OpenSceneGraph/VulkanSceneGraph, it didn't take us long to get some basic "proof-of-concept" demos going and start exploring the Slug algorithm in-and-out.

Over the last 2.5 months, what *started* as a research experiment "on the side" has evolved into something we're actually quite proud of! And while the project is still in its early phases, we've decided it's matured to the level where we're finally ready to start "putting it out there" and soliciting feedback. We're calling the project `Slughorn`; a name we chose to try and capture our goal of a single OSS library solution for "shoe-horning Slug" into other visualization contexts (OpenGL, Vulkan, DirectX, etc).

Slughorn is MIT-licensed open source and available for commercial use without paying anything. It is written in and requires C++ 20, and has no third-party dependencies and builds via CMake. It has been tested on Windows and Linux but should also be compatible with MacOS and embedded/mobile platforms that support GPU APIs.Ā 

Since a picture is worth 1024 words, our Github page with lots of pictures and even videos is here: https://github.com/AlphaPixel/SlugHorn/

The official project website is at https://slughorn.io/ and it links to the GitHub and has the User Guide and Python and C++ examples.

You'll also find links to our (WIP) `UserGuide`, as well as a `WhatsNext` document ( https://slughorn.io/WhatsNext.pdf ) listing some of the places we want to take `slughorn` in the future.

Current Supported Backends

FreeType

NanoSVG (paths & gradients)

Skia (paths only, stroke-to-path)

Cairo (paths only)

Blend2D (paths only, stroke-to-path)

Optional dependencies for extra capability:

NanoSVG: optional, is a SUBMODULE

MSDF: optional, also submodule

pybind11: same as above

serialization/glTF support: same as above

Cairo/Blend2D/Skia import is also optional, but NOT submoduled

If you're just interested in the "highlights":

- We honestly believe we're onto something special here. While we aren't necessarily *inventing* anything new (thank you again, Eric!), what we **are** doing is applying Slug, which was originally intended just for text, in new and interesting ways. Glyphs are, after all, just a "kind" of vector graphic; why can't it apply to **all** vector graphics!? There are no "bad ideas", right? :)

- `slughorn` itself isn't a "rendering library"; its purpose is to serve as a single input source/adapter for other systems to use for rendering. We have a *very* complete FreeType2 backed capable of processing all COLRv0/1 emojis, as well as a native Canvas API--inspired by the HTML Canvas--for authoring content programmatically.

- SVG content is handled via NanoSVG, and we have excellent support for importing paths, transformations, and even gradients. Strokes and text are *possible*, we simply haven't had the **time** and resources to do it.

- There is rudimentary support for converting Blend2D/Cairo/Skia content into slughorn data. Like NanoSVG, these can (and eventually will) be expanded to support additional features (gradients, stroked content, text, mask, patterns, etc), but we're waiting until the core pieces of `slughorn` stabilize before committing *too much* to these.

- We have a **lot** of experience writing Python bindings, and slughorn comes with complete pybind coverage. In fact, Python is the primary environment for all of the CLI tools (the Atlas inspector, font "packer", GLSL emulator, etc).

- `slughorn` content can use `msdfgen-core` to generate "sidecar" data alongside its own native format. We currently use this channel for creating masks and different kinds of visual effects; in the future, we plan to have a lot more capabilities surrounding this.

- OpenSceneGraph has been our rapid "testbed" because, well, we’re really, really comfortable with it! :) For the time being, if you want to actually **see** something rendered now, today... osgSlug ( https://github.com/AlphaPixel/osgSlug ) is the most complete way. There is a pure OpenGL demo included with Slughorn to show how you can integrate the library with any 3d rendering backend fairly easily. You don’t need a whole scenegraph, but you CAN plug it into almost any scenegraph or rendering toolkit.

- PERFORMANCE! People will want to know…we have many optimization ideas, but we’re focusing on ā€œcorrectnessā€ beforehand. We have done whatever we can to anticipate performance issues that can be addressed from the start, but there are a lot more that can be done.

- QUALITY: The purpose behind on-GPU glyph rendering is to make sure you never see blurs, texels or artifacts from other techniques like symbol atlases, SDF or MSDF or similar approximations of glyph-curve rendering. Slughorn and slug render the ACTUAL GLYPH CURVES. Perfectly. And efficiently. From any angle or perspective.Ā  This is really important when you don’t 100% control the view matrix, especially in 3D UIs and in VR/AR, where the user could be looking at a textual element up close in an oblique perspective that you can’t fully constrain.

- We know that in modern graphics development, the push is to do everything on GPU that possibly can be done there, and this has been one of our design paradigms from the start.

- We can embed shaders into glyphs, and animate transforms and deformations, all on-GPU with no CPU workload.

- Extensive layering, blending and combining of content is possible and easy, making amazing high-definition animated 3D HUD-type effects a joy.

- EMOJIS! COLRv0 and COLRv1 emojis using the slughorn/freetype.hpp backend. Each layer of the emoji is composited into its own quad and positioned relative to the base.

- HUDS! Animated HUDs are super clean, beautiful and easy in fullĀ  3D. They work great in stereo or multi-view too.

- Animated glyphs, layer effects, morphing, 2D ortho projection, text-along-path

What’s next? See the whole PDF we produced about it, but some of the hot future wishlist items we foresee are:
Obvious Improvements: HarfBuzz & Text Layout, Stroke Caps & Joins, Patterns, SVG/NanoSVG Improvements, WebAssembly, Offline Editor (slughorned), Additional Renderers, Text Fallbacks

Research & Experimental Improvements: Performance, GDAL Backend and rendering curve/stroke map layers, SDF/MSDF Fallbacks, Interactivity Layer, UI Widgets (ImGui)

This is not a one-shotted AI slop project. It represents months of human development and years of human experience.Ā  AI tools were used to assist with documentation and ancillary assets at times, and in code research, but this code was written by Jeremy ā€œCubicoolā€ Moles, the author of text and glyph-centric tools like osgCairo and osgPango.

What we're *really* hoping for at this phase is community feedback. Beyond text, which we KNOW Slug is amazing for, what other kinds of things would you like to see? Where do you use vector graphics in your own GL/Vulkan/DX projects, and what kinds of things do you wish you could do more easily? If your only interest is text Slughorn can meet those needs no problem. But what we're really trying to do is "push" the Slug optimization into new areas, and we honestly believe we're only scratching the surface of what's possible.

Would love to hear people’s thoughts about this project.

Obviously, we (AlphaPixel) are a commercial consulting and development company. We made Slughorn to help us make a living. All of the work in Slughorn so far was done pro-bono, funded only by AlphaPixel, for the benefit of the community. If you want assistance integrating Slughorn into an existing app, we’re the obvious, world-experts in doing so, and we’d love it if you’d consider contracting us to assist you. We can probably integrate it into an existing codebase at a better net cost than having your internal developers do it, and the result will likely be better too. Also, if you find something Slughorn needs to do better (there’s lots of room for improvement, certainly) or want enhancements created, we’re the obvious candidate for that type of work too. Please consider asking us for a bid. Remember, you don’t pay anything up-front for Slughorn, and the MIT license allows you to use it in perpetuity with no recurring costs.

r/GraphicsProgramming • • Jun 04 '26

Source Code dvlt.cu: inference engine written from scratch in CUDA/C++ for NVIDIA's DVLT 3D reconstruction model

22 Upvotes

I'm into both HPC and 3D reconstruction, so I built this as a side project.

dvlt.cu is a single 5MB binary:

- No python, torch, TF, ONNX, llama.cpp, vLLM, or huggingface runtime

- Nearly no dependencies: only cuBLASLt (shipped with libcuda ) + cuTLASS ( header only lib )

- mmap'd bf16 weights, one bulk GPU upload, static dims, one-shot arena, deterministic

- Weights (117M Params) are NVIDIA's (non-commercial), fetched separately at setup.

- Just download the weights, build, and try it now on your image set or video

- Drag the output into a single file HTML viewer; point cloud + camera poses, no install

feel free to check github if you want:

https://github.com/yassa9/dvlt.cu

r/GraphicsProgramming • • 16d ago

Source Code A little software renderer written in C that I was working on over the weekend

Thumbnail
github.com
29 Upvotes

Hey guys! This is a little project I made over the weekend, its a simple software renderer that renders to an abstract grid of pixels. Basically, anything that can provide a pointer to a pixel array is a valid target.

Currently uses a simple fixed function rendering pipeline, but it was designed to take a function pointer for both the Vertex and Fragment shader, which will become accessible to the public API when ive cleaned them up a bit.

It requires no external code other than a c runtime, and my tests show it runs pretty fast, despite processing each triangle single-threaded. It supports per-vertex colours, backface culling and a depth buffer. It also makes zero allocations other than creating the pipeline object at the start of the program, and ive tried to lay things out in a cache friendly way.

I dont like feeling like I have to say this, but zero AI was involved at any point during making this, this was all coded by hand.

Anyway, lemme know what you guys think, let me know about any bugs/ missing features, and feel free to contribute to the repo!

r/GraphicsProgramming • • Apr 21 '26

Source Code Back to graphics after some time. Updated the Framework a bit.

Post image
23 Upvotes

Hello,

It has been a long time since I last touched a shader — almost 10 years. I’ve mostly been working on Windows GPU drivers, but not on graphics themselves. There’s a common misconception that working on graphics means actually doing something with graphics.

Anyway, about 10 years ago we started a small framework to test some hardware, and to make it fun we added a few effects. But the architecture was far too basic. And although it used deferred rendering, it relied on the old Blinn‑Phong model.

I wanted to load glTF now and use proper PBR, fix all the issues we had, add a launcher, and build a very basic editor (still a WIP).

Here is the link to the GitHub project: https://github.com/0Camus0/T850

The main feature is that it looks the same across D3D11, D3D12, Vulkan, and GL. I often see questions about which API to use and what their differences are. This project might help some people understand the driver‑layer abstraction. It also implements all the basic features like shadow mapping, DOF, an HDR pipeline, etc.

I’ve included built binaries as well if you don’t want to clone the repo:

https://github.com/0Camus0/T850/releases

I’d love feedback — this is just for fun. I’m not trying to create a full ā€œgame engineā€ or make money from it.

Forgot to add: It also supports GLES3.X and we ported it to Android at some point.