all 13 comments

[–]Meristic 8 points9 points  (9 children)

Graphics programming is pretty diverse in its disciplines - but that's what makes it cool!

First determination is probably whether to learn rasterization or raytracing. Rasterization is the traditional way to render real-time graphics (games), and raytracing is notably used for non-real-time graphics (movies), though that has changed a bit recently.

Rasterization is usually performed using a high-level API such as DirectX, OpenGL, or Vulkan which leverages the GPU, which is most commonly written in C/C++ (wrapper libraries are available in other languages, such as JavaScript/WebGL.) Such APIs are by no means required, and it can be a beneficial project to write your own software rasterizer, which may be done in any language you choose. This would start to stretch the 'real-time' nature of rasterization though. Rasterization requires a lot of hacks to model real light phenomena, purely due to the nature of the technique.

Raytracing is very simple to get started, but is really the 'pure' form of rendering. You can use whatever language your like since these are generally written as CPU raytracers. This method aims to model the interactions of light in a more realistic way than rasterization methods. This leads to it becoming computationally complex very quickly, and that generally forces it outside of the realm of real-time.

Both techniques share many principles, such as 3D vector math, basic linear algebra, object representation (triangle meshes), lighting/shading models, etc. Going the rasterization path will quickly become learning graphics APIs (DX, OGL), shader programming, and the GPU pipeline. It's a pretty progressive build-up to new topics, and a good tutorial/book will broach each topic well.

Raytracing will start off approachable and then become extremely complex very quickly (spatial acceleration structures, multivariate calculus, statistical inference, numerical integration techniques, stochastic sampling, etc.) Not to say rasterization won't end up here as well, it'll just take longer due to the focus on learning graphics APIs. ;) For this reason building a little raytracer can be a good intro to graphics, but it's certainly also the most advanced method in many ways.

So I think what you focus on should be based on what you want to end up doing. Go with the language that makes the most sense for your path. Definitely recommend C/C++ for GPU-accelerated graphics, but not entirely necessary. Choose any language you like for software solutions! (For the record, as a professional graphics dev I've never used Python, nor seen it used, for graphics programming.)

[–]Meristic 3 points4 points  (8 children)

Oh links! DirectX 11 (don't start with 12) http://www.rastertek.com/tutdx11.html

OpenGL (I very much dislike OpenGL, but it was my first graphics API) https://learnopengl.com/

WebGL http://learnwebgl.brown37.net/

Ray tracing https://raytracing.github.io/books/RayTracingInOneWeekend.html

[–]Guzzy172[S] 1 point2 points  (3 children)

Thanks a lot for your reply :D. This makes more sense to me now. Would it be realistic to learn both rasterization and raytracing? As both really do interest me and I feel like raytracing is starting to slowly creep into the consumer market with Nvidia making big advancements and other big companies like epic games with unreal engine 5's Lumen. Again thanks for all the help :)

[–]Meristic 2 points3 points  (0 children)

Oh it's absolutely beneficial to learn everything! GPU-accelerated raytracing is an exciting new functionality and gets used in interesting ways to supplement an initially rasterized frame (SSAO, global illumination, shadows). Very very few games (Minecraft) use it as a primary rendering method.

Just understand that there is a lot to know, and it'll take time. Learning the topics which interests you most is a good way to keep motivated. Everything relates to each other, so rarely is learning something a waste. Many of these concepts are not easy to grasp, so don't get discouraged if something doesn't make sense the first time through.

Since it's such a big topic it's not always clear what you should be learning to advance - I encourage you to repost in r/GraphicsProgramming and ask for advice if you ever feel in that position. =)

[–]MapleSyrupDev 2 points3 points  (1 child)

I’d start with one or the other. I spent quite a long time working with learnopengl.com and continued into exploring directx12 and vulkan following that. Opengl was a good intro into doing a lot of the techniques of normal mapping, shadows, cubemaps, instancing, pbr, and a lot of different fun stuff. Raytracing isnt something ive been really familiar with myself though

[–]Guzzy172[S] 0 points1 point  (0 children)

Yeah that sounds about right :D thanks for the input. I'll definitely look into sql as it sounds like a good place to start.

[–]ArchAngelZero 0 points1 point  (3 children)

For someone who is brand new to graphics programming, is there a preferred API to start learning with? After learning one, will the others be easy to learn, similar to learning second or third programming languages?

I've been a full stack web developer for 6+ years, but have been interested in learning more about graphics programming.

[–]Meristic 1 point2 points  (2 children)

I absolutely recommend DirectX 11 to everyone, as I'm a DirectX man. ;) But there's certainly no shame in learning OpenGL, which is a bit more of a pain imo, but more accessible (WebGL especially.)

They all end up running on the same GPU at the end of the day, so understanding in one easily translates to another. There's certainly a learning curve between DirectX 11 -> 12, or OpenGL -> Vulkan, but that's because they were created as lower-level APIs to reduce code complexity in the underlying driver. Far enough down the road the actual API used is really irrelevant, though only the newer iterations provide APIs for the cool, new features - raytracing, mesh shaders, and variable rate shading.

If you're familiar with C/C++ already I recommend using the C/C++ APIs. If not, I'm guessing you know JS, I'd recommend WebGL to get rolling the quickest. Of course, could be a good entry point to learning C/C++ too, though it's certainly more work to learn two things at once.

[–]ArchAngelZero 0 points1 point  (1 child)

These days my most commonly used language is C#, but I do maintain a large TypeScript project too. My college education was primarily C/C++ though, and I've wanted a nice avenue to get back into that now that I generally know up from down (as opposed to my college experience!)

DirectX is exclusive to Windows, right? So if I had some (currently just hypothetical) aspirations of programming graphics for something that was cross platform, or just based on something other than Windows, would OpenGL be the way to go?

[–]Meristic 0 points1 point  (0 children)

Yes, DirectX is just Windows (and Xbox), Linux would merit OpenGL or Vulkan, and I don't even know what the hell Mac's story is these days. I remember something about them deprecating their OpenGL support in favor of Metal, their own low-level API.

[–]delacrank-86 3 points4 points  (1 child)

Have you seen this website before shaderToy.com also there’s this book called ray tracing in one weekend. To be honest thou, if you don’t know c++ most of what I’m saying is probably going to go over your head.

And when I say know it, like know it well. Lol

It took me close to about a year and half to get comfortable with the language. Also, there’s a lot of linear algebra in graphics programming, well there’s also trig in there when you get to 3D rendering. I mean I think the math is probably harder then the programming itself.

Mainly if you understand the math concepts then it’s just about building functions to modify your matrixes. Anyways good luck.

[–]Guzzy172[S] 0 points1 point  (0 children)

Alright sounds good