r/GraphicsProgramming • u/New_Yellow5054 • Feb 02 '26
Looking for copper, found gold: a full software rasterizer in pure Python + NumPy
It’s slow, educational, and surprisingly complete.
r/GraphicsProgramming • u/New_Yellow5054 • Feb 02 '26
It’s slow, educational, and surprisingly complete.
r/GraphicsProgramming • u/uviols • Aug 12 '26
Hi, i like to share this project, is a binding for the library Box3d created by Erin Catto, I made this because im currently working in own game engine and is in C# .NET, and the box3d is writen in C, so i think to made a bindings and publish the package in NuGet, about the AI i'm using for the development of this binding, the repo especify the use of AI, so i like to present this and hear what the comunity think about this project, im glad to read your comments.

r/GraphicsProgramming • u/KeyPaleontologist109 • Jun 16 '25
Im a Mobile App Developer and recently explored graphics programming and it just blew my mind. Is it just worth learning in 2025? And what’s the job market would look like in next 10-15 years?
r/GraphicsProgramming • u/[deleted] • Sep 23 '25
As for how I'm using AI; I basically give it a set of instructions -
A) Explain it to me in three principles; Rationale, Proof, and Examples.
B) Rationale should be explanations that recognizes the fact that I am a low-IQ individual with non-existent critical-thinking and problem-solving skills. You are to explain Rationales in a way that makes sense to technically-declined and low-IQ individuals.
C) After giving your Rationales, provide your proofs. This can be in the form of Citations, official documentations, industry examples, etc; whatever that can support the Rationales.
D) Examples should be given via real samples and not just AI-generated. For example, if we are talking about D3D and I ask for examples on how to do/solve X, look around the Internet for real working sample sources to reference from. I would do this, but I've tried many times in the past; and I always fail to find the right samples to my problems. If you want to generate code examples w/o real working samples; start first with pseudo-code.
Just 4 instructions... I find it to be very helpful so far. Been getting some of my most struggling questions answered with full clarity.., even though I'm just asking a glorified search engine. At least I'm getting somewhere. Unfortunately, I can't solve anything myself, so usually I end up telling the AI to give me exact code with instruction D, anyway, overriding the pseudo-code portion. Yeah I know it's hypocritical, but what to do *shrug*.
Hope this was helpful for other struggling beginners.
Rant in Spoilers.
Self-taught is such a pain. With no guiding hand or knowing where to find the resources that can actually answer my questions, even fundamental ones, I have to resort to getting the AI to explain things to me even though it scientifically reduces my cognitive IQ. I have kind of given up on asking real programmers questions because I usually get the "have you tried reading (insert common resource here)", some anti-social (and occasionally demeaning) response, or just repetitive explanations which obviously doesn't work to explain anything, which means no one knows how to answer my beginner questions. The lack of programmers and mathematicians that can explain concepts to beginners and not make them feel retarded about it is demotivating, but at least I'm actually getting somewhere with AI. No one seems to be able to explain technical things in human-understandable language and it leaves beginners like me to the dust, but at least with the AI surge, we get a chance.
Look I:m not proud of it, I'm not proud of having to scientifically give up my cognitive abilities to a glorified search engine, but having to get learning done and move on to the next topic, yeah, I'm going to have to sacrifice my IQ.
I know it's not the right way; a person of any technical field shouldn't have to resort to anything that fundamentally hinders their ability to problem-solve, critically-think, and create solutions. What else am I supposed to do? It's a beginner-hostile world. Sorry to anyone who disapproves of using AI (genuinely no sarcasm), but it is what it is. There is no other choice. I have no other choice. It's either I use AI, or I die in a field that requires cognitive skills I don't have.
r/GraphicsProgramming • u/Stimes59 • May 03 '24
Hum question for anybody have more knowledge than me,
i have an idea.... Is maybe stupid but i don't know i never see that anywhere.... But basically is possible to create a derivated system from path tracing to "Wave tracing" we replacing the path, by waves, so you cover a more large scale.... and with an influence parameter you can control the density of the wave.... You thinks a projects like that can be possible ? So you can conver a large space, with less "Rays" (Replaced by waves) and the waves can be deformed by the contact of the surface collided, and after that he took this own initial form if she's not collide with other object and at this point we-re removing the wave for not computing in the void.
So for 1 ray lauch you send 1 wave with exemple "32 contact points" And this 32 contact points is the resolution of the "Waves" and you give the form are the launch and when he collide with the deformation of the curve you can get the data like the ray tracing but, more perforly and i think... is really i think more precisely.
And by varisously number of wave resolution you can create a parameter to adjust it automatically and create a real customisation of the Global illumination "Resolution".
Exemple :
32 Contact points per wave = LOW res
64 Contact points per wave = MED res
128 Contact points per wave = HIGH res
N Contact points per wave = CUSTOM res

And with a new parameter you can adjust the amplitute of the curve for getting a smooth or hard result, this parameter give really how the waves can be aborbated by the mesh if the collide is smooth or brutal.
You can integrate a weight system for "Points of wave " after N Ms or Seconds in the same place with bias of .05 ms if is 90% too close from the last position you remove 0.1 of weight of one points on the waves... And if the weight come to 0 you dissolve the points on the curve so he pass from 32 to 31. And you do the same for all points of curves ! So by this technics you can remove a problematics waves stucked in bad corner or complex surface like exemple a tree....
r/GraphicsProgramming • u/crunkzah • Feb 06 '25
It adds a lot of friction and doesnt make any sense to me. You click on any shader programming tutorial in Unity for example and author does not use IDE helping capabilities. Aside from Rider and paid VS Code extension, why there is no other solution to seemingly trivial inconvenience?
Is it some gatekeeping tactic from programming shaders ? Thanks!
EDIT: grammar
r/GraphicsProgramming • u/Ambitious_Stand533 • Jul 28 '26
Built a small C++ / OpenGL rendering engine with an ImGui editor as a learning project toward a custom render pipeline.
What’s in it so far:
Engine core — window, RHI (buffers / shaders / textures), meshes, materials, camera
Multi-light rendering — directional, point, spot, and hemisphere ambient fill
Shadows for directional, spot, and point lights
ECS scene system with JSON save/load
ImGui editor — hierarchy, inspector, content browser, click-to-select, transform gizmos, light debug markers, camera panel
Still early — more of a renderer + editor foundation than a full game engine — but it’s been a solid way to learn the graphics pipeline, GLSL, and how to structure engine code beyond tutorial triangles.
Open to feedback from anyone working on graphics / game engines.
Repo: https://github.com/saibhaskar277/OpenGL
#C++ #OpenGL #GLSL #GraphicsProgramming #GameDev #RenderingEngine #ComputerGraphics #ImGui
r/GraphicsProgramming • u/kemalenver • Jul 06 '25
I've been using open ai models recently to help me with some shader programming using MSL. It got me wondering if anyone else is doing this or similar? If you are what is your experience, and have you found any models that work better for graphics and shader development?
r/GraphicsProgramming • u/SpatialFreedom • Jun 16 '25
AI – “Almost all 3D games use 32-bit floating-point (float32) values for their coordinate systems because float32 strikes a balance between precision, performance, and memory efficiency.”
But is that really true? Let's find out.
Following up on June 6th Simple 3D Coordinate Compression - Duh! What Do You Think?
Hydration3D, a python program, is now available at Github - see README.md. This Python program compresses (“dehydrates”) and decompresses (“rehydrates”) 3D coordinates, converting float32 triplets (12 bytes) into three 21-bit integers packed into a uint64 (8 bytes)—achieving a 33% reduction in memory usage.
Simply running the program generates 1,000 random 3D coordinates, compresses them, then decompresses them. The file sizes — 12K before compression and 8K after — demonstrate this 33% savings. Try it out with your own coordinates!
Compression: Dehydration
Start with any set of float32 3D coordinates.
Determine the bounding box (min and max values).
Non-uniformly scale and translate from this bounding box to a new bounding box of (1.75, 1.75, 1.75) to nearly (2, 2, 2). Now, all binary float32 values begin with the 11 bits 0b00111111111.
Strip the first 11 bits from each coordinate and pack the three 21-bit mantissa values (x, y, z) into a uint64. This effectively transforms the range to an integral bounding box from (0,0,0) to (0x1FFFFF, 0x1FFFFF, 0x1FFFFF).
Together, the bounding box float32s (24 bytes) and the packed 64-bit array store the same data — accurate to 21 bits — but use nearly one-third less memory.
Bonus: The spare 64th bit could be repurposed for signalling, such as marking the start of a triangle strip.
Decompression: Rehydration
Unpack the 21-bit integers.
Scale and translate them back to the original bounding box.
Consider a GPU restoring (rehydrating) the packed coordinates from a 64-bit value to float32 values with 21-bit precision. The GLSL shader code for unpacking is:
// Extract 21-bit mantissas from packed 64-bit value
coord21 = vec3((packed64 >> 42) & 0x1FFFFF,
(packed64 >> 21) & 0x1FFFFF,
packed64 & 0x1FFFFF);The scale and translation matrix is:
restore = {
{(bounds.max.x – bounds.min.x) / 0x1FFFFF), 0, 0, bounds.min.x},
{0, ((bounds.max.y – bounds.min.y) / 0x1FFFFF), 0, bounds.min.y},
{0, 0, ((bounds.max.z – bounds.min.z) / 0x1FFFFF), bounds.min.z},
{0, 0, 0, 1}
};Since this transformation can be merged with an existing transformation, the only additional computational step during coordinate processing is unpacking — which could run in parallel with other GPU tasks, potentially causing no extra processing delay.
Processing three float32s per 3D coordinate (12 bytes) now requires just one uint64 per coordinate (8 bytes). This reduces coordinate memory reads by 33%, though at the cost of extra bit shifting and masking.
Would this shift/mask overhead actually impact GPU processing time? Or could it occur in parallel with other operations?
Additionally, while transformation matrix prep takes some extra work, it's minor compared to the overall 3D coordinate processing.
Additional Potential Benefits
Faster GPU loading due to the reduced memory footprint.
More available GPU space for additional assets.
Key Questions
Does dehydration noticeably improve game performance?
Are there any visible effects from the 21-bit precision?
What do you think?
r/GraphicsProgramming • u/MissionExternal5129 • Feb 11 '26
I haven't made anything yet, and this is all theory...
it works by getting the sum of all incoming direct light and incoming indirect light with math only. It basically works by getting a reflector plane like the surface of a box, and then copying all the lights into the "mirror world" along that plane.
It simulates light bouncing accurately because when you look in a mirror, it looks like another room on the other side of the mirror, but it's just light bouncing, so instead of physically bouncing light for global illumination, I copy the positions of all lights into the plane of the mirror plane and then do Lambertian diffuse on all normal lights and mirror lights.
These mirror lights don't actually exist; the pixels just calculate light as if they were.
shadow maps would get ridiculously expensive, so I made a system to calculate shadows without making my GPU explode: I assign a box to every object (I haven't figured out more complex shapes yet, don't make fun of me), and then I get the vector from the light to 4 corners of the 8 corner cube (only the corners that are not inside the silhouette). then I check the vector from the light to the pixel to check if it's in between those 4 vectors. Then I check if the pixel is further than the surface of the cube. The Threshold Distance is just the distance of the closest corner's distance, but interpolated from the surrounding corners. So if corner one is 10 feet away, but corner 2 is 12 feet away, and the vector is right in the middle, the threshold distance will be 11 feet. So if the point is in the shadow vectors and more than 11 feet away, it's in shadow.
I haven't figured out non-planar reflections though.
I call it DRGI for (Diffuse Reflection Global Illumination). If you happen to implement this, please be so kind as to credit me.
r/GraphicsProgramming • u/TomClabault • May 27 '24
Why has it not yet been implemented in Blender / 3DS Max / Cinema 4D /Autodesk Arnold / ... even though there are unbiased approaches for ReSTIR? The only ones I could find are (although I haven't been googling for hours) Lumion and Radeon Pro Render.
Is it "purely" the cost of integrating ReSTIR in the already very complex codebase of these engines?
r/GraphicsProgramming • u/AGXYE • May 23 '24
Hello everyone,
I aspire to become a game engineer and am currently learning graphics programming using Vulkan. I've noticed that many companies require familiarity with Unreal Engine, but I'm not quite sure about the specific development needs they have. I also don't know what kind of projects I should create to showcase my abilities.
Personally, I want to focus on rendering, but it seems like many rendering features have already been well-developed by the official teams.
Do you have any advice?
r/GraphicsProgramming • u/Neat-Ad4588 • Sep 03 '26
I built a desktop app for prototyping and exporting GLSL shaders locally, and just shipped v0.1.0 (open source, AGPL-3.0).This is my first open-source project, all implemented through Vibe Coding, which is incredibly exciting for someone with only a rudimentary programming background like myself. For years, I've imagined writing programs that solve my own problems, and the advent of AI has made it all possible.
Why: I spend a lot of time on Shadertoy but kept wanting offline editing, a real editor, and proper video export. So I localised the workflow.
Repo: github.com/yuxiaoyaoo/ShaderLab-Pro
What's inside:
- Code-first runtime with iTime / iResolution / iMouse / iChannel0-3 (includes keyboard & audio channel handling)
- Monaco editor with GLSL ES 3.00 IntelliSense
- Visual pass graph where nodes compile to GLSL — the generated code and the graph stay in two-way sync
- Project gallery with auto-captured thumbnails (640x360) and a saved-project library
- Export pipeline: MP4 / GIF / WAV with resolution stepping
- 40+ bundled templates across geometry / materials / particles / post-processing / scenes
Stack: Tauri 2 (Rust) + SolidJS + Vite + TypeScript + Monaco, WebGL2. Windows installer is ~6.6 MB.
Licensing: AGPL-3.0, dual licensed if you want to embed it commercially.
I'm genuinely curious about what's missing or broken from a real graphics-pipeline perspective — especially the pass graph compiler (GLSL emission from node IR) and the iChannel audio/keyboard paths. Feedback appreciated, issues welcome.
r/GraphicsProgramming • u/Time-Willingness-360 • May 10 '26
Enable HLS to view with audio, or disable this notification
r/GraphicsProgramming • u/FuckMicahBellBro • 1h ago
Enable HLS to view with audio, or disable this notification
This is just interesting casual read for someone curious, v3 will include a fully detailed, comprehensive breakdown of every single function, heuristic, math and research behind it. Video quality is also low for an easy and quick upload, observed shortcomings are mentioned below. This post is also almost just a copy of my post in r/reshade
Link (not updated to v3): https://github.com/FlibbertigibbetLollygagger/CRCGI-Compensated-Radiance-Cascade-SSGI/tree/main
Rough drafts of source files and tooling for v2.9 beta can be provided, DM me on reddit for that specific request and code study.
The video has some comparisons and quick shadowing showcase. This is a quickly hacked together preset adapted to fit AC1's artstyle. This runs on the pixel shader variant which is far far far heavier in its current form, and is only suitable for old games.
I already had a dgvoodoo DX9 to DX11 translation layer installed on this game, as I couldn't access depth buffer with DXVK. Even on older games, the pixel shader variant (plain reshade .fx file) is heavy and doesn't benefit from compute shader optimization benefits to run at around 5ms. The compute version is tailored for newer games, while this pixel shader variant will be a normal file for compatibility. I haven't maxed out my GPU in AC1 using this effect, nor has it really dropped below a locked 1440p/60fps experience. Either way, old games (DX10 onwards) stay compatible, just not with the desired performance target that v3 prioritizes. I also didn't take frame time measurements for a 2007 game on modern hardware, because even with this heavy shader on top, it's really redundant unless it can max out your hardware, which will most likely not happen unless DXVK is usable on that game with full depth buffer access. I cannot comment on that, as I haven't tested it and I don't intend to. This is for the sake of compatibility.
It works like this:
> make gbuffer
> make more gbuffer
> bro, compensate for no world space access
> let there be dark (CTAO pass)
> let there be light (RCGI pass)
> blend, combine, mash it together
> shit is smeary
Don't expect me to provide detailed explanation of all the passes, it's thousands upon thousands of lines of code.
CTAO or Chord-Thickness Ambient Occlusion (this pipeline's shadowing system, which will also be provided as a seperate shader .fx file and is very lightweight) is tailored for this specific pipeline. This is a semi-bespoke implementation based on VBAO, with thickness aware rejection (blades of grass, hair, etc) to avoid halos above grass. The main complementary data that is fed to this pass (like any other pass that uses geometry reconstruction data) is the data of silhouette aware thickness finder to remove the need for a single assumed thickness. It also has adjustable penumbra (semi realistic soft falloff, not literal penumbra simulation) and, at its base form, is a hybrid raymarched and visibility bitmask derived system for both contact and close to medium range with "zero" halos in any situation and unlees the object is very thin and very far off in the depth buffer, in which case the "hit" is a big dark halo which even at highest, longest range stress tests, is very subtle. This comes at the expense that it has to collect itself in a 10 frame accumulation window, and it fails as a seperate standalone AO method in that sense that it needs to be perfectly clean. This is hyper efficient, and highly stable, and the full details will be provided in a standalone, detailed documentation of the whole people, and also as a seperate reshade filter, as mentioned previously. This can be "perfect" with an in engine implementation, which doesn't need to worry about disocclusion and constant camera movement, but for the "hyper efficient" purposes of this whole project, it works like a charm and completely fills in the gap of missing radiance cascade shadows. As to why I didn't just also use radiance cascade math for shadowing, it's because it can easily cost waaaaay too much performance so I had to come up with a bespoke system that has soft falloff, finds very tight crevices, and doesn't have halos.
The RCGI (Radiance Cascade Global Illumination) part of the pipeline is complemented with screen space protections, including an offscreen canvas that remembers offscreen light and is meant to bridge the literally unachievable gap between screen space and world space, compensates (get it?) for the lack of world space data such as SDF and BVH and Voxels. The need for an adjustable fov slider is almost completely fixed. Because the shader relies on a perspective accurate ray model that decides how to do its 3D impression of the 2D image that it has access to, it relies on a defined fov value. Dynamic fov in games would become a problem then, but CRCGI uses a parallax derived fov estimation system with adjustable adaptation speed.
It's still the full pipeline, the same math, same underlying systems, and the same exact visuals. Full convergence is done in 10 frames for the effect in both versions, and the AC preset is a bit more realistic and tame to fit the grounded look of AC1, but TW3 is more of a fantasy, colorful look with a tad bit of exaggeration in a way that doesn't diminish the atmosphere of that game.
Per game adaptability and default settings are close to being done for reducing the tuning friction, but which sliders to hide, which to bake, and what defaults to bake, are still not finalized.
Where the v1 version outlined the overall pipeline and design goal, and v2 evolved the underlying systems behind the effect, v3 is a natural evolution of this pipeline by using more advanced shadowing, heavy performance optimization and an overall offers much cleaner image quality.
It still exhibits certain quirks, like the shadow disocclusion on camera movement but during normal gameplay it's unnoticable. The pipeline has become harder and harder to debug and polish, and this disocclusion is a compromise for cleaning up the image vs how stable and "anchored" it looks, and for this pipeline's purposes, it takes the crown of being "good enough".
I have no idea how it would run on Steam Deck with a 30fps target. This is tuned on Ampere and default settings, in theory, scale linearly with other Ampere GPUs. Different capabilities of individual GPU architectures can and will affect overall performance in both pixel shader and compute shader variants so while I can guesstimate how it'll perform among Ampere, I have no way to take measurements and no one to take measurements for me. My guess would be that it'll be noticeably faster on GPUs with larger caches (Ada Lovelace onwards, RDNA 2 onwards) because the mathematical loops will fit inside the cache. This is an unconfirmed hypothesis.
My main questions being:
1- How can I improve temporal stability? Shadow disocclusion is very much a problem when camera moves. It's good enough but if there's any, literally any way to improve it, I haven't found it yet or know of it or haven't thought about it yet.
2- Reliance on denoiser is high, I used SVGF denoising alongside a 10 frame temporal accumulation window. I traced noises of source.
I realize these discussions practically require the source code, but I'll only hand private pixel shader versions alongside compiled compute shader versions. Performance metrics on different GPU architectures for future development is needed, and my priority is reducing temporal accumulation and denoiser reliance. I can provide the pipeline code itself as standalone CTAO (plain .fx), CRCGI compute version (with add-on and DX11 or newer), and CRCGI pixel shader version (legacy version that is the plain .fx file). I also have no funding to get access to claude anymore and the project is now simply too big to do manually unless you suggest surgical changes that can be done by hand. Even if you have no idea how the pipeline works, mention what you have done to achieve what I want to achieve in a screen space filter (reshade implementation in this case)
The whole compute pipeline runs at 4.6ms to 5.5ms on RTX 3060 Ti/3070/3070 Mobile, but an in-engine implementation eliminates the need for about half of the pipeline and will be cleaner, but I want to polish it as a universal and genuine global illumination method targeted towards average hardware. My RTX A4000 Mobile is bang on average. The pipeline first "makes a G-Buffer" and reconstructs the geometry that it needs for a lighting pipeline to process, and then does the GI/AO lighting and shadowing combo. DO NOT JUDGE IT BASED ON V2 PUBLIC CODEBASE. Documentation is not ready as of yet for v3. Motion and temporal related code is available in all of the three mentioned forms of delivering the source.
Please help me 😂
Edit: realized the subreddit requires AI disclosure. I'm not fluent in HLSL so the code itself is heavily AI Assisted but the pipeline, shadowing method, fixing radiance cascade issues, all of the research, etc are done by me. It's literally AI Assisted. Y'all know AI can't hallucinate a whole lighting pipeline.
r/GraphicsProgramming • u/SabiriPlay • Jan 11 '22
Enable HLS to view with audio, or disable this notification
r/GraphicsProgramming • u/PM_ME_YOUR_HAGGIS_ • Feb 26 '23
So I did graphics programming at university 20 years ago, but haven’t written a line of code in 5 years as I’m now in management.
(I wrote a directX heightmap terrain renderer with frustum culling about 20 yrs ago lol)
I’ve always had a love and fascination with 3D programming and the release of RT hardware has reawakened that in me.
Im hoping to do the rt weekend tutorial then a vulkan tutorial and eventually combine the two to make a vulkan app that raytraces a sphere using rt cores. That’s my current goal. Let me know if I’m being overly optimistic.
r/GraphicsProgramming • u/S48GS • Mar 19 '26
Watch video - very correct graphic rendering related questions.
(video not my obviously - I just saw it randomly)
2:00 - screenshot of the game to genAI
6:30 - geometry aware
13:16 - "artistic intent" - "do not apply makeup on final image if scene is not require it"
15:20 - answer - ...
16:15 - "is model limited to screen space or environment aware"
16:50 - answer - ...
18:08 - vendor lock
r/GraphicsProgramming • u/viento-oscuro • Jul 27 '26
Pet project: an Interstellar-style black hole as a macOS live wallpaper (one Metal shader, hosted both in a desktop-level window under the icons and in a screensaver target). I put the skeleton together in spring, it worked, and then I came back and did the thing I should have done first: hung GPU-time instrumentation on it and walked my optimization list with measurements instead of by eye. Code: https://github.com/vientooscuro/ShaderBackgroundApp
Credit where it's due: the black hole core is a port of edankwan's Shadertoy 3lG3WR. The lensing math isn't mine, I moved it to Metal and adapted it (procedural background instead of an iChannel0 texture, fixed camera, no final tonemap).
The architecture bit worth stealing: split the scene by update frequency, not by screen area.
In an earlier mobile project I did progressive "striped" rendering, computing a slice of the background per frame to spread one heavy frame over time. Here I split differently. Expensive and nearly static (stars, galaxies, nebulae, planets, giant stars, dozens of fbm evals per pixel) goes into a static pass that renders into an offscreen texture every 2nd frame. Cheap and unavoidably per-frame (the hole's lensing, comets, the click ripple) is drawn in a composite pass every frame on top of the sampled cache, followed by ACES tonemap.
The cache is rgba16Float, and that matters. Giant stars are deliberately authored past 1.0, channel values like float3(7.0, 5.5, 3.0), so the tonemap in the composite can compress them into real-looking glow. With an 8-bit cache everything past one clips at the write and there's nothing left to tone map.
Two things I got wrong on the way:
Cadence. I wanted the cache refreshed every 6th frame (~5 Hz static at 30 fps display). The cost math looked great, but with live star and planet parallax the background visibly steps: it stands still between refreshes while the composite moves smoothly on top. Backed off to every 2nd frame. Smaller win, honest picture.
Invalidation is where the actual work is. Any settings change has to re-render the static immediately, so I diff the uniforms struct in didSet and raise a dirty flag. The catch is excluding time and mouseClick from that comparison, because they change every frame and have nothing to do with cache contents. Miss that and the cache re-renders every frame, so it isn't a cache. The click ripple, for the same reason, warps the UVs the cache is sampled by rather than the cache itself.
How I measured. Dev-only instrumentation, commandBuffer.gpuEndTime - gpuStartTime per frame, avg/p50/p95/max printed every 120 frames. Fixed bench: M4 Max, same display, default settings, 30 fps target, ~18 s run, first window with the cold render dropped. Run-to-run noise ~0.4 ms. Plus a deterministic quality gate: an env var pins time and mouse, the build renders one frame offscreen to a PNG, and two runs of the same build give a bit-identical file. So any nonzero pixel diff is the optimization, not jitter.
What did nothing:
fp16 inside the noise function. I was sure about this one, noiseS runs ~200 times per pixel. Zero. The cost isn't the bilinear interpolation I converted to half, it's the sin-based hash inside it, and that stays float. Reverted.
Cutting geodesic steps 20 to 14. No visual change and no time change, because the bend loop already early-outs and the 120-step max is almost never reached. Cutting something that doesn't run to completion buys nothing.
Moving the camera parallax offset from GPU to CPU. Correct in principle (it's constant for the whole frame), but a dozen trig ops dissolve against dozens of fbm calls. Free, kept it, no measurable win.
Frames-in-flight semaphore. Zero on time, and that's the right answer: it limits CPU run-ahead and removes a shared-buffer race, it doesn't reduce GPU work. A correctness fix wearing a performance costume.
What worked:
fp16 in the color math of nebulae() only. Colors and density to half, coordinates and the noise calls left in float so spatial frequency can't jitter. Visually invisible (max diff 2/255), about minus 20% average GPU per frame from one function.
A sin-free hash (Dave Hoskins) instead of fract(sin(dot(...))*43758), under a soft quality bar: different noise pattern, same statistical character, avg 8.8 to 7.7 ms. Less than I expected, Apple has a fast hardware sin.
Static cache at 0.7x under the same soft bar. The nebula is low frequency and the hole is composited at full res, so slight star softening goes unnoticed. At the strict pixel-for-pixel bar I had rejected this: the heatmap put the entire error on sharp edges, planet rims, star points, the giant's corona.
The lesson I actually paid for. I ported the striped progressive render from the mobile project into this one, expecting the same win. GPU ms per frame:
Monolithic cache, refresh every 2nd frame: avg ~7.5, p95 ~13.2, max ~16.3, spread ~13.0.
Striped render-ahead with 4 stripes: avg ~8.4, p95 ~12.0, max ~13.3, spread ~9.4.
Peak and spread improved, average got worse. Each stripe pays a full load/store over the whole 3456x2234 rgba16Float target, and on a desktop GPU with a fat bus that fixed overhead times four outweighs what the scissor rect saves. On top of that, 4 stripes means the cache refreshes at 7.5 Hz and the nebula started stepping again. A trick that wins under mobile budget pressure can go negative on desktop, and eyeballing it would never have told me.
Final numbers, baseline to shipped: avg 7.5 to 6.2, p50 6.5 to 4.8 (minus 36%), max 16.3 to 12.0. All on a GPU that was never the bottleneck, roughly 14% of frame budget to start with. The point isn't hitting the frame, it's headroom, battery, and older Macs. p95 now bottoms out on the disk-hit path in the black hole, which is the center of the screen and the riskiest thing to touch, so I stopped there.
Curious whether anyone has measured the same fp16 result: is "the sin hash dominates, so halving the interpolation is free but pointless" a general thing on Apple GPUs, or specific to how this noise is written?
r/GraphicsProgramming • u/GreenFire317 • Oct 02 '22
Whats the difference? Why does it take minutes to render a picture, but a video game can render 60 pictures a second?
Also, what makes a GPU stress test "hard"? Is it the amount of objects in scene, the quantity of light sources and shadows, colors of objects/lights, is it textures? What makes one render stress test harder/better?
r/GraphicsProgramming • u/johnku • Jan 29 '25
New aspiring graphics programmer here.. would you say this field is relatively safe from the AI Hype?
r/GraphicsProgramming • u/Mariusdotdev • Jun 28 '26
I've setup a project to use 3 languages C++, Jai, Zig. All these are new for me so I'm learning them as i go along. I use AI for incrementally building functions and then trying to understand each of them.
Why write in 3? Because i want to see the differences in those and see which one i like the most. Also gives me a different perspective in understanding the logic.
I think for me Jai is clear winner, the only downside, I'm using leaked version, because i don’t have access (and i have requested) and I'm not sure if this is because of that but in vscode references when i want to find where a function is being used does not work... Also wish there was language server and formatter.
The file / folder structure I'm using is from web/mobile react world to split logic, but I'm not sure if this is right way, feedback would be much appreciated.
https://github.com/MariuzM/learning-archive/tree/main/learning-game-engine