/r/GraphicsProgramming

Photograph via snooOG

A subreddit for everything related to the design and implementation of graphics rendering code.

Rule 1: Posts should be about Graphics Programming.
Rule 2: Be Civil, Professional, and Kind


Suggested Posting Material:
- Graphics API Tutorials
- Academic Papers
- Blog Posts
- Source Code Repositories
- Self Posts
(Ask Questions, Present Work)
- Books
- Renders
(Please xpost to /r/ComputerGraphics)
- Career Advice
- Jobs Postings (Graphics Programming only)


Related Subreddits:

/r/ComputerGraphics

/r/Raytracing

/r/Programming

/r/LearnProgramming

/r/ProgrammingTools

/r/Coding

/r/GameDev

/r/CPP

/r/OpenGL

/r/Vulkan

/r/DirectX


Related Websites:
ACM: SIGGRAPH
Journal of Computer Graphics Techniques

Ke-Sen Huang's Blog of Graphics Papers and Resources
Self Shadow's Blog of Graphics Resources

/r/GraphicsProgramming

54,292 Subscribers

1

Where to go next?

I'm interested in graphics programming, I've been since I didn't know how to program. So I started with learnopengl. I learnt opengl, dx11 and 12 and vulkan, but that's about the extent of my knowledge. I can do basic things like shadow mapping and basic lighting but I've mostly been learning the graphics APIs and not graphics programming, I don't regret it tho as I've done somethings I'm proud of like multiqueue rendering.

The issue us however, that I don't know what to do to learn this stuff, I'm good with math generally but don't really understand integrals and beyond the very basics of linear algebra. So I'm asking for projects you recommend I try that'll help me get better and any libraries that can help me just start writing graphics code without worrying about all the other boring stuff.

0 Comments
2025/02/02
13:26 UTC

22

r/GraphicsProgramming Wiki started.

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.

0 Comments
2025/02/02
11:40 UTC

10

Watched this today. I had no clue that larger triangles can save so much resources.

3 Comments
2025/02/02
00:26 UTC

8

Assist a Noob

This whole page has intriguing posts; honestly, I felt the work shared here is pretty damn good. Though, I joined hoping to see some posts that could help me start with graphics programming.

Looking for a starting point, please show me some resources so I can sink it in and start making stuff so, I can soon share them here like you all.

Disclaimer: I’m passionate to learn graphics cause, I’m a performance modeling engineer for a GPU IP, I clearly know the pipeline, just don’t know how to use it.

4 Comments
2025/02/01
18:05 UTC

5

Weird texture-filtering artifacts (Pixel Art, Vulkan)

Hello,

I am writing a game in a personal engine with the renderer built on top of Vulkan.

Screenshot from game

I am getting some strange artifacts when using a sampler with VK_FILTER_NEAREST for magnification.

It would be more clear if you focus on the robot in the middle and compare it with the original from the aseprite screenshot.

Screenshot from aseprite

Since I am not doing any processing to the sprite or camera positions such that the texels align with the screen pixels, I expected some artifacts like thin lines getting thicker or disappearing in some positions.

But what is happening is that thin lines gets duplicated with a gap in between. I can't imagine why something like this may happen.

In case it is useful, I have attached the sampler create info.

VkSamplerCreateInfo

If you have faced a similar issue before, I would be grateful if you explain it to me (or point me towards a solution).

EDIT: I found that the problem only happens on my dedicated NVidia GPU (3070 Mobile), but doesn't happen on the integrated AMD GPU. It could be a bug in the new driver (572.16).

EDIT: It turned out to be a driver bug.

9 Comments
2025/02/01
16:39 UTC

1

Problem with octahedral probe mapping

https://preview.redd.it/7jprhab8zjge1.png?width=2564&format=png&auto=webp&s=c85711476c7555ca42ac95b56659a6af81e0eff1

I hope this is the right sub for this question. I'm getting a seam on the probes but I just can't figure out what could be causing this. The bilinear blending is correct other than that single pixel seam.

1 Comment
2025/02/01
16:22 UTC

21

Is doing graphics focused CS Masters a good move for entering graphics?

Basically title, have a cs undergrad degree but I've been working in full-stack dev and want to do graphics programming (CAD/medical software/GPU programming/etc, could be happy doing anything graphics related probably)

Would doing a CS masters taking graphics courses and doing graphics research be a smart move for breaking into graphics?

A lot of people on this sub seem to say that a master's is a waste of time/money and that experience is more valuable than education in this field. My concern with just trying to get a job now is that the tech market is in bad shape and I also just don't feel like I know enough about graphics. I've done stuff on my own in Unreal and Maya, including a plugin, and I had a graphics job during undergrad making 3D scientific visualizations, but I feel like this isn't enough to get a job.

Is it still a waste to do a master's? Is the job market for graphics screwed up for the foreseeable future? Skill issue?

5 Comments
2025/02/01
12:17 UTC

12

Finally got something that behave like a game level with my Vulkan engine.

0 Comments
2025/02/01
09:42 UTC

4

Help with GPU Stable Radix Sort

I'm writing a compute shader which needs to sort up to 256 integers in a 256-thread work group.

I have most of a working LSD radix sort algorithm working but I'm having trouble ensuring each pass (sorting a single digit) performs a stable sort to preserve the relative order (from the previous pass) of each key sharing a common digit (and thus, prefix sum and destined bin) in the current pass.

At first I didn't realize the stability property was necessary, and I was using an atomicAdd to calculate the offsets within the same bin of each key sharing the same digit, but of course using an atomic counter does not guarentee the original order of each key is preserved. <- This is my problem.

My question is, what algorithm/method can I use to preserve the original order of keys within the same bin? Given these keys could be positioned at any index beforehand, I can't think of a way to map the key to the new bin whilst preserving that order.

Here is my GLSL code for a single radix sort pass:

shared uint digitPrefixSums[10];
shared uint digitCounts[10];

uint GetDigit(uint num, uint digitIdx)
{
    uint p = uint(pow(10.0, digitIdx));

    return (num / p) % 10;
}

// The key is 'range.x'
void RadixSortRanges(in uvec2 range, out uint outRangeIdx, uint digitIdx)
{
    if(gl_LocalInvocationID.x < 10)
    {
        digitPrefixSums[gl_LocalInvocationID.x] = 0;
        digitCounts[gl_LocalInvocationID.x] = 0;
    }
    memoryBarrierShared();
    barrier();

    // Get lowest significant digit.
    uint lsd = GetDigit(range.x, digitIdx);

    uint outOffset = ~uint(0);

    // Increment digit counter.
    if(range.x != ~uint(0))
    {
        atomicAdd(digitPrefixSums[lsd], 1);
        outOffset = atomicAdd(digitCounts[lsd], 1); // TODO: This doesn't work. Entries with the same LSD are placed next to each other but in a random order due to atomic randomness.
    }                                                // For entries who share a common LSD, they need to be placed next to each other in the same relative order as before in order to preserve the results of the previous sorting steps.
    memoryBarrierShared();
    barrier();

    // Calculate prefix sums for all digits.
    if(gl_LocalInvocationID.x == 0)
    {
        for (uint i = 1; i < 10; ++i)
	    {
	        digitPrefixSums[i] += digitPrefixSums[i - 1];
	    }
    }
    memoryBarrierShared();
    barrier();

    // Calculate index to move the range to.
    {
        uint outIdx = (lsd > 0) ? digitPrefixSums[lsd - 1] : 0;

        outRangeIdx = outIdx + outOffset;
    }
}
4 Comments
2025/02/01
05:27 UTC

8

Question about the optimizations shader compilers perform on uniform expressions

If I have an expression that is only dependent on uniform variables (e.g., sin(time), where time is a uniform float), is the shader compiler able to optimize the code such that the expression is only evaluated once per draw call/compute dispatch instead of for every shader shader invocation? Or is this not possible

22 Comments
2025/02/01
04:22 UTC

13

How to deal with Salary cut situations??

I have strong experience in Three.js and WebGL, along with good frontend knowledge in React and Angular. Recently, a new project came up in my startup that focuses more on computational geometry, primarily using C++ with libraries like OpenGL and CGAL.

I saw this as a great opportunity to switch and learn something new, so I joined the project. However, after working on it for two months, I haven’t been able to show significant progress. Since I’m one of the highest-paid employees in my startup—and given that the company is struggling financially—they now want to cut my salary by half.

I’m in a tough spot. I’ve developed an interest in OpenGL and want to dive deeper into the graphics domain, but this comes at a cost. Should I negotiate with my company or leave the job and focus on self-preparation to get into a better position?

Also, how is the job market for OpenGL and graphics programming? I see more opportunities in the GPU domain—is it as interesting as OpenGL?

16 Comments
2025/01/31
04:50 UTC

2

Can't get mouse events in OpenGL web

I was learning to compile C/C++ graphics applications for the web using Emscripten. I have figured out most of the stuff. But, even after several attempts, I am unable to get mouse events in my OpenGL application when running in the browser.

I was using React on the frontend to create a (modern) minimal example. Opengl Web contains the code. Most of the C++ code is taken from my other repository which runs only natively.

Things I know so far:

  • glfwGetCursorPos() returns (0, 0) without any GLFW errors.
  • Emscripten docs suggest I should use functions like emscripten_set_mousemove_callback and emscripten_set_mousedown_callback for mouse events.
  • Emscripten callback functions do work. They return the correct mouse coordinates (which I have tested by passing them to the Uniform). But, passing them to ImGui using ImGuiio::AddMousePosEvent and ImGuiio::AddMouseButtonEvent or directly assigning ImGuiio::MousePos and ImGuiio::io.MouseClicked doesn't seem to work and ImGui frames remain uninteractable.
  • I have discovered that by pressing Tab key repeatedly, I was able to get the Text box in ImGui frame into focus and also write into it.

And now, I'm stuck :/
Any help would be greatly appreciated. :)

https://preview.redd.it/h8lta9fof6ge1.png?width=1440&format=png&auto=webp&s=fbd2d2534e619133d38188b4e67d4f8e7c83ff9d

Edit: I wasn't passing the canvas element correctly to Wasm Module. Ive fixed that argument (thanks to u/Escupie) If anyone needs Emscripten cmake example to refer to, feel free to use my repository :)

5 Comments
2025/01/30
19:07 UTC

25

Divide image into tiles , condense 3x3 tiles into each tile .

https://imgur.com/gallery/divide-image-into-tile-condense-3x3-tiles-into-1x1-tile-ftlELJm

Step 1 : Divide image into tiles
Step 2 : For any tile , sample a 3x3 tile area of pixels around it .
Step 3 : Condense that 3x3 tile sample into 1x1 tile area .

Result kinda looks like looking through a wall made of glass blocks .

-KanjiCoder

2 Comments
2025/01/30
01:15 UTC

5

SDL_GetClosestDisplayMode: Bad refresh rate and resolution selected on HD 60Hz monitor

I'm testing out an SDL app (using OpenGL) where it tries to get a good default resolution for fullscreen. I'm on Windows 11 running at 60Hz and 1920x1080 on the desktop. The GPU is an AMD Vega 8 iGPU. Early on, the app creates a small window at 1024x768, then tries to switch to an appropriate resolution for exclusive fullscreen, determined by this code:

SDL_DisplayMode closest{0, 0, 0, 0, nullptr};
const SDL_DisplayMode desired{0, 1920, 1080, 60, nullptr};

if (SDL_GetClosestDisplayMode(0, &desired, &closest))
{
  if (SDL_SetWindowDisplayMode(win, &closest) == 0)
  { ...

Unfortunately the app is very choppy and it appears to be because closest is actually 1280x720 @ 17Hz.
Why might SDL_GetClosestDisplayMode match such a bad resolution and refresh rate?

4 Comments
2025/01/29
12:07 UTC

5

Create custom raytracer shader in UE 5.5.1

0 Comments
2025/01/29
09:21 UTC

0

This field is safe from AI?

New aspiring graphics programmer here.. would you say this field is relatively safe from the AI Hype?

39 Comments
2025/01/29
06:24 UTC

5

Help implementing Spherical Harmonics

[Solved]
See https://media.contentapi.ea.com/content/dam/eacom/frostbite/files/gdc2018-precomputedgiobalilluminationinfrostbite.pdf, Page 55

I have a OpenGl project with spherical harmonics setup. When i add a sample to a spherical harmonic i get smooth and correct light from the vector i specified:

Front

But there is a band from the back for some reason. Is this an artifact from using just 16 coefficients? The math in the code below is from Googles Library.

Back

3 Comments
2025/01/28
21:32 UTC

2

Resources to learn post processing effects

Hey guys,
I want to learn about different kinds of post processing effects that I can learn and implement in my opengl/webgl projects. But there is not much info about this
Can you please direct me to some of the resources that helped you learn post processing and stylized rendering(I think stylized rendering will come under post processing , please correct me if I am wrong)

1 Comment
2025/01/28
17:06 UTC

37

What portfolio projects would stand out as a beginner?

I’ve been learning graphics programming in c++ for a couple months now. I got some books on game engine architecture and rendering and stuff. Right now I am working on a chess game. It will have multiplayer (hopefully), and an ai (either going to integrate stockfish, or maybe make my own pretty dumb chess engine.

I haven’t dug into more advanced topics like lighting and stuff yet, which I will soon. I have messed with 3d in a test voxel renderer, but this chess game so far is the first project (specifically related to graphics programming) I will finish.

I would just like to know what portfolio projects sort of stand out as a fresh graduate in the graphics programming space. I certainly have some ideas in mind with what I want to make, but it’s a slow and steady learning process.

5 Comments
2025/01/28
16:55 UTC

Back To Top